[gnome-boxes] LibvirtMachineProperties: Add snapshot API



commit 8686cd2d4c1e14b2a4dec087d702009f70f3f500
Author: Timm Bäder <mail baedert org>
Date:   Wed Jul 30 12:56:15 2014 +0200

    LibvirtMachineProperties: Add snapshot API
    
    Add API to fetch, get and create snapshots which will be used in later
    commits.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710306

 src/libvirt-machine-properties.vala |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 8efba22..e241676 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -616,4 +616,22 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
             machine.storage_volume.resize (size, StorageVolResizeFlags.NONE);
         }
     }
+
+    public async void fetch_snapshots (GLib.Cancellable? cancellable) throws GLib.Error {
+        yield machine.domain.fetch_snapshots_async (GVir.DomainSnapshotListFlags.ALL, cancellable);
+    }
+
+    public List<GVir.DomainSnapshot>? get_snapshots () {
+        return machine.domain.get_snapshots ();
+    }
+
+    public async GVir.DomainSnapshot create_snapshot () throws GLib.Error {
+        var config = new GVirConfig.DomainSnapshot ();
+        var now = new GLib.DateTime.now_local ();
+        config.set_name (now.format ("%y-%m-%e-%H-%M-%S"));
+        config.set_description (now.format ("%x, %X"));
+
+        return yield machine.domain.create_snapshot_async (config, 0, null);
+    }
+
 }


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