[gnome-boxes/drop-system-importer: 2/4] vm-importer: Don't copy the VM storage automatically



commit a5a1c605ce52de2683b0541dcb9f36844d7a4ddb
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Apr 24 17:12:27 2019 +0200

    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     | 26 ++------------------------
 2 files changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 5defe08c..6a4d8a69 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..7083faad 100644
--- a/src/vm-importer.vala
+++ b/src/vm-importer.vala
@@ -20,41 +20,19 @@ 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);
-    }
-
-    private async void import_vm (LibvirtMachine machine) {
-        try {
-            var destination_path = machine.storage_volume.get_path ();
-
-            yield source_media.copy (destination_path);
 
-            // Without refreshing the pool, libvirt will not know of changes to volume we just made
-            yield Boxes.ensure_storage_pool (connection);
-        } catch (GLib.Error error) {
-            warning ("Failed to import box '%s' from file '%s': %s",
-                     machine.name,
-                     source_media.device_file,
-                     error.message);
-            var ui_message = _("Box import from file ā€œ%sā€ failed.").printf (source_media.device_file);
-            App.app.main_window.notificationbar.display_error (ui_message);
-            machine.delete ();
-
-            return;
-        }
-
-        yield post_import_setup (machine);
         if (start_after_import) {
             try {
                 machine.domain.start (0);


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