]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vmx: write firmware back from autoselection
authorPino Toscano <ptoscano@redhat.com>
Tue, 9 Apr 2019 14:04:32 +0000 (16:04 +0200)
committerCole Robinson <crobinso@redhat.com>
Tue, 16 Apr 2019 00:03:55 +0000 (20:03 -0400)
When writing the VMX file from the domain XML, write the firmware key
according to the firmware autoselection.  Though, at the moment only
'efi' is supported.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
src/vmx/vmx.c
tests/xml2vmxdata/xml2vmx-firmware-efi.vmx [new file with mode: 0644]
tests/xml2vmxdata/xml2vmx-firmware-efi.xml [new file with mode: 0644]
tests/xml2vmxtest.c

index 2d7e827d2dc1deddb552ed0e56d8c9c7bcfc3a11..77f457991091b12ed27d1fba8377637b27309f27 100644 (file)
@@ -3409,6 +3409,10 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
             goto cleanup;
     }
 
+    /* vmx:firmware */
+    if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI)
+        virBufferAddLit(&buffer, "firmware = \"efi\"\n");
+
     if (virtualHW_version >= 7) {
         if (hasSCSI) {
             virBufferAddLit(&buffer, "pciBridge0.present = \"true\"\n");
diff --git a/tests/xml2vmxdata/xml2vmx-firmware-efi.vmx b/tests/xml2vmxdata/xml2vmx-firmware-efi.vmx
new file mode 100644 (file)
index 0000000..cc3ec9f
--- /dev/null
@@ -0,0 +1,11 @@
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "firmware-efi"
+memsize = "4"
+numvcpus = "1"
+floppy0.present = "false"
+floppy1.present = "false"
+firmware = "efi"
diff --git a/tests/xml2vmxdata/xml2vmx-firmware-efi.xml b/tests/xml2vmxdata/xml2vmx-firmware-efi.xml
new file mode 100644 (file)
index 0000000..b91735a
--- /dev/null
@@ -0,0 +1,8 @@
+<domain type='vmware'>
+  <name>firmware-efi</name>
+  <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+  <memory unit='KiB'>4096</memory>
+  <os firmware='efi'>
+    <type>hvm</type>
+  </os>
+</domain>
index 0143c05b19ab9d5b9f1776a91144239f07b906e8..5d5dc0a5189a49114c37e7d77df906300997f23e 100644 (file)
@@ -295,6 +295,8 @@ mymain(void)
 
     DO_TEST("svga", "svga", 4);
 
+    DO_TEST("firmware-efi", "firmware-efi", 4);
+
     DO_TEST("datacenterpath", "datacenterpath", 4);
 
     virObjectUnref(caps);