From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7041956804245323776 X-Received: by 2002:a7b:cc13:: with SMTP id f19mr1615522wmh.150.1639673177729; Thu, 16 Dec 2021 08:46:17 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:5111:: with SMTP id o17ls17210wms.1.canary-gmail; Thu, 16 Dec 2021 08:46:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUOuQEMqWiM8HDo5L06CbpSDTg1pgIN8b24kuQDiCP1LttK6Xsr75b55S///LmL4BvyXNm X-Received: by 2002:a1c:f005:: with SMTP id a5mr6054708wmb.19.1639673176799; Thu, 16 Dec 2021 08:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639673176; cv=none; d=google.com; s=arc-20160816; b=gQrZGsitrhCmoyEU+A2A0wObPSHjzOfM3dUCmvUZDUrzsJRzcra5QXlQ/yUwaddfPw VeRx/QEVAkYeDgS0oEsQxr8R6hLOhq5hImmGFeRguDxeIIfrg+Wt1VxVZaE2zMR8hSju vcaI4RKzIxbv5aABKpH3ZpCQLRcxQgNyLYA3J82Gm3Y29qJ5KufkG5lGm5xURefDFKgp 1hgOmpGBC9CFJX17n9wXRhndg2PVOubbvRD/MYb2OooLUKs8+j/7caVrKbEgKOSifTVv DNjKhiKx9Iu0OsAZYZymYoKkLIY/2MP7PiIUDkLEd6vwxNWCObb9LuaMutM+vExOUQ6R Ph3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=GUBdKgtBW6j7Q8sFPbn3WI/qdqPSekT5i0eQcmKIeUE=; b=aTiJ7ixhSkMVUtNGuz3Yw9pHLpG5TfuQTd5VsifldCvnXoq1V/Ve9FZBX95rAXczk9 CE5TcknWwjs+k5KgWFwFS7fOcvJSpZCYishSqVpPaeas1wN/v9WayHpkLh5Ixyb+/oLx 9LHCiIy2Q0lNjNVfE+E5EyRcnDH6QZLMLw6nrVcty+HSf4/ikR4Ltwbr4i4W/42cS3h9 DZ6LUaK9CgLTn+teUv1oYyRwIZPBS/Ufn8DSO1Z75W7O5RRFznkX2a8hw4e72iVlvq+7 bQjG+QrGfoQ+bpr8ltqEhSq0r2XSpOIKdsReltHxsERazf73EF2wEFESp5eJfayH6wLT i4vg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id i12si389382wml.2.2021.12.16.08.46.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Dec 2021 08:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from localhost.localdomain (mm-214-81-214-37.mgts.dynamic.pppoe.byfly.by [37.214.81.214] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 1BGGk8Wo014355 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Dec 2021 17:46:15 +0100 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Henning Schild Subject: [PATCH v5 2/7] vm-img: use two different ovf templates for vmware/virtualbox Date: Thu, 16 Dec 2021 19:45:57 +0300 Message-Id: <20211216164602.326689-3-amikan@ilbers.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216164602.326689-1-amikan@ilbers.de> References: <20211216164602.326689-1-amikan@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: rIdpsL7l3LoZ From: Henning Schild Both vmware and virtualbox have their own dialects of "ovf", there is no common way to describe things. That combined template was trying by mixing both dialects into one file. But the result caused parsing error on recent vmware. Instead of trying one size fits all, this patch introduces two templates. Both derived from ovf exports done on recent version of vmware and virtualbox. Because of the vmdk sub-format it was anyways not possible to build one ova image that would work for both VMMs. We also now set the uppercase version of OVA_FIRMWARE, which is needed for virtualbox. Before it was called OVA_FIRMWARE_VIRTUALBOX but was not set. Signed-off-by: Henning Schild --- meta-isar/conf/machine/vmware.conf | 2 + meta/classes/vm-img.bbclass | 6 +- ...te.ovf.tmpl => vm-img-virtualbox.ovf.tmpl} | 132 +++++++----------- meta/classes/vm-img/vm-img-vmware.ovf.tmpl | 127 +++++++++++++++++ 4 files changed, 185 insertions(+), 82 deletions(-) rename meta/classes/vm-img/{vm-template.ovf.tmpl => vm-img-virtualbox.ovf.tmpl} (54%) create mode 100644 meta/classes/vm-img/vm-img-vmware.ovf.tmpl diff --git a/meta-isar/conf/machine/vmware.conf b/meta-isar/conf/machine/vmware.conf index 5832b29..9bf1fd9 100644 --- a/meta-isar/conf/machine/vmware.conf +++ b/meta-isar/conf/machine/vmware.conf @@ -11,5 +11,7 @@ WKS_FILE ?= "sdimage-efi" IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}" +OVF_TEMPLATE_FILE ?= "vm-img-vmware.ovf.tmpl" + VMDK_SUBFORMAT = "streamOptimized" IMAGE_FSTYPES ?= "vm-img" diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass index 79f3b7e..debdf3b 100644 --- a/meta/classes/vm-img.bbclass +++ b/meta/classes/vm-img.bbclass @@ -8,7 +8,8 @@ inherit buildchroot inherit wic-img FILESPATH_prepend := "${LAYERDIR_core}/classes/vm-img:" -SRC_URI += "file://vm-template.ovf.tmpl" +OVF_TEMPLATE_FILE ?= "vm-img-virtualbox.ovf.tmpl" +SRC_URI += "file://${OVF_TEMPLATE_FILE}" IMAGER_INSTALL += "qemu-utils gawk uuid-runtime" @@ -93,6 +94,7 @@ do_create_ova() { export SECONDARY_MAC=$(macgen) export DISK_NAME=$(basename -s .vmdk ${VIRTUAL_MACHINE_DISK}) export LAST_CHANGE=$(date -u "+%Y-%m-%dT%H:%M:%SZ") + export OVA_FIRMWARE_UPPERCASE=$(echo ${OVA_FIRMWARE} | tr '[a-z]' '[A-Z]') image_do_mounts @@ -102,7 +104,7 @@ do_create_ova() { export DISK_UUID=$(uuidgen) export VM_UUID=$(uuidgen) # create ovf - cat ${PP_WORK}/vm-template.ovf.tmpl | envsubst > ${PP_DEPLOY}/${OVA_NAME}.ovf + cat ${PP_WORK}/${OVF_TEMPLATE_FILE} | envsubst > ${PP_DEPLOY}/${OVA_NAME}.ovf tar -cvf ${PP_DEPLOY}/${OVA_NAME}.ova -C ${PP_DEPLOY} ${OVA_NAME}.ovf # VirtualBox needs here a manifest file. VMware does accept that format. diff --git a/meta/classes/vm-img/vm-template.ovf.tmpl b/meta/classes/vm-img/vm-img-virtualbox.ovf.tmpl similarity index 54% rename from meta/classes/vm-img/vm-template.ovf.tmpl rename to meta/classes/vm-img/vm-img-virtualbox.ovf.tmpl index e6b5305..c9561a2 100644 --- a/meta/classes/vm-img/vm-template.ovf.tmpl +++ b/meta/classes/vm-img/vm-img-virtualbox.ovf.tmpl @@ -1,7 +1,7 @@ - + List of the virtual disks used in the package @@ -29,7 +29,6 @@ virtualbox-2.2 - hertz * 10^6 ${OVA_NUMBER_OF_CPU} virtual CPU Number of virtual CPUs ${OVA_NUMBER_OF_CPU} virtual CPU @@ -64,92 +63,65 @@ PIIX4 5 - - true - Ethernet adapter on 'NAT' - NAT - Ethernet adapter on 'NAT' - 5 - E1000 - 10 - 0 disk1 Disk Image disk1 /disk/vmdisk1 - 6 + 5 3 17 - - - - - - - - - - Complete VirtualBox machine configuration in VirtualBox format - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + true + Ethernet adapter on 'NAT' + NAT + Ethernet adapter on 'NAT' + 6 + 10 + + + + Complete VirtualBox machine configuration in VirtualBox format + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/meta/classes/vm-img/vm-img-vmware.ovf.tmpl b/meta/classes/vm-img/vm-img-vmware.ovf.tmpl new file mode 100644 index 0000000..5280f33 --- /dev/null +++ b/meta/classes/vm-img/vm-img-vmware.ovf.tmpl @@ -0,0 +1,127 @@ + + + + + + + Virtual disk information + + + + The list of logical networks + + The nat network + + + + A virtual machine + ${OVA_NAME} + + The kind of installed guest operating system + + + Virtual hardware requirements + + Virtual Hardware Family + 0 + ${OVA_NAME} + vmx-18 + + + hertz * 10^6 + Number of Virtual CPUs + ${OVA_NUMBER_OF_CPU} virtual CPU(s) + 1 + 3 + ${OVA_NUMBER_OF_CPU} + + + byte * 2^20 + Memory Size + ${OVA_MEMORY}MB of memory + 2 + 4 + ${OVA_MEMORY} + + + 0 + IDE Controller + ideController0 + 3 + 5 + + + 0 + disk0 + ovf:/disk/vmdisk1 + 4 + 3 + 17 + + + + 1 + true + nat + E1000 ethernet adapter on "nat" + ethernet0 + 5 + E1000 + 10 + + + + + + false + video + 6 + 24 + + + + false + vmci + 7 + vmware.vmci + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.25.1