public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] imagetypes_vm: add support for standalone VMDK images
@ 2026-10-30 11:57 'Clara Kowalsky' via isar-users
  2026-10-30 12:27 ` 'Moessbauer, Felix' via isar-users
  0 siblings, 1 reply; 3+ messages in thread
From: 'Clara Kowalsky' via isar-users @ 2026-10-30 11:57 UTC (permalink / raw)
  To: isar-users; +Cc: Clara Kowalsky

Commit 48c1aee5e797 ("imagetypes_vm: clean up intermediate ova
artifacts") removes the VMDK after assembling the OVA. Some use cases
require only a VMDK, both VMDK and OVA, or only OVA.

With this change, it is possible to set:
- IMAGE_FSTYPES = "vmdk" to generate the VMDK without OVA packaging
- IMAGE_FSTYPES = "vmdk ova.zst" to generate both. In that case, OVA
  depends on the VMDK task and reuses its output without converting the
  disk again
- IMAGE_FSTYPES = "ova.zst" to build just the OVA and clean up the
  intermediate artifacts

Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
---
 doc/user_manual.md                        |  1 +
 meta/classes-recipe/imagetypes_vm.bbclass | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 09ac080b..199eb931 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -540,6 +540,7 @@ Currently, the following image types are provided:
  - `wic` - full disk image with user-specified partitions created and populated using the wic tool
  - `ubi` - image for use on mtd nand partitions employing UBI
  - `ubifs` - raw UBI filesystem image, normally used together with UBI partitions
+ - `vmdk` - virtual machine disk image
  - `ova` - Open Virtual Appliance: image for use on VirtualBox or VMware
  - `wsl` - tar file for Windows Subsystem for Linux
  - `squashfs` - raw squashfs filesystem image
diff --git a/meta/classes-recipe/imagetypes_vm.bbclass b/meta/classes-recipe/imagetypes_vm.bbclass
index fd4e97ed..b1be5605 100644
--- a/meta/classes-recipe/imagetypes_vm.bbclass
+++ b/meta/classes-recipe/imagetypes_vm.bbclass
@@ -8,9 +8,13 @@ FILESEXTRAPATHS:prepend = "${LAYERDIR_core}/recipes-core/images:"
 OVF_TEMPLATE_FILE ?= "virtualbox/vm-img-virtualbox.ovf.tmpl"
 IMAGE_SRC_URI:ova = "file://${OVF_TEMPLATE_FILE}"
 
-IMAGE_TYPEDEP:ova = "wic"
+IMAGE_TYPEDEP:ova = "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', 'vmdk', 'wic', d)}"
 IMAGER_INSTALL:ova += "qemu-utils gawk uuid-runtime"
 
+IMAGE_TYPEDEP:vmdk = "wic"
+IMAGER_INSTALL:vmdk += "qemu-utils"
+IMAGE_CMD:vmdk = "${convert_wic}"
+
 # virtual machine disk settings
 SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
 
@@ -19,7 +23,9 @@ SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
 VMDK_SUBFORMAT ?= "monolithicSparse"
 
 VIRTUAL_MACHINE_IMAGE_TYPE ?= "vmdk"
-VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}-disk001.${VIRTUAL_MACHINE_IMAGE_TYPE}"
+VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', '-disk001', d)}.${VIRTUAL_MACHINE_IMAGE_TYPE}"
+VIRTUAL_MACHINE_IMAGE_TYPE:vmdk = "vmdk"
+VIRTUAL_MACHINE_IMAGE_FILE:vmdk = "${IMAGE_FULLNAME}.vmdk"
 VIRTUAL_MACHINE_DISK = "${PP_DEPLOY}/${VIRTUAL_MACHINE_IMAGE_FILE}"
 
 def set_convert_options(d):
@@ -66,7 +72,7 @@ OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
 IMAGE_TEMPLATE_FILES:ova = "${OVF_TEMPLATE_FILE}"
 IMAGE_TEMPLATE_VARS:ova = "${OVA_VARS}"
 
-do_image_ova[prefuncs] += "convert_wic"
+do_image_ova[prefuncs] += "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', 'convert_wic', d)}"
 IMAGE_CMD:ova() {
     if [ ! ${VIRTUAL_MACHINE_IMAGE_TYPE} = "vmdk" ]; then
         exit 0
@@ -96,7 +102,9 @@ IMAGE_CMD:ova() {
         tar -uvf ${PP_DEPLOY}/${IMAGE_FULLNAME}.ova -C ${PP_DEPLOY} ${VIRTUAL_MACHINE_IMAGE_FILE}
         rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.mf'
         rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.ovf'
-        rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
+        if [ "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '1', '0', d)}" = "0" ]; then
+            rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
+        fi
 EOIMAGER
 }
 IMAGE_CMD:ova[depends] = "${PN}:do_transform_template"
-- 
2.56.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261030115757.25391-1-clara.kowalsky%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] imagetypes_vm: add support for standalone VMDK images
  2026-10-30 11:57 [PATCH] imagetypes_vm: add support for standalone VMDK images 'Clara Kowalsky' via isar-users
@ 2026-10-30 12:27 ` 'Moessbauer, Felix' via isar-users
  2026-11-03 12:29   ` 'Clara Kowalsky' via isar-users
  0 siblings, 1 reply; 3+ messages in thread
From: 'Moessbauer, Felix' via isar-users @ 2026-10-30 12:27 UTC (permalink / raw)
  To: Kowalsky, Clara, isar-users

On Fri, 2026-10-30 at 12:57 +0100, 'Clara Kowalsky' via isar-users
wrote:
> Commit 48c1aee5e797 ("imagetypes_vm: clean up intermediate ova
> artifacts") removes the VMDK after assembling the OVA. Some use cases
> require only a VMDK, both VMDK and OVA, or only OVA.
> 
> With this change, it is possible to set:
> - IMAGE_FSTYPES = "vmdk" to generate the VMDK without OVA packaging
> - IMAGE_FSTYPES = "vmdk ova.zst" to generate both. In that case, OVA
>   depends on the VMDK task and reuses its output without converting the
>   disk again
> - IMAGE_FSTYPES = "ova.zst" to build just the OVA and clean up the
>   intermediate artifacts
> 
> Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
> ---
>  doc/user_manual.md                        |  1 +
>  meta/classes-recipe/imagetypes_vm.bbclass | 16 ++++++++++++----
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index 09ac080b..199eb931 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -540,6 +540,7 @@ Currently, the following image types are provided:
>   - `wic` - full disk image with user-specified partitions created and populated using the wic tool
>   - `ubi` - image for use on mtd nand partitions employing UBI
>   - `ubifs` - raw UBI filesystem image, normally used together with UBI partitions
> + - `vmdk` - virtual machine disk image
>   - `ova` - Open Virtual Appliance: image for use on VirtualBox or VMware
>   - `wsl` - tar file for Windows Subsystem for Linux
>   - `squashfs` - raw squashfs filesystem image
> diff --git a/meta/classes-recipe/imagetypes_vm.bbclass b/meta/classes-recipe/imagetypes_vm.bbclass
> index fd4e97ed..b1be5605 100644
> --- a/meta/classes-recipe/imagetypes_vm.bbclass
> +++ b/meta/classes-recipe/imagetypes_vm.bbclass
> @@ -8,9 +8,13 @@ FILESEXTRAPATHS:prepend = "${LAYERDIR_core}/recipes-core/images:"
>  OVF_TEMPLATE_FILE ?= "virtualbox/vm-img-virtualbox.ovf.tmpl"
>  IMAGE_SRC_URI:ova = "file://${OVF_TEMPLATE_FILE}"
>  
> -IMAGE_TYPEDEP:ova = "wic"
> +IMAGE_TYPEDEP:ova = "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', 'vmdk', 'wic', d)}"

This manually models the imagetypes logic. Can't we just make the vmdk
a proper imagetype and let the internal logic defer what is removed and
what is kept?

The current implementation interferes with that.

Felix

>  IMAGER_INSTALL:ova += "qemu-utils gawk uuid-runtime"
>  
> +IMAGE_TYPEDEP:vmdk = "wic"
> +IMAGER_INSTALL:vmdk += "qemu-utils"
> +IMAGE_CMD:vmdk = "${convert_wic}"
> +
>  # virtual machine disk settings
>  SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
>  
> @@ -19,7 +23,9 @@ SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
>  VMDK_SUBFORMAT ?= "monolithicSparse"
>  
>  VIRTUAL_MACHINE_IMAGE_TYPE ?= "vmdk"
> -VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}-disk001.${VIRTUAL_MACHINE_IMAGE_TYPE}"
> +VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', '-disk001', d)}.${VIRTUAL_MACHINE_IMAGE_TYPE}"
> +VIRTUAL_MACHINE_IMAGE_TYPE:vmdk = "vmdk"
> +VIRTUAL_MACHINE_IMAGE_FILE:vmdk = "${IMAGE_FULLNAME}.vmdk"
>  VIRTUAL_MACHINE_DISK = "${PP_DEPLOY}/${VIRTUAL_MACHINE_IMAGE_FILE}"
>  
>  def set_convert_options(d):
> @@ -66,7 +72,7 @@ OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
>  IMAGE_TEMPLATE_FILES:ova = "${OVF_TEMPLATE_FILE}"
>  IMAGE_TEMPLATE_VARS:ova = "${OVA_VARS}"
>  
> -do_image_ova[prefuncs] += "convert_wic"
> +do_image_ova[prefuncs] += "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', 'convert_wic', d)}"
>  IMAGE_CMD:ova() {
>      if [ ! ${VIRTUAL_MACHINE_IMAGE_TYPE} = "vmdk" ]; then
>          exit 0
> @@ -96,7 +102,9 @@ IMAGE_CMD:ova() {
>          tar -uvf ${PP_DEPLOY}/${IMAGE_FULLNAME}.ova -C ${PP_DEPLOY} ${VIRTUAL_MACHINE_IMAGE_FILE}
>          rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.mf'
>          rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.ovf'
> -        rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
> +        if [ "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '1', '0', d)}" = "0" ]; then
> +            rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
> +        fi
>  EOIMAGER
>  }
>  IMAGE_CMD:ova[depends] = "${PN}:do_transform_template"
> -- 
> 2.56.0
> 
> -- 
> You received this message because you are subscribed to the Google Groups "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261030115757.25391-1-clara.kowalsky%40siemens.com.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/ae9f0b02d436d8fcfe9d4ae80ecae7d39877dac6.camel%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] imagetypes_vm: add support for standalone VMDK images
  2026-10-30 12:27 ` 'Moessbauer, Felix' via isar-users
@ 2026-11-03 12:29   ` 'Clara Kowalsky' via isar-users
  0 siblings, 0 replies; 3+ messages in thread
From: 'Clara Kowalsky' via isar-users @ 2026-11-03 12:29 UTC (permalink / raw)
  To: Moessbauer, Felix (FT RPD CPC OES-DE), isar-users



On 10/30/26 13:27, Moessbauer, Felix (FT RPD CPC OES-DE) wrote:
> On Fri, 2026-10-30 at 12:57 +0100, 'Clara Kowalsky' via isar-users
> wrote:
>> Commit 48c1aee5e797 ("imagetypes_vm: clean up intermediate ova
>> artifacts") removes the VMDK after assembling the OVA. Some use cases
>> require only a VMDK, both VMDK and OVA, or only OVA.
>>
>> With this change, it is possible to set:
>> - IMAGE_FSTYPES = "vmdk" to generate the VMDK without OVA packaging
>> - IMAGE_FSTYPES = "vmdk ova.zst" to generate both. In that case, OVA
>>    depends on the VMDK task and reuses its output without converting the
>>    disk again
>> - IMAGE_FSTYPES = "ova.zst" to build just the OVA and clean up the
>>    intermediate artifacts
>>
>> Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
>> ---
>>   doc/user_manual.md                        |  1 +
>>   meta/classes-recipe/imagetypes_vm.bbclass | 16 ++++++++++++----
>>   2 files changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/doc/user_manual.md b/doc/user_manual.md
>> index 09ac080b..199eb931 100644
>> --- a/doc/user_manual.md
>> +++ b/doc/user_manual.md
>> @@ -540,6 +540,7 @@ Currently, the following image types are provided:
>>    - `wic` - full disk image with user-specified partitions created and populated using the wic tool
>>    - `ubi` - image for use on mtd nand partitions employing UBI
>>    - `ubifs` - raw UBI filesystem image, normally used together with UBI partitions
>> + - `vmdk` - virtual machine disk image
>>    - `ova` - Open Virtual Appliance: image for use on VirtualBox or VMware
>>    - `wsl` - tar file for Windows Subsystem for Linux
>>    - `squashfs` - raw squashfs filesystem image
>> diff --git a/meta/classes-recipe/imagetypes_vm.bbclass b/meta/classes-recipe/imagetypes_vm.bbclass
>> index fd4e97ed..b1be5605 100644
>> --- a/meta/classes-recipe/imagetypes_vm.bbclass
>> +++ b/meta/classes-recipe/imagetypes_vm.bbclass
>> @@ -8,9 +8,13 @@ FILESEXTRAPATHS:prepend = "${LAYERDIR_core}/recipes-core/images:"
>>   OVF_TEMPLATE_FILE ?= "virtualbox/vm-img-virtualbox.ovf.tmpl"
>>   IMAGE_SRC_URI:ova = "file://${OVF_TEMPLATE_FILE}"
>>   
>> -IMAGE_TYPEDEP:ova = "wic"
>> +IMAGE_TYPEDEP:ova = "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', 'vmdk', 'wic', d)}"
> 
> This manually models the imagetypes logic. Can't we just make the vmdk
> a proper imagetype and let the internal logic defer what is removed and
> what is kept?
> 
> The current implementation interferes with that.
> 
> Felix

I'll send a v2 where intermediate image artifacts that have not been 
added to IMAGE_FSTYPES are deleted at the end of do_image, so only the 
wanted image types stay in the deploy dir and no special cleanup is 
needed here in imagetypes_vm.bbclass.
This specific line "+IMAGE_TYPEDEP:ova = 
"${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', 'vmdk', 'wic', d)}"" is 
needed as for vmdk, OVA depends on the vmdk task and reuses the disk. 
But for Hyper-V's vhdx, OVA keeps its dependency on wic to not build the 
wrong disk format.

Clara
> 
>>   IMAGER_INSTALL:ova += "qemu-utils gawk uuid-runtime"
>>   
>> +IMAGE_TYPEDEP:vmdk = "wic"
>> +IMAGER_INSTALL:vmdk += "qemu-utils"
>> +IMAGE_CMD:vmdk = "${convert_wic}"
>> +
>>   # virtual machine disk settings
>>   SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
>>   
>> @@ -19,7 +23,9 @@ SOURCE_IMAGE_FILE ?= "${IMAGE_FULLNAME}.wic"
>>   VMDK_SUBFORMAT ?= "monolithicSparse"
>>   
>>   VIRTUAL_MACHINE_IMAGE_TYPE ?= "vmdk"
>> -VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}-disk001.${VIRTUAL_MACHINE_IMAGE_TYPE}"
>> +VIRTUAL_MACHINE_IMAGE_FILE = "${IMAGE_FULLNAME}${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', '-disk001', d)}.${VIRTUAL_MACHINE_IMAGE_TYPE}"
>> +VIRTUAL_MACHINE_IMAGE_TYPE:vmdk = "vmdk"
>> +VIRTUAL_MACHINE_IMAGE_FILE:vmdk = "${IMAGE_FULLNAME}.vmdk"
>>   VIRTUAL_MACHINE_DISK = "${PP_DEPLOY}/${VIRTUAL_MACHINE_IMAGE_FILE}"
>>   
>>   def set_convert_options(d):
>> @@ -66,7 +72,7 @@ OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
>>   IMAGE_TEMPLATE_FILES:ova = "${OVF_TEMPLATE_FILE}"
>>   IMAGE_TEMPLATE_VARS:ova = "${OVA_VARS}"
>>   
>> -do_image_ova[prefuncs] += "convert_wic"
>> +do_image_ova[prefuncs] += "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '', 'convert_wic', d)}"
>>   IMAGE_CMD:ova() {
>>       if [ ! ${VIRTUAL_MACHINE_IMAGE_TYPE} = "vmdk" ]; then
>>           exit 0
>> @@ -96,7 +102,9 @@ IMAGE_CMD:ova() {
>>           tar -uvf ${PP_DEPLOY}/${IMAGE_FULLNAME}.ova -C ${PP_DEPLOY} ${VIRTUAL_MACHINE_IMAGE_FILE}
>>           rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.mf'
>>           rm -f '${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.ovf'
>> -        rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
>> +        if [ "${@bb.utils.contains('IMAGE_FSTYPES', 'vmdk', '1', '0', d)}" = "0" ]; then
>> +            rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
>> +        fi
>>   EOIMAGER
>>   }
>>   IMAGE_CMD:ova[depends] = "${PN}:do_transform_template"
>> -- 
>> 2.56.0
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups "isar-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
>> To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261030115757.25391-1-clara.kowalsky%40siemens.com.
> 

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/276070bc-a9ae-4c83-8da5-9fc2cef9323a%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 11:57 [PATCH] imagetypes_vm: add support for standalone VMDK images 'Clara Kowalsky' via isar-users
2026-10-30 12:27 ` 'Moessbauer, Felix' via isar-users
2026-11-03 12:29   ` 'Clara Kowalsky' via isar-users

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox