Snapshot API framework.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
Chris Lalancette
2010-03-31 16:33:13 -04:00
parent 1bbe12de44
commit 2f992d4be4
32 changed files with 2042 additions and 2 deletions

View File

@@ -1384,6 +1384,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;
/**
@@ -1420,6 +1421,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;
@@ -1871,6 +1873,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);
/* Delete 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 */

View File

@@ -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;
/**