stages/org.osbuild.qemu: make qcow2 compression optional

Modify the stages/org.osbuild.qemu stage such that compression is
optional. This resolves the image size differences between an image
built with coreos assember vs osbuild, as discussed in:
https://github.com/coreos/fedora-coreos-tracker/issues/1653#issuecomment-1928342241
This commit is contained in:
Luke Yang 2024-02-06 13:54:15 -05:00 committed by Luke Yang
parent e1cbf92673
commit 619a64f0bd
3 changed files with 23 additions and 2 deletions

View file

@ -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

View file

@ -1267,6 +1267,7 @@
"filename": "qemu.qcow2",
"format": {
"type": "qcow2",
"compression": false,
"compat": "1.1"
}
}

View file

@ -604,4 +604,5 @@ pipelines:
filename: qemu.qcow2
format:
type: qcow2
compression: false
compat: '1.1'