mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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 <crobinso@redhat.com> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
parent
fc79e73836
commit
9bb6e4e739
@ -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;
|
||||
|
3
tests/vmx2xmldata/vmx2xml-firmware-efi.vmx
Normal file
3
tests/vmx2xmldata/vmx2xml-firmware-efi.vmx
Normal file
@ -0,0 +1,3 @@
|
||||
config.version = "8"
|
||||
virtualHW.version = "13"
|
||||
firmware = "efi"
|
18
tests/vmx2xmldata/vmx2xml-firmware-efi.xml
Normal file
18
tests/vmx2xmldata/vmx2xml-firmware-efi.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<domain type='vmware'>
|
||||
<uuid>00000000-0000-0000-0000-000000000000</uuid>
|
||||
<memory unit='KiB'>32768</memory>
|
||||
<currentMemory unit='KiB'>32768</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os firmware='efi'>
|
||||
<type arch='i686'>hvm</type>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<video>
|
||||
<model type='vmvga' vram='4096' primary='yes'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user