[PATCH 2/3] vmx: write firmware back from autoselection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Pino Toscano <ptoscano@xxxxxxxxxx>
---
 src/vmx/vmx.c                              |  4 ++++
 tests/xml2vmxdata/xml2vmx-firmware-efi.vmx | 11 +++++++++++
 tests/xml2vmxdata/xml2vmx-firmware-efi.xml |  8 ++++++++
 tests/xml2vmxtest.c                        |  2 ++
 4 files changed, 25 insertions(+)
 create mode 100644 tests/xml2vmxdata/xml2vmx-firmware-efi.vmx
 create mode 100644 tests/xml2vmxdata/xml2vmx-firmware-efi.xml

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 3842991bab..f5d7bffb57 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3408,6 +3408,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
index 0000000000..cc3ec9f34b
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-firmware-efi.vmx
@@ -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
index 0000000000..b91735ab63
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-firmware-efi.xml
@@ -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>
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 0143c05b19..5d5dc0a518 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -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);
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux