diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2012-06-28 01:46:48 +0300 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2012-07-04 05:46:32 +0300 |
commit | 4b3fd868654ea7ad65895a85bd99dff59a4623d3 (patch) | |
tree | 359ee7688514b24842c498fc68436308e7ac6363 | |
parent | 16177fbc6bc14c0b83a1dac4f5f04260c87ef0df (diff) |
vm-creator: Tag installed status only after installation
While rest of the configuration really should be set after launch of
domain, we should not tag the domain as 'installed' before installation
is actually finished.
This fixes the regression of live domains not getting automatically
deleted.
https://bugzilla.gnome.org/show_bug.cgi?id=678894
-rw-r--r-- | src/vm-configurator.vala | 9 | ||||
-rw-r--r-- | src/vm-creator.vala | 12 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala index abba7c7..aa1f179 100644 --- a/src/vm-configurator.vala +++ b/src/vm-configurator.vala @@ -102,9 +102,6 @@ private class Boxes.VMConfigurator { } public static void post_install_setup (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 */ } set_post_install_os_config (domain); domain.set_lifecycle (DomainLifecycleEvent.ON_REBOOT, DomainLifecycleAction.RESTART); @@ -125,6 +122,12 @@ 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 */ } + } + public static bool is_install_config (Domain domain) { return get_os_state (domain) == INSTALLATION_STATE; } diff --git a/src/vm-creator.vala b/src/vm-creator.vala index 300ed16..0376b31 100644 --- a/src/vm-creator.vala +++ b/src/vm-creator.vala @@ -95,6 +95,7 @@ private class Boxes.VMCreator { var volume = get_storage_volume (connection, domain, null); if (guest_installed_os (volume)) { + mark_as_installed (domain); try { domain.start (0); } catch (GLib.Error error) { @@ -129,6 +130,17 @@ private class Boxes.VMCreator { } } + private void mark_as_installed (Domain domain) { + debug ("Marking '%s' as installed.", domain.get_name ()); + try { + var config = domain.get_config (0); + VMConfigurator.mark_as_installed (config); + domain.set_config (config); + } catch (GLib.Error error) { + warning ("Failed to marking domain '%s' as installed: %s", domain.get_uuid (), error.message); + } + } + private bool guest_installed_os (StorageVol volume) { try { var info = volume.get_info (); |