[gnome-boxes] vm-creator: Set post-install config after install



commit a4a6229070a274461b44a645320746959f3b1a83
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Oct 3 05:11:17 2012 +0300

    vm-creator: Set post-install config after install
    
    The main reason we have been setting post-installation configuration at
    first domain launch was the scenerio of first post-install reboot
    happening while Boxes is not runnnig: User launches the saved
    (in-installation) domain from another (libvirt-based) app.
    
    While this scenerio is still real, it is:
    
    a. a corner case.
    b. very hard to maintain *proper* support for if we want to be able to
       better track the installation. The next patch in this series is along
       that line and it requires this change.
    c. not complete broken by this patch: Boxes will just not know that
       installation is finished until another reboot/shutdown.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685346

 src/vm-configurator.vala |   13 ++++++++-----
 src/vm-creator.vala      |   19 ++-----------------
 2 files changed, 10 insertions(+), 22 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index a83a2c4..a231eeb 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -120,12 +120,8 @@ private class Boxes.VMConfigurator {
         }
 
         domain.set_devices (devices);
-    }
 
-    public static void mark_as_installed (Domain domain) {
-        try {
-            domain.set_custom_xml (INSTALLED_XML, BOXES_NS, BOXES_NS_URI);
-        } catch (GLib.Error error) { assert_not_reached (); /* We are so screwed if this happens */ }
+        mark_as_installed (domain);
     }
 
     public static bool is_install_config (Domain domain) {
@@ -170,6 +166,13 @@ private class Boxes.VMConfigurator {
         return pool;
     }
 
+
+    private static void mark_as_installed (Domain domain) {
+        try {
+            domain.set_custom_xml (INSTALLED_XML, BOXES_NS, BOXES_NS_URI);
+        } catch (GLib.Error error) { assert_not_reached (); /* We are so screwed if this happens */ }
+    }
+
     private static void set_cpu_config (Domain domain, Capabilities caps) {
         var topology = caps.get_host ().get_cpu ().get_topology ();
 
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 16fef2c..f7d8117 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -67,15 +67,12 @@ private class Boxes.VMCreator {
 
                 App.app.select_item (machine); // This also starts the domain for us
                 App.app.fullscreen = true;
-                set_post_install_config (machine);
                 App.app.disconnect (signal_id);
 
                 return;
             });
-        } else {
+        } else
             machine.domain.start (0);
-            set_post_install_config (machine);
-        }
 
         state_changed_id = machine.notify["state"].connect (on_machine_state_changed);
         machine.vm_creator = this;
@@ -110,7 +107,7 @@ private class Boxes.VMCreator {
         }
 
         if (guest_installed_os (machine.storage_volume)) {
-            mark_as_installed (machine);
+            set_post_install_config (machine);
             try {
                 domain.start (0);
             } catch (GLib.Error error) {
@@ -154,18 +151,6 @@ private class Boxes.VMCreator {
         }
     }
 
-    private void mark_as_installed (LibvirtMachine machine) requires (machine.state == Machine.MachineState.STOPPED ||
-                                                                      machine.state == Machine.MachineState.UNKNOWN) {
-        debug ("Marking '%s' as installed.", machine.name);
-        try {
-            var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
-            VMConfigurator.mark_as_installed (config);
-            machine.domain.set_config (config);
-        } catch (GLib.Error error) {
-            warning ("Failed to marking domain '%s' as installed: %s", machine.name, error.message);
-        }
-    }
-
     private bool guest_installed_os (StorageVol volume) {
         try {
             if (install_trackable ())



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