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




commit dbb85f24caeab0b0c52211ef3cd77a3e1a413974
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 a193d9b8..52831bd8 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -246,12 +246,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]