
2010/4/3 Chris Lalancette <clalance@redhat.com>:
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- daemon/remote.c | 311 ++++++++++++++++++++++++ daemon/remote_dispatch_args.h | 9 + daemon/remote_dispatch_prototypes.h | 72 ++++++ daemon/remote_dispatch_ret.h | 7 + daemon/remote_dispatch_table.h | 45 ++++ include/libvirt/libvirt.h.in | 62 +++++ include/libvirt/virterror.h | 5 +- python/generator.py | 3 + python/typewrappers.c | 15 ++ python/typewrappers.h | 10 + src/datatypes.c | 122 ++++++++++ src/datatypes.h | 25 ++ src/driver.h | 47 ++++ src/esx/esx_driver.c | 9 + src/libvirt.c | 456 +++++++++++++++++++++++++++++++++++ src/libvirt_private.syms | 1 + src/libvirt_public.syms | 10 + src/lxc/lxc_driver.c | 9 + src/opennebula/one_driver.c | 9 + src/openvz/openvz_driver.c | 9 + src/phyp/phyp_driver.c | 9 + src/qemu/qemu_driver.c | 9 + src/remote/remote_driver.c | 309 ++++++++++++++++++++++++ src/remote/remote_protocol.c | 181 ++++++++++++++ src/remote/remote_protocol.h | 145 +++++++++++ src/remote/remote_protocol.x | 97 ++++++++- src/test/test_driver.c | 9 + src/uml/uml_driver.c | 9 + src/util/virterror.c | 15 ++ src/vbox/vbox_tmpl.c | 9 + src/xen/xen_driver.c | 9 + src/xenapi/xenapi_driver.c | 9 + 32 files changed, 2044 insertions(+), 2 deletions(-)
+/* 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 */
s/Deactivate/Delete/
+typedef enum { + VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = (1 << 0), +} virDomainSnapshotDeleteFlags; + +int virDomainSnapshotDelete(virDomainSnapshotPtr snapshot, + unsigned int flags); + +int virDomainSnapshotFree(virDomainSnapshotPtr snapshot);
diff --git a/src/libvirt.c b/src/libvirt.c index 5247fe7..25e358c 100644 --- a/src/libvirt.c +++ b/src/libvirt.c
+ +/** + * virDomainSnapshotGetXMLDesc: + * @snapshot: a domain snapshot object + * @flags: unused flag parameters; callers should pass 0 + * + * Provide an XML description of the domain snapshot. + * + * Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. + * the caller must free() the returned value. + */ +char * +virDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, + unsigned int flags) +{ + virConnectPtr conn; + DEBUG("snapshot=%p, flags=%d", snapshot, flags); + + virResetLastError(); + + if (!VIR_IS_DOMAIN_SNAPSHOT(snapshot)) { + virLibDomainSnapshotError(NULL, VIR_ERR_INVALID_DOMAIN_SNAPSHOT, + __FUNCTION__); + virDispatchError(NULL); + return (NULL); + } + + conn = snapshot->domain->conn; + + if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) { + virLibConnError(conn, VIR_ERR_OPERATION_DENIED, + _("virDomainSnapshotGetXMLDesc with secure flag")); + goto error; + } + + flags &= VIR_DOMAIN_XML_FLAGS_MASK;
Copy&paste leftover?
+ if (conn->driver->domainSnapshotDumpXML) { + char *ret; + ret = conn->driver->domainSnapshotDumpXML(snapshot, flags); + if (!ret) + goto error; + return ret; + } + + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); +error: + virDispatchError(conn); + return NULL; +} +
+ +/** + * virDomainSnapshotDelete + * @snapshot: a domain snapshot object + * @flags: flag parameters + * + * Delete the snapshot. + * + * If @flags is 0, then just this snapshot is deleted, and changes from + * this snapshot are automatically pushed to children snapshots. If + * flags is VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, then this snapshot + * and any children snapshots are deleted.
s/pushed to/merged into/
+ * Returns 0 if the snapshot was successfully deleted, -1 on error. + */
ACK. Matthias