[gnome-boxes/import-export-vms: 1/2] vm-importer: Don't copy the VM storage automatically



commit c8628c991f6b76c732301cad641f676154ed1416
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Nov 26 12:30:53 2019 +0100

    vm-importer: Don't copy the VM storage automatically
    
    Users want to connect to VMs wherever they are, instead of working
    in local copies of them. For those that want the old behavior, we
    will offer an option to "Import" the VM that will actually copy the
    storage backend.

 src/vm-configurator.vala |  3 +++
 src/vm-importer.vala     | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index f3ca1888..ef9b73f2 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -79,6 +79,9 @@ public static Domain create_domain_config (InstallerMedia install_media, string
         clock.add_timer (timer);
         domain.set_clock (clock);
 
+        if (install_media is InstalledMedia)
+            target_path = install_media.device_file;
+
         set_target_media_config (domain, target_path, install_media);
         install_media.setup_domain_config (domain);
 
diff --git a/src/vm-importer.vala b/src/vm-importer.vala
index b51d3a5b..1c3aed7d 100644
--- a/src/vm-importer.vala
+++ b/src/vm-importer.vala
@@ -20,18 +20,28 @@ public override void launch_vm (LibvirtMachine machine, int64 access_last_time =
         machine.vm_creator = this;
         machine.config.access_last_time = (access_last_time > 0)? access_last_time : get_real_time ();
 
-        import_vm.begin (machine);
+        post_import_setup.begin (machine);
     }
 
     protected override async void continue_installation (LibvirtMachine machine) {
         install_media = yield MediaManager.get_instance ().create_installer_media_from_config 
(machine.domain_config);
         machine.vm_creator = this;
 
-        yield import_vm (machine);
+        yield post_import_setup (machine);
     }
 
     protected virtual async void post_import_setup (LibvirtMachine machine) {
         set_post_install_config (machine);
+
+        if (start_after_import) {
+            try {
+                machine.domain.start (0);
+            } catch (GLib.Error error) {
+                warning ("Failed to start domain '%s': %s", machine.domain.get_name (), error.message);
+            }
+        }
+
+        machine.vm_creator = null;
     }
 
     private async void import_vm (LibvirtMachine machine) {
@@ -53,15 +63,5 @@ private async void import_vm (LibvirtMachine machine) {
 
             return;
         }
-
-        yield post_import_setup (machine);
-        if (start_after_import) {
-            try {
-                machine.domain.start (0);
-            } catch (GLib.Error error) {
-                warning ("Failed to start domain '%s': %s", machine.domain.get_name (), error.message);
-            }
-        }
-        machine.vm_creator = null;
     }
 }


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