[gnome-boxes] vm-creator: Create snapshot on install completion



commit f4043000a1896b93f3c55eae1aba4dfda4ec055d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 23 20:50:36 2015 +0000

    vm-creator: Create snapshot on install completion
    
    After a VM is installed, automatically create a snapshot to serve as a
    reset mechanism.

 src/vm-creator.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index c1cfd7c..c9bf450 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -158,6 +158,7 @@ private class Boxes.VMCreator {
             App.app.notify_machine_installed (machine);
             machine.vm_creator = null;
             machine.schedule_autosave ();
+            try_create_snapshot.begin (machine);
         } else {
             if (VMConfigurator.is_live_config (machine.domain_config)) {
                 // No installation during live session, so lets delete the VM
@@ -182,6 +183,14 @@ private class Boxes.VMCreator {
         }
     }
 
+    private async void try_create_snapshot (LibvirtMachine machine) {
+        try {
+            yield machine.create_snapshot ("Just installed ");
+        } catch (GLib.Error error) {
+            warning ("Failed to create snapshot for domain '%s': %s", machine.name, error.message);
+        }
+    }
+
     protected void set_post_install_config (LibvirtMachine machine) {
         debug ("Setting post-installation configuration on '%s'", machine.name);
         try {


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