[gnome-boxes/clone-q35-machines] installer-media, libvirt-media: Detect q35 installed medias



commit 87aad2701a4e7f37540edb40c60d0416f8ab7baa
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Feb 27 09:40:00 2020 +0100

    installer-media, libvirt-media: Detect q35 installed medias
    
    When installing a VM from an installer media (ISO), we have libosinfo
    detecting the OS and consequently the machine-type. For existing
    installed medias (qcow2 images) we were failing at detecting their
    machine-type and going with the fallback.
    
    Luckly the libvirt domain config contains that information, we just
    need to propagate it to our VM clonner.

 src/installer-media.vala | 2 +-
 src/libvirt-media.vala   | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index ef73668d..a857ed03 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -69,7 +69,7 @@
         }
     }
 
-    public bool prefers_q35 {
+    public virtual bool prefers_q35 {
         get {
             if (os == null)
                 return false;
diff --git a/src/libvirt-media.vala b/src/libvirt-media.vala
index 93157ed6..ba39e2c8 100644
--- a/src/libvirt-media.vala
+++ b/src/libvirt-media.vala
@@ -9,6 +9,12 @@
         }
     }
 
+    public override bool prefers_q35 {
+        get {
+            return domain_config.get_os ().get_machine ().contains ("q35");
+        }
+    }
+
     public Domain domain_config { get; private set; }
 
     public LibvirtMedia (string path, Domain domain_config, bool known_qcow2 = false) throws GLib.Error {


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