From: Pino Toscano Date: Tue, 9 Apr 2019 14:04:31 +0000 (+0200) Subject: vmx: convert firmware config for autoselection X-Git-Tag: v5.3.0-rc1~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bb6e4e739fa900b41e0f1983747c68279a25dd9;p=thirdparty%2Flibvirt.git vmx: convert firmware config for autoselection Convert the firmware key to a type of autoselected firmware. Only the 'efi' firmware is allowed for now, in case the key is present. It seems VMware (at least ESXi) does not write the key in VMX files when setting BIOS as firmware. Reviewed-by: Cole Robinson Signed-off-by: Pino Toscano --- diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index cf2d4df945..2d7e827d2d 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1305,6 +1305,7 @@ virVMXParseConfig(virVMXContext *ctx, struct virVMXConfigScanResults results = { -1 }; long long coresPerSocket = 0; virCPUDefPtr cpu = NULL; + char *firmware = NULL; if (ctx->parseFileName == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -1827,6 +1828,21 @@ virVMXParseConfig(virVMXContext *ctx, def->namespaceData = nsdata; } + /* vmx:firmware */ + if (virVMXGetConfigString(conf, "firmware", &firmware, true) < 0) + goto cleanup; + + if (firmware != NULL) { + if (STREQ(firmware, "efi")) { + def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_EFI; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry 'firmware' has unknown value '%s'"), + firmware); + goto cleanup; + } + } + if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, xmlopt, NULL) < 0) goto cleanup; diff --git a/tests/vmx2xmldata/vmx2xml-firmware-efi.vmx b/tests/vmx2xmldata/vmx2xml-firmware-efi.vmx new file mode 100644 index 0000000000..dbb215a5db --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-firmware-efi.vmx @@ -0,0 +1,3 @@ +config.version = "8" +virtualHW.version = "13" +firmware = "efi" diff --git a/tests/vmx2xmldata/vmx2xml-firmware-efi.xml b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml new file mode 100644 index 0000000000..e21158cebf --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml @@ -0,0 +1,18 @@ + + 00000000-0000-0000-0000-000000000000 + 32768 + 32768 + 1 + + hvm + + + destroy + restart + destroy + + + + diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index b70e8191d1..d7d03f1753 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -285,6 +285,8 @@ mymain(void) DO_TEST("svga", "svga"); + DO_TEST("firmware-efi", "firmware-efi"); + ctx.datacenterPath = "folder1/folder2/datacenter1"; DO_TEST("datacenterpath", "datacenterpath");