stages/ovf: virtualbox's ostype as option

Let the user of the stage set the os type for the virtualbox bits.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
Simon de Vlieger 2025-06-30 08:39:02 +02:00 committed by Simon de Vlieger
parent ce2bda719c
commit 1cb0f26b09
3 changed files with 14 additions and 3 deletions

View file

@ -157,7 +157,7 @@ def write_template(vmdk, options):
vmware_os_type=options.get("vmware", {}).get("os_type", "other26xLinux64Guest"),
vbox_machine_uuid=str(uuid.uuid4()),
vbox_disk_uuid=str(uuid.uuid4()),
vbox_os_type="ArchLinux_64",
vbox_os_type=options.get("virtualbox", {}).get("os_type", "OtherLinux_64"),
vbox_mac_address=vbox_mac_address(),
image_name=basename,
)
@ -187,7 +187,6 @@ def write_manifest(vmdk, ovf):
def main(options, tree):
vmdk = os.path.join(tree, options["vmdk"])
print(options)
ovf = write_template(vmdk, options)
write_manifest(vmdk, ovf)

View file

@ -29,6 +29,17 @@
"default": "other26xLinux64Guest"
}
}
},
"virtualbox": {
"description": "Settings for VirtualBox specific parts of the OVF file.",
"type": "object",
"additionalProperties": false,
"properties": {
"os_type": {
"type": "string",
"default": "OtherLinux_64"
}
}
}
}
}

View file

@ -41,7 +41,8 @@ def test_schema_validation_ovf(stage_schema, test_data, expected_err):
@pytest.mark.skipif(not testutil.has_executable("qemu-img"), reason="need qemu-img")
@pytest.mark.parametrize("test_opts, expected_substrings", [
# Replacements
({"vmware": {"os_type": "my-os-type"}}, ["my-os-type"],),
({"vmware": {"os_type": "my-vmware-os-type"}}, ["my-vmware-os-type"],),
({"virtualbox": {"os_type": "my-vbox-os-type"}}, ["my-vbox-os-type"],),
])
def test_ovf_default_template(tmp_path, stage_module, test_opts, expected_substrings):
faked_vmdk_path = tmp_path / "some-image.vmdk"