[gnome-boxes] vm-creator: Explicitly fetch inactive domain configuration



commit 7e8926c47f0b23f6c6f1197c1608184a1bfc5526
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Aug 10 16:07:08 2012 +0300

    vm-creator: Explicitly fetch inactive domain configuration
    
    We were modifying the inactive domain configuration after domain launch
    and later we were modifying it yet again after domain shutdown. Trouble
    is that libvirt sends shutdown event before the configuration update
    event so the 2nd time around, we were modifying the yet to be updated
    configuration and therefore trashing the first modification.
    
    This patch fixes the side effect of broken Fedora installation: Installer
    will keep on looping forever.
    
    Its still a mystery to me why this hasn't been a problem until recently.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681599

 src/vm-creator.vala |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 83a1227..7a12e39 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -118,12 +118,9 @@ private class Boxes.VMCreator {
     private void set_post_install_config (LibvirtMachine machine) {
         debug ("Setting post-installation configuration on '%s'", machine.name);
         try {
-            // We need to clone the domain_config as that is supposed to reflect the active config while we are
-            // modifying the inactive config, which are different when domain is running.
-            var config_xml = machine.domain_config.to_xml ();
-            var post_install_config = new GVirConfig.Domain.from_xml (config_xml);
-            VMConfigurator.post_install_setup (post_install_config);
-            machine.domain.set_config (post_install_config);
+            var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
+            VMConfigurator.post_install_setup (config);
+            machine.domain.set_config (config);
         } catch (GLib.Error error) {
             warning ("Failed to set post-install configuration on '%s' failed: %s", machine.name, error.message);
         }
@@ -133,8 +130,9 @@ private class Boxes.VMCreator {
                                                                       machine.state == Machine.MachineState.UNKNOWN) {
         debug ("Marking '%s' as installed.", machine.name);
         try {
-            VMConfigurator.mark_as_installed (machine.domain_config);
-            machine.domain.set_config (machine.domain_config);
+            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);
         }



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