[gnome-boxes] vm-configurator: Add domain_caps_supports_efi()



commit c8e52108746489ac66294ad2ab281b2f1d1946b7
Author: Fabiano FidĂȘncio <fidencio redhat com>
Date:   Mon Aug 26 20:25:44 2019 +0300

    vm-configurator: Add domain_caps_supports_efi()
    
    Let's add a method to, given a DomainCapabilities, get whether UEFI
    firmware can be used on the host side.
    
    This information comes from libvirt.
    
    https://gitlab.gnome.org/GNOME/gnome-boxes/issues/199
    
    Signed-off-by: Fabiano FidĂȘncio <fidencio redhat com>

 src/vm-configurator.vala | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 48479f4d..1b36a757 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -372,6 +372,15 @@ private static void set_post_install_os_config (Domain domain) {
         domain.set_os (os);
     }
 
+    private static bool domain_caps_supports_efi (DomainCapabilities domain_caps) {
+        foreach (var firmware in domain_caps.get_os ().get_firmwares()) {
+            if (firmware == GVirConfig.DomainOsFirmware.EFI)
+                return true;
+        }
+
+        return false;
+    }
+
     private static void set_os_config (Domain domain, InstallerMedia install_media, CapabilitiesGuest 
guest_caps, DomainCapabilities domain_caps) {
         var os = new DomainOs ();
         os.set_os_type (DomainOsType.HVM);


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