[virt-tools-list] [virt-manager] [PATCH] details: Fix showing the firmware type in case of firmware auto selection

Lin Ma lma at suse.com
Fri Jan 10 04:14:33 UTC 2020


For a shutoff VM, If user select uefi firmware auto selection, e.g.
<os firmware='efi'>
...
</os>

Its firmware information is set to 'BIOS' in details, This is incorrect.
This fixes it.

Signed-off-by: Lin Ma <lma at suse.com>
---
 virtManager/details/details.py | 7 +++++--
 virtinst/domain/os.py          | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index dc42e35f..8cdb4804 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -2027,8 +2027,11 @@ class vmmDetails(vmmGObjectUI):
 
         # Firmware
         domcaps = self.vm.get_domain_capabilities()
-        firmware = domcaps.label_for_firmware_path(
-            self.vm.get_xmlobj().os.loader)
+        if self.vm.get_xmlobj().os.is_uefi_auto_selection():
+            firmware = 'UEFI firmware auto selection'
+        else:
+            firmware = domcaps.label_for_firmware_path(
+                self.vm.get_xmlobj().os.loader)
         if self.widget("overview-firmware").is_visible():
             uiutil.set_list_selection(
                 self.widget("overview-firmware"), firmware)
diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index 59fbc43e..2b2e40b9 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -64,6 +64,9 @@ class DomainOs(XMLBuilder):
     def is_riscv_virt(self):
         return self.is_riscv() and str(self.machine).startswith("virt")
 
+    def is_uefi_auto_selection(self):
+        return self.firmware == "efi"
+
     XML_NAME = "os"
     _XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type",
                        "nvram", "nvram_template", "kernel", "initrd",
-- 
2.23.0





More information about the virt-tools-list mailing list