[gnome-boxes/gnome-41] vm-creator: Don't query for volume info for VMs without volume



commit c6a03f23e340ba7b252f610b9e64ea013bb26a39
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Dec 14 13:55:26 2021 +0100

    vm-creator: Don't query for volume info for VMs without volume
    
    Some VMs don't have a StorageVolume device. These could be live
    VMs or .qcow2 disks that have been imported into Boxes.
    
    Fixes #628

 src/vm-creator.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index b0407e97..a207774c 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -236,12 +236,14 @@ private bool guest_installed_os (LibvirtMachine machine) {
         try {
             if (install_media.os_media != null && VMConfigurator.is_install_config (machine.domain_config))
                 return (num_reboots == install_media.os_media.installer_reboots);
-            else {
+            else if (volume != null) {
                 var info = volume.get_info ();
 
                 // If guest has used 1 MiB of storage, we assume it installed an OS on the volume
                 return (info.allocation >= Osinfo.MEBIBYTES);
             }
+
+            return false;
         } catch (GLib.Error error) {
             warning ("Failed to get information from volume '%s': %s", volume.get_name (), error.message);
             return false;


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