[gnome-boxes/fix-clones-of-q35-machines: 2/2] vm-importer, creator: Copy VMs disk while cloning



commit 22d2904142ee0650973fa30e7390f49d4c47a279
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Mar 4 13:37:56 2020 +0100

    vm-importer, creator: Copy VMs disk while cloning
    
    This is a regression introduced by 2e2ba88ed.

 src/libvirt-machine.vala |  2 +-
 src/vm-creator.vala      |  2 +-
 src/vm-importer.vala     | 10 ++++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index d9d27e96..8fe653ff 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -749,7 +749,7 @@ public override async void clone () {
 
             var vm_cloner = media.get_vm_creator ();
             var clone_machine = yield vm_cloner.create_vm (null);
-            vm_cloner.launch_vm (clone_machine, this.config.access_last_time);
+            vm_cloner.launch_vm (clone_machine, this.config.access_last_time, true);
 
             ulong under_construct_id = 0;
             under_construct_id = clone_machine.notify["under-construction"].connect (() => {
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 1f1967de..f3a6b461 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -63,7 +63,7 @@ public async LibvirtMachine create_vm (Cancellable? cancellable) throws GLib.Err
         return machine;
     }
 
-    public virtual void launch_vm (LibvirtMachine machine, int64 access_last_time = -1) throws GLib.Error {
+    public virtual void launch_vm (LibvirtMachine machine, int64 access_last_time = -1, bool clone = false) 
throws GLib.Error {
         if (!express_install) {
             ulong signal_id = 0;
 
diff --git a/src/vm-importer.vala b/src/vm-importer.vala
index 8f1c2d57..5a25f9d0 100644
--- a/src/vm-importer.vala
+++ b/src/vm-importer.vala
@@ -16,11 +16,15 @@ public VMImporter (InstalledMedia source_media) {
         base.for_install_completion (machine);
     }
 
-    public override void launch_vm (LibvirtMachine machine, int64 access_last_time = -1) throws GLib.Error {
+    public override void launch_vm (LibvirtMachine machine, int64 access_last_time = -1, bool clone = false) 
throws GLib.Error {
         machine.vm_creator = this;
         machine.config.access_last_time = (access_last_time > 0)? access_last_time : get_real_time ();
 
-        post_import_setup.begin (machine);
+        if (clone) {
+            import_vm (machine);
+        } else {
+            post_import_setup.begin (machine);
+        }
     }
 
     protected override async void continue_installation (LibvirtMachine machine) {
@@ -62,5 +66,7 @@ private async void import_vm (LibvirtMachine machine) {
 
             return;
         }
+
+        yield post_import_setup (machine);
     }
 }


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