On Fri, Apr 02, 2010 at 09:45:56PM -0400, Chris Lalancette wrote:
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
[...]
diff --git a/include/libvirt/libvirt.h.in
b/include/libvirt/libvirt.h.in
index 7cb483e..a9f434b 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1374,6 +1374,7 @@ typedef enum {
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0, /* Normal startup from boot */
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */
+ VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3, /* Restored from snapshot */
} virDomainEventStartedDetailType;
/**
@@ -1410,6 +1411,7 @@ typedef enum {
VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3, /* Migrated off to another host */
VIR_DOMAIN_EVENT_STOPPED_SAVED = 4, /* Saved to a state file */
VIR_DOMAIN_EVENT_STOPPED_FAILED = 5, /* Host emulator/mgmt failed */
+ VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = 6, /* offline snapshot loaded */
} virDomainEventStoppedDetailType;
@@ -1861,6 +1863,66 @@ int virDomainGetJobInfo(virDomainPtr dom,
virDomainJobInfoPtr info);
int virDomainAbortJob(virDomainPtr dom);
+/**
+ * virDomainSnapshot:
+ *
+ * a virDomainSnapshot is a private structure representing a snapshot of
+ * a domain.
+ */
+typedef struct _virDomainSnapshot virDomainSnapshot;
+
+/**
+ * virDomainSnapshotPtr:
+ *
+ * a virDomainSnapshotPtr is pointer to a virDomainSnapshot private structure,
+ * and is the type used to reference a domain snapshot in the API.
+ */
+typedef virDomainSnapshot *virDomainSnapshotPtr;
+
+/* Take a snapshot of the current VM state */
+virDomainSnapshotPtr virDomainSnapshotCreateXML(virDomainPtr domain,
+ const char *xmlDesc,
+ unsigned int flags);
+
+/* Dump the XML of a snapshot */
+char *virDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
+ unsigned int flags);
+
+/* Return the number of snapshots for this domain */
+int virDomainSnapshotNum(virDomainPtr domain, unsigned int flags);
+
+/* Get the names of all snapshots for this domain */
+int virDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
+ unsigned int flags);
+
+/* Get a handle to a named snapshot */
+virDomainSnapshotPtr virDomainSnapshotLookupByName(virDomainPtr domain,
+ const char *name,
+ unsigned int flags);
+
+/* Check whether a domain has a snapshot which is currently used */
+int virDomainHasCurrentSnapshot(virDomainPtr domain, unsigned flags);
+
+/* Get a handle to the current snapshot */
+virDomainSnapshotPtr virDomainSnapshotCurrent(virDomainPtr domain,
+ unsigned int flags);
+
+/* Revert the domain to a point-in-time snapshot. The
+ * state of the guest after this call will be the state
+ * of the guest when the snapshot in question was taken
+ */
+int virDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
+ unsigned int flags);
+
+/* Deactivate a snapshot */
+typedef enum {
+ VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = (1 << 0),
+} virDomainSnapshotDeleteFlags;
+
+int virDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
+ unsigned int flags);
+
+int virDomainSnapshotFree(virDomainSnapshotPtr snapshot);
/* A generic callback definition. Specific events usually have a customization
* with extra parameters */
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index f69d07e..3bbb293 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -71,7 +71,8 @@ typedef enum {
VIR_FROM_CPU, /* Error from CPU driver */
VIR_FROM_XENAPI, /* Error from XenAPI */
VIR_FROM_NWFILTER, /* Error from network filter driver */
- VIR_FROM_HOOK /* Error from Synchronous hooks */
+ VIR_FROM_HOOK, /* Error from Synchronous hooks */
+ VIR_FROM_DOMAIN_SNAPSHOT, /* Error from domain snapshot */
} virErrorDomain;
@@ -183,6 +184,8 @@ typedef enum {
VIR_ERR_MIGRATE_PERSIST_FAILED, /* a migration worked, but making the
VM persist on the dest host failed */
VIR_ERR_HOOK_SCRIPT_FAILED, /* a synchronous hook script failed */
+ VIR_ERR_INVALID_DOMAIN_SNAPSHOT, /* invalid domain snapshot */
+ VIR_ERR_NO_DOMAIN_SNAPSHOT, /* domain snapshot not found */
} virErrorNumber;
API looks fine !
diff --git a/python/generator.py b/python/generator.py
index a24e122..cb9f3d9 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -241,6 +241,8 @@ py_types = {
'const virStreamPtr': ('O', "virStream",
"virStreamPtr", "virStreamPtr"),
'virStream *': ('O', "virStream",
"virStreamPtr", "virStreamPtr"),
'const virStream *': ('O', "virStream",
"virStreamPtr", "virStreamPtr"),
+
+ 'virDomainSnapshotPtr': ('O', "virDomainSnapshot",
"virDomainSnapshotPtr", "virDomainSnapshotPtr"),
}
py_return_types = {
@@ -317,6 +319,7 @@ skip_impl = (
'virNodeListDevices',
'virNodeDeviceListCaps',
'virConnectBaselineCPU',
+ 'virDomainSnapshotListNames',
)
with python bindings, great !
[...]
diff --git a/src/libvirt.c b/src/libvirt.c
index 5247fe7..25e358c 100644
libvirt.c looks fine
ACK
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/