* [PATCH v2 2/7] vm-img: use two different ovf templates for vmware/virtualbox
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
@ 2021-12-14 20:35 ` Henning Schild
2021-12-14 20:35 ` [PATCH v2 3/7] vm-img: shorten code by using variables we have Henning Schild
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:35 UTC (permalink / raw)
To: isar-users; +Cc: 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 <henning.schild@siemens.com>
---
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 5832b29955b5..9bf1fd96c5cc 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 79f3b7e45e83..debdf3b2fdf8 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 e6b53058c1c7..c9561a2c3e53 100644
--- a/meta/classes/vm-img/vm-template.ovf.tmpl
+++ b/meta/classes/vm-img/vm-img-virtualbox.ovf.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
<References>
- <File ovf:href="${VIRTUAL_MACHINE_IMAGE_FILE}" ovf:id="file1"/>
+ <File ovf:id="file1" ovf:href="${VIRTUAL_MACHINE_IMAGE_FILE}"/>
</References>
<DiskSection>
<Info>List of the virtual disks used in the package</Info>
@@ -29,7 +29,6 @@
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
</System>
<Item>
- <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Caption>${OVA_NUMBER_OF_CPU} virtual CPU</rasd:Caption>
<rasd:Description>Number of virtual CPUs</rasd:Description>
<rasd:ElementName>${OVA_NUMBER_OF_CPU} virtual CPU</rasd:ElementName>
@@ -64,92 +63,65 @@
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
- <Item>
- <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
- <rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption>
- <rasd:Connection>NAT</rasd:Connection>
- <rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName>
- <rasd:InstanceID>5</rasd:InstanceID>
- <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
- <rasd:ResourceType>10</rasd:ResourceType>
- </Item>
<Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Caption>disk1</rasd:Caption>
<rasd:Description>Disk Image</rasd:Description>
<rasd:ElementName>disk1</rasd:ElementName>
<rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
- <rasd:InstanceID>6</rasd:InstanceID>
+ <rasd:InstanceID>5</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</Item>
- <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="${OVA_FIRMWARE}"/>
- <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/>
- <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/>
- <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/>
- <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/>
- <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/>
- <vmw:ExtraConfig ovf:required="false" vmw:key="virtualHW.productCompatibility" vmw:value="hosted"/>
- </VirtualHardwareSection>
- <vbox:Machine ovf:required="false" version="1.12-linux" uuid="{${VM_UUID}}" name="${OVA_NAME}" OSType="Debian_64" snapshotFolder="Snapshots" lastStateChange="${LAST_CHANGE}">
- <ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info>
- <Hardware>
- <CPU count="${OVA_NUMBER_OF_CPU}">
- <PAE enabled="true"/>
- <HardwareVirtExLargePages enabled="false"/>
- </CPU>
- <Memory RAMSize="${OVA_MEMORY}"/>
- <Firmware type="${OVA_FIRMWARE_VIRTUALBOX}"/>
- <Boot>
- <Order position="1" device="HardDisk"/>
- <Order position="2" device="None"/>
- <Order position="3" device="None"/>
- <Order position="4" device="None"/>
- </Boot>
- <Display VRAMSize="${OVA_VRAM}" monitorCount="1" accelerate3D="${OVA_3D_ACCEL}" accelerate2DVideo="false"/>
- <VideoRecording enabled="false" file="Test.webm" horzRes="640" vertRes="480"/>
- <RemoteDisplay enabled="false" authType="Null"/>
- <BIOS>
- <IOAPIC enabled="${OVA_ACPI}"/>
- </BIOS>
- <USBController enabled="false" enabledEhci="false"/>
- <Network>
- <Adapter slot="0" enabled="true" MACAddress="${PRIMARY_MAC}" cable="true" speed="0" type="virtio">
- <DisabledModes/>
- <NAT>
- <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
- <Alias logging="false" proxy-only="false" use-same-ports="false"/>
- </NAT>
- </Adapter>
- </Network>
- <LPT>
- <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
- </LPT>
- <AudioAdapter driver="Pulse" enabled="false"/>
- <RTC localOrUTC="local"/>
- <SharedFolders/>
- <Clipboard mode="Disabled"/>
- <DragAndDrop mode="Disabled"/>
- <IO>
- <IoCache enabled="true" size="5"/>
- <BandwidthGroups/>
- </IO>
- <HostPci>
- <Devices/>
- </HostPci>
- <EmulatedUSB>
- <CardReader enabled="false"/>
- </EmulatedUSB>
- <Guest memoryBalloonSize="0"/>
- <GuestProperties/>
- </Hardware>
- <StorageControllers>
- <StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
- <AttachedDevice type="HardDisk" port="0" device="0">
- <Image uuid="{${DISK_UUID}}"/>
- </AttachedDevice>
- </StorageController>
- </StorageControllers>
- </vbox:Machine>
+ <Item>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption>
+ <rasd:Connection>NAT</rasd:Connection>
+ <rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName>
+ <rasd:InstanceID>6</rasd:InstanceID>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </Item>
+ </VirtualHardwareSection>
+ <vbox:Machine ovf:required="false" version="1.12-linux" uuid="{${VM_UUID}}" name="${OVA_NAME}" OSType="Debian_64" snapshotFolder="Snapshots" lastStateChange="${LAST_CHANGE}">
+ <ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info>
+ <Hardware>
+ <CPU count="${OVA_NUMBER_OF_CPU}">
+ <PAE enabled="true"/>
+ <HardwareVirtExLargePages enabled="false"/>
+ </CPU>
+ <Memory RAMSize="${OVA_MEMORY}"/>
+ <Firmware type="${OVA_FIRMWARE_UPPERCASE}"/>
+ <Boot>
+ <Order position="1" device="HardDisk"/>
+ <Order position="2" device="None"/>
+ <Order position="3" device="None"/>
+ <Order position="4" device="None"/>
+ </Boot>
+ <Display VRAMSize="${OVA_VRAM}" monitorCount="1" accelerate3D="${OVA_3D_ACCEL}" accelerate2DVideo="false"/>
+ <RemoteDisplay enabled="false"/>
+ <BIOS>
+ <IOAPIC enabled="${OVA_ACPI}"/>
+ </BIOS>
+ <USBController enabled="false" enabledEhci="false"/>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="${PRIMARY_MAC}" cable="true" type="virtio">
+ <NAT/>
+ </Adapter>
+ </Network>
+ <LPT>
+ <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
+ </LPT>
+ <AudioAdapter driver="Pulse" enabled="false"/>
+ <Clipboard/>
+ <GuestProperties/>
+ </Hardware>
+ <StorageControllers>
+ <StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
+ <AttachedDevice type="HardDisk" port="0" device="0">
+ <Image uuid="{${DISK_UUID}}"/>
+ </AttachedDevice>
+ </StorageController>
+ </StorageControllers>
+ </vbox:Machine>
</VirtualSystem>
</Envelope>
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 000000000000..5280f33509b4
--- /dev/null
+++ b/meta/classes/vm-img/vm-img-vmware.ovf.tmpl
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <References>
+ <File ovf:href="${VIRTUAL_MACHINE_IMAGE_FILE}" ovf:id="file1"/>
+ </References>
+ <DiskSection>
+ <Info>Virtual disk information</Info>
+ <Disk ovf:capacity="${DISK_SIZE_BYTES}" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#${VMDK_SUBFORMAT}"/>
+ </DiskSection>
+ <NetworkSection>
+ <Info>The list of logical networks</Info>
+ <Network ovf:name="nat">
+ <Description>The nat network</Description>
+ </Network>
+ </NetworkSection>
+ <VirtualSystem ovf:id="vm">
+ <Info>A virtual machine</Info>
+ <Name>${OVA_NAME}</Name>
+ <OperatingSystemSection ovf:id="1" vmw:osType="otherGuest">
+ <Info>The kind of installed guest operating system</Info>
+ </OperatingSystemSection>
+ <VirtualHardwareSection>
+ <Info>Virtual hardware requirements</Info>
+ <System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>${OVA_NAME}</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-18</vssd:VirtualSystemType>
+ </System>
+ <Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>${OVA_NUMBER_OF_CPU} virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>${OVA_NUMBER_OF_CPU}</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>${OVA_MEMORY}MB of memory</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>${OVA_MEMORY}</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>ideController0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:ElementName>disk0</rasd:ElementName>
+ <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="false"/>
+ </Item>
+ <Item>
+ <rasd:AddressOnParent>1</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection>nat</rasd:Connection>
+ <rasd:Description>E1000 ethernet adapter on "nat"</rasd:Description>
+ <rasd:ElementName>ethernet0</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ <vmw:Config ovf:required="false" vmw:key="slotInfo.pciSlotNumber" vmw:value="32"/>
+ <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/>
+ <vmw:Config ovf:required="false" vmw:key="connectable.allowGuestControl" vmw:value="true"/>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:ElementName>video</rasd:ElementName>
+ <rasd:InstanceID>6</rasd:InstanceID>
+ <rasd:ResourceType>24</rasd:ResourceType>
+ <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="262144"/>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:ElementName>vmci</rasd:ElementName>
+ <rasd:InstanceID>7</rasd:InstanceID>
+ <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>
+ <rasd:ResourceType>1</rasd:ResourceType>
+ </Item>
+ <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="${OVA_FIRMWARE}"/>
+ <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/>
+ <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/>
+ <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/>
+ <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/>
+ <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="cpuid.coresPerSocket" vmw:value="1"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="ethernet0.pciSlotNumber" vmw:value="32"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="monitor.phys_bits_used" vmw:value="45"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="numa.autosize.cookie" vmw:value="40012"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="numa.autosize.vcpu.maxPerVirtualNode" vmw:value="${OVA_NUMBER_OF_CPU}"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge0.pciSlotNumber" vmw:value="17"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge0.present" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.functions" vmw:value="8"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.pciSlotNumber" vmw:value="21"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.present" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge4.virtualDev" vmw:value="pcieRootPort"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.functions" vmw:value="8"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.pciSlotNumber" vmw:value="22"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.present" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge5.virtualDev" vmw:value="pcieRootPort"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.functions" vmw:value="8"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.pciSlotNumber" vmw:value="23"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.present" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge6.virtualDev" vmw:value="pcieRootPort"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.functions" vmw:value="8"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.pciSlotNumber" vmw:value="24"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.present" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="pciBridge7.virtualDev" vmw:value="pcieRootPort"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="softPowerOff" vmw:value="FALSE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="svga.guestBackedPrimaryAware" vmw:value="TRUE"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="virtualHW.productCompatibility" vmw:value="hosted"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="vmci0.pciSlotNumber" vmw:value="33"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="vmotion.checkpointSVGAPrimarySize" vmw:value="268435456"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="vmotion.svga.graphicsMemoryKB" vmw:value="262144"/>
+ <vmw:ExtraConfig ovf:required="false" vmw:key="vmotion.svga.mobMaxSize" vmw:value="268435456"/>
+ </VirtualHardwareSection>
+ </VirtualSystem>
+</Envelope>
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/7] vm-img: shorten code by using variables we have
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
2021-12-14 20:35 ` [PATCH v2 2/7] vm-img: use two different ovf templates for vmware/virtualbox Henning Schild
@ 2021-12-14 20:35 ` Henning Schild
2021-12-14 20:35 ` [PATCH v2 4/7] vm-img: drop not used variables Henning Schild
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:35 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
this is a purely cosmetic change making use of shorthands we have
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/vm-img.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass
index debdf3b2fdf8..e94b6de2d799 100644
--- a/meta/classes/vm-img.bbclass
+++ b/meta/classes/vm-img.bbclass
@@ -37,10 +37,10 @@ CONVERSION_OPTIONS = "${@set_convert_options(d)}"
do_convert_wic() {
rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
image_do_mounts
- bbnote "Creating ${VIRTUAL_MACHINE_IMAGE_FILE} from ${WIC_IMAGE_FILE}"
+ bbnote "Creating ${VIRTUAL_MACHINE_IMAGE_FILE} from ${SOURCE_IMAGE_FILE}"
sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
/usr/bin/qemu-img convert -f raw -O ${VIRTUAL_MACHINE_IMAGE_TYPE} ${CONVERSION_OPTIONS} \
- '${PP_DEPLOY}/${SOURCE_IMAGE_FILE}' '${PP_DEPLOY}/${VIRTUAL_MACHINE_IMAGE_FILE}'
+ '${PP_DEPLOY}/${SOURCE_IMAGE_FILE}' '${VIRTUAL_MACHINE_DISK}'
}
addtask convert_wic before do_build after do_wic_image do_copy_boot_files do_install_imager_deps do_transform_template
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 4/7] vm-img: drop not used variables
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
2021-12-14 20:35 ` [PATCH v2 2/7] vm-img: use two different ovf templates for vmware/virtualbox Henning Schild
2021-12-14 20:35 ` [PATCH v2 3/7] vm-img: shorten code by using variables we have Henning Schild
@ 2021-12-14 20:35 ` Henning Schild
2021-12-14 20:36 ` [PATCH v2 5/7] vm-img: set vmware machine type to 64bit in our template Henning Schild
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:35 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
some variables are not used in the template we had before, nor in the
new templates, drop them
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/vm-img.bbclass | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass
index e94b6de2d799..db390769b29f 100644
--- a/meta/classes/vm-img.bbclass
+++ b/meta/classes/vm-img.bbclass
@@ -53,7 +53,6 @@ OVA_VRAM ?= "64"
OVA_FIRMWARE ?= "efi"
OVA_ACPI ?= "true"
OVA_3D_ACCEL ?= "false"
-OVA_CLIPBOARD ?= "bidirectional"
OVA_SHA_ALG = "1"
# Generate random MAC addresses just as VirtualBox does, the format is
@@ -65,7 +64,7 @@ macgen() {
}
OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
- OVA_FIRMWARE OVA_ACPI OVA_3D_ACCEL OVA_CLIPBOARD \
+ OVA_FIRMWARE OVA_ACPI OVA_3D_ACCEL \
OVA_SHA_ALG VIRTUAL_MACHINE_IMAGE_FILE"
# the ovf template is updated with ensubst
@@ -91,8 +90,6 @@ do_create_ova() {
rm -f '${DEPLOY_DIR_IMAGE}/${OVA_NAME}.mf'
export PRIMARY_MAC=$(macgen)
- 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]')
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 5/7] vm-img: set vmware machine type to 64bit in our template
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
` (2 preceding siblings ...)
2021-12-14 20:35 ` [PATCH v2 4/7] vm-img: drop not used variables Henning Schild
@ 2021-12-14 20:36 ` Henning Schild
2021-12-14 20:36 ` [PATCH v2 6/7] vm-img: make use of isars template class for most of the tmpl variables Henning Schild
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:36 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
Tell vmware that it is dealing with a 64bit guest. Before that change an
efi image could not be booted because the 32bit uefi firmware would not
like a 64bit bootloader.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/vm-img/vm-img-vmware.ovf.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/vm-img/vm-img-vmware.ovf.tmpl b/meta/classes/vm-img/vm-img-vmware.ovf.tmpl
index 5280f33509b4..2883ce063f90 100644
--- a/meta/classes/vm-img/vm-img-vmware.ovf.tmpl
+++ b/meta/classes/vm-img/vm-img-vmware.ovf.tmpl
@@ -16,7 +16,7 @@
<VirtualSystem ovf:id="vm">
<Info>A virtual machine</Info>
<Name>${OVA_NAME}</Name>
- <OperatingSystemSection ovf:id="1" vmw:osType="otherGuest">
+ <OperatingSystemSection ovf:id="102" vmw:osType="otherGuest64">
<Info>The kind of installed guest operating system</Info>
</OperatingSystemSection>
<VirtualHardwareSection>
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 6/7] vm-img: make use of isars template class for most of the tmpl variables
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
` (3 preceding siblings ...)
2021-12-14 20:36 ` [PATCH v2 5/7] vm-img: set vmware machine type to 64bit in our template Henning Schild
@ 2021-12-14 20:36 ` Henning Schild
2021-12-14 20:36 ` [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye Henning Schild
2021-12-14 20:37 ` [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:36 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
The vm-img class used to envsubst everything itself, but doing so with
the templating mechanism of isar is probably better, also to cover
variable depends.
But we stick with a second run of envsubst for variables where the
content needs to be discovered/calculated.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/vm-img.bbclass | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass
index db390769b29f..c03628c21a37 100644
--- a/meta/classes/vm-img.bbclass
+++ b/meta/classes/vm-img.bbclass
@@ -67,20 +67,9 @@ OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
OVA_FIRMWARE OVA_ACPI OVA_3D_ACCEL \
OVA_SHA_ALG VIRTUAL_MACHINE_IMAGE_FILE"
-# the ovf template is updated with ensubst
-# this function adds the variable from OVA_VARS to the environment
-python update_environment() {
- template_vars = (d.getVar('OVA_VARS', True) or "").split()
- if len(template_vars) == 0:
- return
-
- for varname in template_vars:
- value = d.getVar(varname, True)
- if value:
- os.environ.update({varname: value})
-}
+TEMPLATE_FILES += "${OVF_TEMPLATE_FILE}"
+TEMPLATE_VARS += "${OVA_VARS}"
-do_create_ova[prefuncs] += "update_environment"
do_create_ova() {
if [ ! ${VIRTUAL_MACHINE_IMAGE_TYPE} = "vmdk" ]; then
exit 0
@@ -93,6 +82,7 @@ do_create_ova() {
export LAST_CHANGE=$(date -u "+%Y-%m-%dT%H:%M:%SZ")
export OVA_FIRMWARE_UPPERCASE=$(echo ${OVA_FIRMWARE} | tr '[a-z]' '[A-Z]')
+ export OVF_TEMPLATE_STAGE2=$(echo ${OVF_TEMPLATE_FILE} | sed 's/.tmpl$//' )
image_do_mounts
sudo -Es chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} <<'EOSUDO'
@@ -101,7 +91,7 @@ do_create_ova() {
export DISK_UUID=$(uuidgen)
export VM_UUID=$(uuidgen)
# create ovf
- cat ${PP_WORK}/${OVF_TEMPLATE_FILE} | envsubst > ${PP_DEPLOY}/${OVA_NAME}.ovf
+ cat ${PP_WORK}/${OVF_TEMPLATE_STAGE2} | 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.
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
` (4 preceding siblings ...)
2021-12-14 20:36 ` [PATCH v2 6/7] vm-img: make use of isars template class for most of the tmpl variables Henning Schild
@ 2021-12-14 20:36 ` Henning Schild
2021-12-15 3:04 ` Uladzimir Bely
2021-12-14 20:37 ` [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
6 siblings, 1 reply; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:36 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
in fact the multiconfig had an "-ova" in its name which did not really
follow our pattern MACHINE-DISTRO. While renaming that switch the distro
as well, to what is stable today.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta-isar/conf/local.conf.sample | 2 +-
.../{virtualbox-ova-buster.conf => virtualbox-bullseye.conf} | 2 +-
testsuite/build_test/build_test.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename meta-isar/conf/multiconfig/{virtualbox-ova-buster.conf => virtualbox-bullseye.conf} (77%)
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 9d61c4e851cc..e26090642dfe 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -65,7 +65,7 @@ BBMULTICONFIG = " \
nand-ubi-demo-buster \
nanopi-neo-buster \
stm32mp15x-buster \
- virtualbox-ova-buster \
+ virtualbox-bullseye \
rpi-stretch \
sifive-fu540-sid-ports \
qemuarm64-focal \
diff --git a/meta-isar/conf/multiconfig/virtualbox-ova-buster.conf b/meta-isar/conf/multiconfig/virtualbox-bullseye.conf
similarity index 77%
rename from meta-isar/conf/multiconfig/virtualbox-ova-buster.conf
rename to meta-isar/conf/multiconfig/virtualbox-bullseye.conf
index 30425567b96b..90bb17e52270 100644
--- a/meta-isar/conf/multiconfig/virtualbox-ova-buster.conf
+++ b/meta-isar/conf/multiconfig/virtualbox-bullseye.conf
@@ -5,4 +5,4 @@
MACHINE = "virtualbox"
-DISTRO = "debian-buster"
+DISTRO = "debian-bullseye"
diff --git a/testsuite/build_test/build_test.py b/testsuite/build_test/build_test.py
index de9e3fcda4cc..a957cdc1e78c 100644
--- a/testsuite/build_test/build_test.py
+++ b/testsuite/build_test/build_test.py
@@ -127,7 +127,7 @@ class NoCrossTest(CIBaseTest):
'mc:nand-ubi-demo-buster:isar-image-ubi',
'mc:rpi-stretch:isar-image-base',
'mc:qemuamd64-focal:isar-image-base',
- 'mc:virtualbox-ova-buster:isar-image-base'
+ 'mc:virtualbox-bullseye:isar-image-base'
]
# Cleanup after cross build
--
2.32.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye
2021-12-14 20:36 ` [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye Henning Schild
@ 2021-12-15 3:04 ` Uladzimir Bely
2021-12-15 9:39 ` Henning Schild
0 siblings, 1 reply; 10+ messages in thread
From: Uladzimir Bely @ 2021-12-15 3:04 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
In mail from Tuesday, 14 Dec 2021. 23:36:02 +03 user Henning Schild wrote:
> diff --git a/testsuite/build_test/build_test.py
> b/testsuite/build_test/build_test.py index de9e3fcda4cc..a957cdc1e78c
> 100644
> --- a/testsuite/build_test/build_test.py
> +++ b/testsuite/build_test/build_test.py
> @@ -127,7 +127,7 @@ class NoCrossTest(CIBaseTest):
> 'mc:nand-ubi-demo-buster:isar-image-ubi',
> 'mc:rpi-stretch:isar-image-base',
> 'mc:qemuamd64-focal:isar-image-base',
> - 'mc:virtualbox-ova-buster:isar-image-base'
> + 'mc:virtualbox-bullseye:isar-image-base'
> ]
>
> # Cleanup after cross build
While there are currently separate tests for bullseye and non-bullseye, it
would be better to move the target under "test_nocross_bullseye" test below.
--
Uladzimir Bely
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye
2021-12-15 3:04 ` Uladzimir Bely
@ 2021-12-15 9:39 ` Henning Schild
0 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-15 9:39 UTC (permalink / raw)
To: Uladzimir Bely; +Cc: isar-users
Am Wed, 15 Dec 2021 06:04:24 +0300
schrieb Uladzimir Bely <ubely@ilbers.de>:
> In mail from Tuesday, 14 Dec 2021. 23:36:02 +03 user Henning Schild
> wrote:
> > diff --git a/testsuite/build_test/build_test.py
> > b/testsuite/build_test/build_test.py index
> > de9e3fcda4cc..a957cdc1e78c 100644
> > --- a/testsuite/build_test/build_test.py
> > +++ b/testsuite/build_test/build_test.py
> > @@ -127,7 +127,7 @@ class NoCrossTest(CIBaseTest):
> > 'mc:nand-ubi-demo-buster:isar-image-ubi',
> > 'mc:rpi-stretch:isar-image-base',
> > 'mc:qemuamd64-focal:isar-image-base',
> > - 'mc:virtualbox-ova-buster:isar-image-base'
> > + 'mc:virtualbox-bullseye:isar-image-base'
> > ]
> >
> > # Cleanup after cross build
>
> While there are currently separate tests for bullseye and
> non-bullseye, it would be better to move the target under
> "test_nocross_bullseye" test below.
Ok, done in v3.
Henning
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file
2021-12-14 20:35 [PATCH v2 1/7] vm-img: move template out of package into SRC_URI file Henning Schild
` (5 preceding siblings ...)
2021-12-14 20:36 ` [PATCH v2 7/7] meta-isar: switch virtualbox test from buster to bullseye Henning Schild
@ 2021-12-14 20:37 ` Henning Schild
6 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2021-12-14 20:37 UTC (permalink / raw)
To: isar-users
Really sorry for the noise of sending this now 3 times. Was fighting a
rate-limiting SMTP server but now it is out.
Henning
Am Tue, 14 Dec 2021 21:35:56 +0100
schrieb Henning Schild <henning.schild@siemens.com>:
> Instead of placing just one static template into a file coming via a
> package, fetch that template file. That allows a choice in template
> files, or any kind of modification in layers. Where people might not
> find our template to be sufficient.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> meta/classes/vm-img.bbclass | 8 +++++---
> .../vm-img}/vm-template.ovf.tmpl | 0
> .../vm-template/vm-template_0.1.bb | 16
> ---------------- 3 files changed, 5 insertions(+), 19 deletions(-)
> rename meta/{recipes-devtools/vm-template/files =>
> classes/vm-img}/vm-template.ovf.tmpl (100%) delete mode 100644
> meta/recipes-devtools/vm-template/vm-template_0.1.bb
>
> diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass
> index b230af247357..79f3b7e45e83 100644
> --- a/meta/classes/vm-img.bbclass
> +++ b/meta/classes/vm-img.bbclass
> @@ -7,8 +7,10 @@
> inherit buildchroot
> inherit wic-img
>
> -IMAGER_BUILD_DEPS += "vm-template"
> -IMAGER_INSTALL += "qemu-utils gawk uuid-runtime vm-template"
> +FILESPATH_prepend := "${LAYERDIR_core}/classes/vm-img:"
> +SRC_URI += "file://vm-template.ovf.tmpl"
> +
> +IMAGER_INSTALL += "qemu-utils gawk uuid-runtime"
>
> # virtual machine disk settings
> SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic.img"
> @@ -100,7 +102,7 @@ do_create_ova() {
> export DISK_UUID=$(uuidgen)
> export VM_UUID=$(uuidgen)
> # create ovf
> - cat /usr/share/vm-template/vm-template.ovf.tmpl | envsubst >
> ${PP_DEPLOY}/${OVA_NAME}.ovf
> + cat ${PP_WORK}/vm-template.ovf.tmpl | 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/recipes-devtools/vm-template/files/vm-template.ovf.tmpl
> b/meta/classes/vm-img/vm-template.ovf.tmpl similarity index 100%
> rename from
> meta/recipes-devtools/vm-template/files/vm-template.ovf.tmpl rename
> to meta/classes/vm-img/vm-template.ovf.tmpl diff --git
> a/meta/recipes-devtools/vm-template/vm-template_0.1.bb
> b/meta/recipes-devtools/vm-template/vm-template_0.1.bb deleted file
> mode 100644 index 1d474cd5d8d7..000000000000 ---
> a/meta/recipes-devtools/vm-template/vm-template_0.1.bb +++ /dev/null
> @@ -1,16 +0,0 @@ -# This software is a part of ISAR.
> -#
> -# Copyright (c) Siemens AG, 2020
> -#
> -# SPDX-License-Identifier: MIT
> -
> -inherit dpkg-raw
> -
> -SRC_URI += "file://vm-template.ovf.tmpl"
> -
> -do_install() {
> - TARGET=${D}/usr/share/vm-template
> - install -m 0755 -d ${TARGET}
> - install -m 0740 ${WORKDIR}/vm-template.ovf.tmpl \
> - ${TARGET}/vm-template.ovf.tmpl
> -}
^ permalink raw reply [flat|nested] 10+ messages in thread