diff --git a/stages/org.osbuild.qemu b/stages/org.osbuild.qemu index 98a04f00..642b5146 100755 --- a/stages/org.osbuild.qemu +++ b/stages/org.osbuild.qemu @@ -31,6 +31,11 @@ SCHEMA_2 = r""" "type": "string", "enum": ["qcow2"] }, + "compression": { + "description": "Enable/disable compression of the qcow2 image", + "type": "boolean", + "default": true + }, "compat": { "description": "The qcow2-compatibility-version to use", "type": "string" @@ -61,6 +66,11 @@ SCHEMA_2 = r""" "type": "string", "enum": ["vmdk"] }, + "compression": { + "description": "Enable/disable compression of the vmdk image", + "type": "boolean", + "default": true + }, "subformat": { "description": "VMDK flat extent format", "type": "string", @@ -140,17 +150,26 @@ SCHEMA_2 = r""" def qcow2_arguments(options): - argv = ["-c"] + argv = [] + compression = options.get("compression", True) compat = options.get("compat") + if compression: + argv += ["-c"] + if compat: argv += ["-o", f"compat={compat}"] return argv def vmdk_arguments(options): - argv = ["-c"] + argv = [] + compression = options.get("compression", True) subformat = options.get("subformat") + + if compression: + argv += ["-c"] + if subformat: argv += ["-o", f"subformat={subformat}"] return argv diff --git a/test/data/manifests/fedora-coreos-container.json b/test/data/manifests/fedora-coreos-container.json index 18cf87da..551c3e22 100644 --- a/test/data/manifests/fedora-coreos-container.json +++ b/test/data/manifests/fedora-coreos-container.json @@ -1267,6 +1267,7 @@ "filename": "qemu.qcow2", "format": { "type": "qcow2", + "compression": false, "compat": "1.1" } } diff --git a/test/data/manifests/fedora-coreos-container.mpp.yaml b/test/data/manifests/fedora-coreos-container.mpp.yaml index 60ebe72f..a83bcd64 100644 --- a/test/data/manifests/fedora-coreos-container.mpp.yaml +++ b/test/data/manifests/fedora-coreos-container.mpp.yaml @@ -604,4 +604,5 @@ pipelines: filename: qemu.qcow2 format: type: qcow2 + compression: false compat: '1.1'