2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/include/libvirt/libvirt.h.in
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/include/libvirt/libvirt.h.in
|
|
|
|
+++ libvirt-0.7.6/include/libvirt/libvirt.h.in
|
2010-01-08 01:37:05 +01:00
|
|
|
@@ -621,6 +621,21 @@ int virDomainRestore
|
2009-02-03 22:58:24 +01:00
|
|
|
const char *from);
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * Snapshots
|
|
|
|
+ */
|
|
|
|
+int virDomainSnapshotCreate (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+int virDomainSnapshotApply (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+int virDomainSnapshotDelete (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+int virDomainNumOfSnapshots (virDomainPtr domain);
|
|
|
|
+int virDomainListSnapshots (virDomainPtr domain,
|
|
|
|
+ char **const names,
|
|
|
|
+ int maxnames);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* Domain core dump
|
|
|
|
*/
|
|
|
|
int virDomainCoreDump (virDomainPtr domain,
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/libvirt.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/libvirt.c
|
|
|
|
+++ libvirt-0.7.6/src/libvirt.c
|
|
|
|
@@ -2379,6 +2379,166 @@ error:
|
2009-02-03 22:58:24 +01:00
|
|
|
}
|
|
|
|
|
2009-11-05 04:56:27 +01:00
|
|
|
/**
|
2009-02-03 22:58:24 +01:00
|
|
|
+ * virDomainSnapshotCreate:
|
|
|
|
+ * @domain: a domain object
|
|
|
|
+ * @name: name for the new snapshot
|
|
|
|
+ *
|
|
|
|
+ * Creates a snapshot from a running domain
|
|
|
|
+ *
|
|
|
|
+ * Returns 0 in case of success and -1 in case of failure.
|
|
|
|
+ */
|
|
|
|
+int
|
|
|
|
+virDomainSnapshotCreate(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ virConnectPtr conn;
|
|
|
|
+
|
|
|
|
+ DEBUG("domain=%p", domain);
|
|
|
|
+
|
|
|
|
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
|
|
|
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ conn = domain->conn;
|
|
|
|
+ if (conn->flags & VIR_CONNECT_RO) {
|
|
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (conn->driver->domainSnapshotCreate)
|
|
|
|
+ return conn->driver->domainSnapshotCreate(domain, name);
|
|
|
|
+
|
|
|
|
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * virDomainSnapshotApply:
|
|
|
|
+ * @domain: a domain object
|
|
|
|
+ * @name: name of the snapshot to apply
|
|
|
|
+ *
|
|
|
|
+ * Starts a domain using a given snapshot. The domain needs to be shut down
|
|
|
|
+ * before calling thsi function.
|
|
|
|
+ *
|
|
|
|
+ * Returns 0 in case of success and -1 in case of failure.
|
|
|
|
+ */
|
|
|
|
+int
|
|
|
|
+virDomainSnapshotApply(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ virConnectPtr conn;
|
|
|
|
+
|
|
|
|
+ DEBUG("domain=%p", domain);
|
|
|
|
+
|
|
|
|
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
|
|
|
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ conn = domain->conn;
|
|
|
|
+ if (conn->flags & VIR_CONNECT_RO) {
|
|
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (conn->driver->domainSnapshotApply)
|
|
|
|
+ return conn->driver->domainSnapshotApply(domain, name);
|
|
|
|
+
|
|
|
|
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * virDomainSnapshotDelete:
|
|
|
|
+ * @domain: a domain object
|
|
|
|
+ * @name: name of the snapshot to delete
|
|
|
|
+ *
|
|
|
|
+ * Deletes a snapshot from the given domain
|
|
|
|
+ *
|
|
|
|
+ * Returns 0 in case of success and -1 in case of failure.
|
|
|
|
+ */
|
|
|
|
+int
|
|
|
|
+virDomainSnapshotDelete(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ virConnectPtr conn;
|
|
|
|
+
|
|
|
|
+ DEBUG("domain=%p", domain);
|
|
|
|
+
|
|
|
|
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
|
|
|
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ conn = domain->conn;
|
|
|
|
+ if (conn->flags & VIR_CONNECT_RO) {
|
|
|
|
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (conn->driver->domainSnapshotDelete)
|
|
|
|
+ return conn->driver->domainSnapshotDelete(domain, name);
|
|
|
|
+
|
|
|
|
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * virDomainNumOfSnapshots:
|
|
|
|
+ * @domain: a domain object
|
|
|
|
+ *
|
|
|
|
+ * Returns the number of snapshots of the given domain or -1 in case of failure
|
|
|
|
+ */
|
|
|
|
+int
|
|
|
|
+virDomainNumOfSnapshots(virDomainPtr domain)
|
|
|
|
+{
|
|
|
|
+ virConnectPtr conn;
|
|
|
|
+
|
|
|
|
+ DEBUG("domain=%p", domain);
|
|
|
|
+
|
|
|
|
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
|
|
|
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ conn = domain->conn;
|
|
|
|
+ if (conn->driver->domainNumOfSnapshots)
|
|
|
|
+ return conn->driver->domainNumOfSnapshots(domain);
|
|
|
|
+
|
|
|
|
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * virDomainListSnapshots:
|
|
|
|
+ * @domain: a domain object
|
|
|
|
+ * @names: pointer to an array to store the snapshot names
|
|
|
|
+ * @maxnames: size of the array
|
|
|
|
+ *
|
|
|
|
+ * List the names of all snapshots of the given domain. The names are
|
|
|
|
+ * stored in the @names array. Unused array entries are set to NULL.
|
|
|
|
+ *
|
|
|
|
+ * Returns 0 in case of success and -1 in case of failure.
|
|
|
|
+ */
|
|
|
|
+int
|
|
|
|
+virDomainListSnapshots(virDomainPtr domain, char **const names, int maxnames)
|
|
|
|
+{
|
|
|
|
+ virConnectPtr conn;
|
|
|
|
+
|
|
|
|
+ DEBUG("domain=%p", domain);
|
|
|
|
+
|
|
|
|
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
|
|
|
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ conn = domain->conn;
|
|
|
|
+ if (conn->driver->domainListSnapshots)
|
|
|
|
+ return conn->driver->domainListSnapshots(domain, names, maxnames);
|
|
|
|
+
|
|
|
|
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
2009-11-05 04:56:27 +01:00
|
|
|
+/**
|
2009-02-03 22:58:24 +01:00
|
|
|
* virDomainCoreDump:
|
|
|
|
* @domain: a domain object
|
2009-11-05 04:56:27 +01:00
|
|
|
* @to: path for the core file
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/driver.h
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/driver.h
|
|
|
|
+++ libvirt-0.7.6/src/driver.h
|
2009-12-11 16:19:30 +01:00
|
|
|
@@ -136,6 +136,21 @@ typedef int
|
2009-02-03 22:58:24 +01:00
|
|
|
(*virDrvDomainRestore) (virConnectPtr conn,
|
|
|
|
const char *from);
|
|
|
|
typedef int
|
|
|
|
+ (*virDrvDomainSnapshotCreate) (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+typedef int
|
|
|
|
+ (*virDrvDomainSnapshotApply) (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+typedef int
|
|
|
|
+ (*virDrvDomainSnapshotDelete) (virDomainPtr domain,
|
|
|
|
+ const char* name);
|
|
|
|
+typedef int
|
|
|
|
+ (*virDrvDomainNumOfSnapshots) (virDomainPtr domain);
|
|
|
|
+typedef int
|
|
|
|
+ (*virDrvDomainListSnapshots) (virDomainPtr domain,
|
|
|
|
+ char **const names,
|
|
|
|
+ int maxnames);
|
|
|
|
+typedef int
|
|
|
|
(*virDrvDomainCoreDump) (virDomainPtr domain,
|
|
|
|
const char *to,
|
|
|
|
int flags);
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -458,6 +473,11 @@ struct _virDriver {
|
2009-12-11 16:19:30 +01:00
|
|
|
virDrvDomainIsActive domainIsActive;
|
|
|
|
virDrvDomainIsPersistent domainIsPersistent;
|
2010-01-08 01:37:05 +01:00
|
|
|
virDrvCPUCompare cpuCompare;
|
2009-02-03 22:58:24 +01:00
|
|
|
+ virDrvDomainSnapshotCreate domainSnapshotCreate;
|
2009-04-24 23:15:55 +02:00
|
|
|
+ virDrvDomainSnapshotApply domainSnapshotApply;
|
2009-02-03 22:58:24 +01:00
|
|
|
+ virDrvDomainSnapshotDelete domainSnapshotDelete;
|
|
|
|
+ virDrvDomainNumOfSnapshots domainNumOfSnapshots;
|
2009-04-24 23:15:55 +02:00
|
|
|
+ virDrvDomainListSnapshots domainListSnapshots;
|
2009-02-03 22:58:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef int
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xen_driver.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xen_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xen_driver.c
|
2009-12-11 16:19:30 +01:00
|
|
|
@@ -1052,6 +1052,81 @@ xenUnifiedDomainRestore (virConnectPtr c
|
2009-02-03 22:58:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
+xenUnifiedDomainSnapshotCreate(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ GET_PRIVATE(domain->conn);
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
|
|
+ if (priv->opened[i] &&
|
|
|
|
+ drivers[i]->domainSnapshotCreate &&
|
|
|
|
+ drivers[i]->domainSnapshotCreate(domain, name) == 0)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenUnifiedDomainSnapshotApply(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ GET_PRIVATE(domain->conn);
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
|
|
+ if (priv->opened[i] &&
|
|
|
|
+ drivers[i]->domainSnapshotApply &&
|
|
|
|
+ drivers[i]->domainSnapshotApply(domain, name) == 0)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenUnifiedDomainSnapshotDelete(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ GET_PRIVATE(domain->conn);
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
|
|
+ if (priv->opened[i] &&
|
|
|
|
+ drivers[i]->domainSnapshotDelete &&
|
|
|
|
+ drivers[i]->domainSnapshotDelete(domain, name) == 0)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenUnifiedDomainNumOfSnapshots(virDomainPtr domain)
|
|
|
|
+{
|
|
|
|
+ GET_PRIVATE(domain->conn);
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
|
|
+ if (priv->opened[i] &&
|
|
|
|
+ drivers[i]->domainNumOfSnapshots)
|
|
|
|
+ return drivers[i]->domainNumOfSnapshots(domain);
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenUnifiedDomainListSnapshots(virDomainPtr domain, char **const names,
|
|
|
|
+ int maxnames)
|
|
|
|
+{
|
|
|
|
+ GET_PRIVATE(domain->conn);
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
|
|
+ if (priv->opened[i] &&
|
|
|
|
+ drivers[i]->domainListSnapshots &&
|
|
|
|
+ drivers[i]->domainListSnapshots(domain, names, maxnames) == 0)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
|
|
|
|
{
|
|
|
|
GET_PRIVATE(dom->conn);
|
2010-02-04 21:17:25 +01:00
|
|
|
@@ -1904,6 +1979,11 @@ static virDriver xenUnifiedDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
xenUnifiedDomainIsActive,
|
|
|
|
xenUnifiedDomainisPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
|
|
|
+ xenUnifiedDomainSnapshotCreate, /* domainSnapshotCreate */
|
|
|
|
+ xenUnifiedDomainSnapshotApply, /* domainSnapshotApply */
|
|
|
|
+ xenUnifiedDomainSnapshotDelete, /* domainSnapshotDelete */
|
|
|
|
+ xenUnifiedDomainNumOfSnapshots, /* domainNumOfSnapshots */
|
|
|
|
+ xenUnifiedDomainListSnapshots, /* domainListSnapshots */
|
2009-12-07 23:08:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xen_driver.h
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xen_driver.h
|
|
|
|
+++ libvirt-0.7.6/src/xen/xen_driver.h
|
2009-12-11 16:19:30 +01:00
|
|
|
@@ -100,6 +100,11 @@ struct xenUnifiedDriver {
|
2009-04-24 23:15:55 +02:00
|
|
|
virDrvDomainGetSchedulerType domainGetSchedulerType;
|
|
|
|
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
|
|
|
|
virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
|
2009-02-03 22:58:24 +01:00
|
|
|
+ virDrvDomainSnapshotCreate domainSnapshotCreate;
|
|
|
|
+ virDrvDomainSnapshotApply domainSnapshotApply;
|
|
|
|
+ virDrvDomainSnapshotDelete domainSnapshotDelete;
|
|
|
|
+ virDrvDomainNumOfSnapshots domainNumOfSnapshots;
|
|
|
|
+ virDrvDomainListSnapshots domainListSnapshots;
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct xenXMConfCache *xenXMConfCachePtr;
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xend_internal.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xend_internal.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xend_internal.c
|
2009-04-24 23:15:55 +02:00
|
|
|
@@ -53,6 +53,12 @@
|
2009-02-03 22:58:24 +01:00
|
|
|
|
|
|
|
#ifndef PROXY
|
|
|
|
|
|
|
|
+static int xenDaemonDomainSnapshotCreate(virDomainPtr domain, const char* name);
|
|
|
|
+static int xenDaemonDomainSnapshotApply(virDomainPtr domain, const char* name);
|
|
|
|
+static int xenDaemonDomainSnapshotDelete(virDomainPtr domain, const char* name);
|
|
|
|
+static int xenDaemonDomainNumOfSnapshots(virDomainPtr domain);
|
|
|
|
+static int xenDaemonDomainListSnapshots(virDomainPtr domain, char **const names, int maxnames);
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* The number of Xen scheduler parameters
|
|
|
|
*/
|
2010-02-04 21:17:25 +01:00
|
|
|
@@ -3284,6 +3290,87 @@ xenDaemonDomainRestore(virConnectPtr con
|
2009-02-03 22:58:24 +01:00
|
|
|
}
|
|
|
|
return xend_op(conn, "", "op", "restore", "file", filename, NULL);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenDaemonDomainSnapshotCreate(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ if ((domain == NULL) || (name == NULL)) {
|
|
|
|
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+ return xend_op(domain->conn, domain->name, "op",
|
|
|
|
+ "snapshot_create", "name", name, NULL);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenDaemonDomainSnapshotApply(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ if ((domain == NULL) || (name == NULL)) {
|
|
|
|
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+ return xend_op(domain->conn, domain->name, "op",
|
|
|
|
+ "snapshot_apply", "name", name, NULL);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenDaemonDomainSnapshotDelete(virDomainPtr domain, const char* name)
|
|
|
|
+{
|
|
|
|
+ if ((domain == NULL) || (name == NULL)) {
|
|
|
|
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
|
|
|
+ return (-1);
|
|
|
|
+ }
|
|
|
|
+ return xend_op(domain->conn, domain->name, "op",
|
|
|
|
+ "snapshot_delete", "name", name, NULL);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenDaemonDomainNumOfSnapshots(virDomainPtr domain)
|
|
|
|
+{
|
|
|
|
+ struct sexpr *root, *node, *value;
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ root = sexpr_get(domain->conn,
|
|
|
|
+ "/xend/domain/%s?op=snapshot_list", domain->name);
|
|
|
|
+ if (root == NULL)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ for (node = root, i = 0; node->kind == SEXPR_CONS; node = node->u.s.cdr) {
|
|
|
|
+ value = node->u.s.car;
|
|
|
|
+
|
|
|
|
+ if (value->kind == SEXPR_VALUE)
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return i;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+xenDaemonDomainListSnapshots(virDomainPtr domain, char **const names,
|
|
|
|
+ int maxnames)
|
|
|
|
+{
|
|
|
|
+ struct sexpr *root, *node, *value;
|
|
|
|
+ int i;
|
|
|
|
+ root = sexpr_get(domain->conn,
|
|
|
|
+ "/xend/domain/%s?op=snapshot_list", domain->name);
|
|
|
|
+ if (root == NULL)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ for (node = root, i = 0; node->kind == SEXPR_CONS; node = node->u.s.cdr) {
|
|
|
|
+ value = node->u.s.car;
|
|
|
|
+
|
|
|
|
+ if (value->kind == SEXPR_VALUE) {
|
|
|
|
+ names[i] = strdup(value->u.value);
|
|
|
|
+ if (++i > maxnames)
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (; i < maxnames; i++)
|
|
|
|
+ names[i] = NULL;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
#endif /* !PROXY */
|
|
|
|
|
|
|
|
/**
|
2010-02-04 21:17:25 +01:00
|
|
|
@@ -5235,6 +5322,11 @@ struct xenUnifiedDriver xenDaemonDriver
|
2009-04-24 23:15:55 +02:00
|
|
|
xenDaemonGetSchedulerType, /* domainGetSchedulerType */
|
|
|
|
xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
|
|
|
|
xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ xenDaemonDomainSnapshotCreate, /* domainSnapshotCreate */
|
|
|
|
+ xenDaemonDomainSnapshotApply, /* domainSnapshotApply */
|
|
|
|
+ xenDaemonDomainSnapshotDelete, /* domainSnapshotDelete */
|
|
|
|
+ xenDaemonDomainNumOfSnapshots, /* domainNumOfSnapshots */
|
|
|
|
+ xenDaemonDomainListSnapshots, /* domainListSnapshots */
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/proxy_internal.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/proxy_internal.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/proxy_internal.c
|
2009-12-11 16:19:30 +01:00
|
|
|
@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenProxyDriver =
|
2009-04-24 23:15:55 +02:00
|
|
|
NULL, /* domainGetSchedulerType */
|
|
|
|
NULL, /* domainGetSchedulerParameters */
|
|
|
|
NULL, /* domainSetSchedulerParameters */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xen_hypervisor.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xen_hypervisor.c
|
2010-01-08 01:37:05 +01:00
|
|
|
@@ -800,6 +800,11 @@ struct xenUnifiedDriver xenHypervisorDri
|
2009-04-24 23:15:55 +02:00
|
|
|
xenHypervisorGetSchedulerType, /* domainGetSchedulerType */
|
|
|
|
xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */
|
|
|
|
xenHypervisorSetSchedulerParameters, /* domainSetSchedulerParameters */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
#endif /* !PROXY */
|
|
|
|
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xm_internal.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xm_internal.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xm_internal.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -118,6 +118,11 @@ struct xenUnifiedDriver xenXMDriver = {
|
2009-04-24 23:15:55 +02:00
|
|
|
NULL, /* domainGetSchedulerType */
|
|
|
|
NULL, /* domainGetSchedulerParameters */
|
|
|
|
NULL, /* domainSetSchedulerParameters */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define xenXMError(conn, code, fmt...) \
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xs_internal.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xs_internal.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xs_internal.c
|
2009-04-24 23:15:55 +02:00
|
|
|
@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenStoreDriver =
|
|
|
|
NULL, /* domainGetSchedulerType */
|
|
|
|
NULL, /* domainGetSchedulerParameters */
|
|
|
|
NULL, /* domainSetSchedulerParameters */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
2009-04-24 23:15:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ! PROXY */
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/tools/virsh.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/tools/virsh.c
|
|
|
|
+++ libvirt-0.7.6/tools/virsh.c
|
|
|
|
@@ -1237,6 +1237,188 @@ cmdSave(vshControl *ctl, const vshCmd *c
|
2009-02-03 22:58:24 +01:00
|
|
|
}
|
|
|
|
|
2009-11-05 04:56:27 +01:00
|
|
|
/*
|
2009-02-03 22:58:24 +01:00
|
|
|
+ * "snapshot-create" command
|
|
|
|
+ */
|
|
|
|
+static vshCmdInfo info_snapshot_create[] = {
|
|
|
|
+ {"syntax", "snapshot-create <domain> <name>"},
|
|
|
|
+ {"help", gettext_noop("Create a snapshot of the domain")},
|
|
|
|
+ {"desc", gettext_noop("Create a snapshot of the domain")},
|
|
|
|
+ {NULL, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static vshCmdOptDef opts_snapshot_create[] = {
|
|
|
|
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Domain name, id or uuid")},
|
|
|
|
+ {"name", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Name of the snapshot")},
|
|
|
|
+ {NULL, 0, 0, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
|
|
|
|
+{
|
|
|
|
+ virDomainPtr dom;
|
|
|
|
+ char *name;
|
|
|
|
+ char *domain;
|
|
|
|
+ int ret = TRUE;
|
|
|
|
+
|
|
|
|
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (!(name = vshCommandOptString(cmd, "name", NULL)))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
2009-04-24 23:15:55 +02:00
|
|
|
+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain)))
|
2009-02-03 22:58:24 +01:00
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (virDomainSnapshotCreate(dom, name) == 0) {
|
|
|
|
+ vshPrint(ctl, _("Snapshot %s created for domain %s\n"), name, domain);
|
|
|
|
+ } else {
|
2009-11-05 04:56:27 +01:00
|
|
|
+ vshError(ctl, _("Failed to create snapshot %s for domain %s"),
|
|
|
|
+ name, domain);
|
2009-02-03 22:58:24 +01:00
|
|
|
+ ret = FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ virDomainFree(dom);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * "snapshot-apply" command
|
|
|
|
+ */
|
|
|
|
+static vshCmdInfo info_snapshot_apply[] = {
|
|
|
|
+ {"syntax", "snapshot-apply <domain> <name>"},
|
|
|
|
+ {"help", gettext_noop("Start the domain using a snapshot")},
|
|
|
|
+ {"desc", gettext_noop("Start the domain using a snapshot")},
|
|
|
|
+ {NULL, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static vshCmdOptDef opts_snapshot_apply[] = {
|
|
|
|
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Domain name, id or uuid")},
|
|
|
|
+ {"name", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Name of the snapshot")},
|
|
|
|
+ {NULL, 0, 0, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+cmdSnapshotApply(vshControl *ctl, const vshCmd *cmd)
|
|
|
|
+{
|
|
|
|
+ virDomainPtr dom;
|
|
|
|
+ char *name;
|
|
|
|
+ char *domain;
|
|
|
|
+ int ret = TRUE;
|
|
|
|
+
|
|
|
|
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (!(name = vshCommandOptString(cmd, "name", NULL)))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
2009-04-24 23:15:55 +02:00
|
|
|
+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain)))
|
2009-02-03 22:58:24 +01:00
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (virDomainSnapshotApply(dom, name) == 0) {
|
|
|
|
+ vshPrint(ctl, _("Domain %s started using snapshot %s\n"),
|
|
|
|
+ domain, name);
|
|
|
|
+ } else {
|
2009-11-05 04:56:27 +01:00
|
|
|
+ vshError(ctl, _("Failed to start domain %s using snapshot %s"),
|
|
|
|
+ domain, name);
|
2009-02-03 22:58:24 +01:00
|
|
|
+ ret = FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ virDomainFree(dom);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * "snapshot-delete" command
|
|
|
|
+ */
|
|
|
|
+static vshCmdInfo info_snapshot_delete[] = {
|
|
|
|
+ {"syntax", "snapshot-delete <domain> <name>"},
|
|
|
|
+ {"help", gettext_noop("Delete a snapshot from a domain")},
|
|
|
|
+ {"desc", gettext_noop("Delete a snapshot from a domain")},
|
|
|
|
+ {NULL, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static vshCmdOptDef opts_snapshot_delete[] = {
|
|
|
|
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Domain name, id or uuid")},
|
|
|
|
+ {"name", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Name of the snapshot")},
|
|
|
|
+ {NULL, 0, 0, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd)
|
|
|
|
+{
|
|
|
|
+ virDomainPtr dom;
|
|
|
|
+ char *name;
|
|
|
|
+ char *domain;
|
|
|
|
+ int ret = TRUE;
|
|
|
|
+
|
|
|
|
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (!(name = vshCommandOptString(cmd, "name", NULL)))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
2009-04-24 23:15:55 +02:00
|
|
|
+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain)))
|
2009-02-03 22:58:24 +01:00
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ if (virDomainSnapshotDelete(dom, name) == 0) {
|
|
|
|
+ vshPrint(ctl, _("Snapshot %s deleted from domain %s\n"), name, domain);
|
|
|
|
+ } else {
|
2009-11-05 04:56:27 +01:00
|
|
|
+ vshError(ctl, _("Failed to delete snapshot %s from domain %s"),
|
|
|
|
+ name, domain);
|
2009-02-03 22:58:24 +01:00
|
|
|
+ ret = FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ virDomainFree(dom);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * "snapshot-list" command
|
|
|
|
+ */
|
|
|
|
+static vshCmdInfo info_snapshot_list[] = {
|
|
|
|
+ {"syntax", "snapshot-list <domain>"},
|
|
|
|
+ {"help", gettext_noop("List all snapshots of a domain")},
|
|
|
|
+ {"desc", gettext_noop("List all snapshots of a domain")},
|
|
|
|
+ {NULL, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static vshCmdOptDef opts_snapshot_list[] = {
|
|
|
|
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("Domain name, id or uuid")},
|
|
|
|
+ {NULL, 0, 0, NULL}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
|
|
|
|
+{
|
|
|
|
+ virDomainPtr dom;
|
|
|
|
+ char *domain;
|
|
|
|
+ char** names;
|
|
|
|
+ int num;
|
|
|
|
+ int i;
|
|
|
|
+ int ret = TRUE;
|
|
|
|
+
|
|
|
|
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
2009-04-24 23:15:55 +02:00
|
|
|
+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain)))
|
2009-02-03 22:58:24 +01:00
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ // TODO Display snapshot details
|
|
|
|
+ num = virDomainNumOfSnapshots(dom);
|
|
|
|
+ names = malloc(num * sizeof(*names));
|
|
|
|
+ virDomainListSnapshots(dom, names, num);
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < num; i++) {
|
|
|
|
+ printf("%s\n", names[i]);
|
|
|
|
+ free(names[i]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ free(names);
|
|
|
|
+ virDomainFree(dom);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
2009-11-05 04:56:27 +01:00
|
|
|
+/*
|
2009-02-03 22:58:24 +01:00
|
|
|
* "schedinfo" command
|
|
|
|
*/
|
2009-11-05 04:56:27 +01:00
|
|
|
static const vshCmdInfo info_schedinfo[] = {
|
2010-02-04 21:17:25 +01:00
|
|
|
@@ -7502,6 +7684,12 @@ static const vshCmdDef commands[] = {
|
2009-02-03 22:58:24 +01:00
|
|
|
{"undefine", cmdUndefine, opts_undefine, info_undefine},
|
|
|
|
{"uri", cmdURI, NULL, info_uri},
|
|
|
|
|
|
|
|
+ {"snapshot-create", cmdSnapshotCreate, opts_snapshot_create, info_snapshot_create},
|
|
|
|
+ {"snapshot-apply", cmdSnapshotApply, opts_snapshot_apply, info_snapshot_apply},
|
|
|
|
+ {"snapshot-delete", cmdSnapshotDelete, opts_snapshot_delete, info_snapshot_delete},
|
|
|
|
+ {"snapshot-list", cmdSnapshotList, opts_snapshot_list, info_snapshot_list},
|
|
|
|
+
|
|
|
|
+
|
|
|
|
{"vol-create", cmdVolCreate, opts_vol_create, info_vol_create},
|
2009-07-24 01:36:28 +02:00
|
|
|
{"vol-create-from", cmdVolCreateFrom, opts_vol_create_from, info_vol_create_from},
|
2009-02-03 22:58:24 +01:00
|
|
|
{"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as},
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/lxc/lxc_driver.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/lxc/lxc_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/lxc/lxc_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -2458,6 +2458,11 @@ static virDriver lxcDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
lxcDomainIsActive,
|
|
|
|
lxcDomainIsPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
static virStateDriver lxcStateDriver = {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/openvz/openvz_driver.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/openvz/openvz_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/openvz/openvz_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -1537,6 +1537,11 @@ static virDriver openvzDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
openvzDomainIsActive,
|
|
|
|
openvzDomainIsPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
int openvzRegister(void) {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/qemu/qemu_driver.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/qemu/qemu_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/qemu/qemu_driver.c
|
|
|
|
@@ -8632,6 +8632,11 @@ static virDriver qemuDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
qemuDomainIsActive,
|
|
|
|
qemuDomainIsPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
qemuCPUCompare, /* cpuCompare */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/esx/esx_driver.c
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/esx/esx_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/esx/esx_driver.c
|
|
|
|
@@ -3403,6 +3403,11 @@ static virDriver esxDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
esxDomainIsActive, /* domainIsActive */
|
|
|
|
esxDomainIsPersistent, /* domainIsPersistent */
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/test/test_driver.c
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/test/test_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/test/test_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -5240,6 +5240,11 @@ static virDriver testDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
testDomainIsActive, /* domainIsActive */
|
|
|
|
testDomainIsPersistent, /* domainIsPersistent */
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-02-03 22:58:24 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
static virNetworkDriver testNetworkDriver = {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/uml/uml_driver.c
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/uml/uml_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/uml/uml_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -1926,6 +1926,11 @@ static virDriver umlDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
umlDomainIsActive,
|
|
|
|
umlDomainIsPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/vbox/vbox_tmpl.c
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/vbox/vbox_tmpl.c
|
|
|
|
+++ libvirt-0.7.6/src/vbox/vbox_tmpl.c
|
|
|
|
@@ -7059,6 +7059,11 @@ virDriver NAME(Driver) = {
|
2009-12-11 16:19:30 +01:00
|
|
|
vboxDomainIsActive,
|
|
|
|
vboxDomainIsPersistent,
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
virNetworkDriver NAME(NetworkDriver) = {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/opennebula/one_driver.c
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/opennebula/one_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/opennebula/one_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -785,6 +785,11 @@ static virDriver oneDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
NULL, /* domainIsActive */
|
|
|
|
NULL, /* domainIsPersistent */
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
static virStateDriver oneStateDriver = {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/phyp/phyp_driver.c
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/phyp/phyp_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/phyp/phyp_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -1653,6 +1653,11 @@ virDriver phypDriver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
NULL, /* domainIsActive */
|
|
|
|
NULL, /* domainIsPersistent */
|
2010-01-08 01:37:05 +01:00
|
|
|
NULL, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/remote/remote_driver.c
|
2009-10-16 06:31:39 +02:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/remote/remote_driver.c
|
|
|
|
+++ libvirt-0.7.6/src/remote/remote_driver.c
|
2010-01-28 02:07:11 +01:00
|
|
|
@@ -8994,6 +8994,11 @@ static virDriver remote_driver = {
|
2009-12-11 16:19:30 +01:00
|
|
|
remoteDomainIsActive, /* domainIsActive */
|
|
|
|
remoteDomainIsPersistent, /* domainIsPersistent */
|
2010-01-08 01:37:05 +01:00
|
|
|
remoteCPUCompare, /* cpuCompare */
|
2009-11-05 04:56:27 +01:00
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
|
|
|
|
|
|
|
static virNetworkDriver network_driver = {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/docs/libvirt-api.xml
|
2009-11-05 04:56:27 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/docs/libvirt-api.xml
|
|
|
|
+++ libvirt-0.7.6/docs/libvirt-api.xml
|
2010-01-08 01:37:05 +01:00
|
|
|
@@ -293,6 +293,11 @@
|
2009-11-05 04:56:27 +01:00
|
|
|
<exports symbol='virDomainSetVcpus' type='function'/>
|
|
|
|
<exports symbol='virDomainShutdown' type='function'/>
|
2009-02-03 22:58:24 +01:00
|
|
|
<exports symbol='virDomainSuspend' type='function'/>
|
|
|
|
+ <exports symbol='virDomainSnapshotApply' type='function'/>
|
|
|
|
+ <exports symbol='virDomainSnapshotCreate' type='function'/>
|
|
|
|
+ <exports symbol='virDomainSnapshotDelete' type='function'/>
|
|
|
|
+ <exports symbol='virDomainNumOfSnapshots' type='function'/>
|
|
|
|
+ <exports symbol='virDomainListSnapshots' type='function'/>
|
2009-11-05 04:56:27 +01:00
|
|
|
<exports symbol='virDomainUndefine' type='function'/>
|
|
|
|
<exports symbol='virEventAddHandleFunc' type='function'/>
|
|
|
|
<exports symbol='virEventAddTimeoutFunc' type='function'/>
|
2010-01-08 01:37:05 +01:00
|
|
|
@@ -1972,6 +1977,36 @@ This function may requires privileged ac
|
2009-02-03 22:58:24 +01:00
|
|
|
<return type='int' info='0 in case of success and -1 in case of failure.'/>
|
|
|
|
<arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
</function>
|
|
|
|
+ <function name='virDomainSnapshotApply' file='libvirt' module='libvirt'>
|
|
|
|
+ <info>Start a shut off domain based on a previously taken snapshot</info>
|
|
|
|
+ <return type='int' info='0 in case of success and -1 in case of failure.'/>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
+ <arg name='name' type='const char *' info='name of the snapshot'/>
|
|
|
|
+ </function>
|
|
|
|
+ <function name='virDomainSnapshotCreate' file='libvirt' module='libvirt'>
|
|
|
|
+ <info>Create a snapshot from a running domain</info>
|
|
|
|
+ <return type='int' info='0 in case of success and -1 in case of failure.'/>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
+ <arg name='name' type='const char *' info='name of the snapshot'/>
|
|
|
|
+ </function>
|
|
|
|
+ <function name='virDomainSnapshotDelete' file='libvirt' module='libvirt'>
|
|
|
|
+ <info>Delete a snapshot from a domain</info>
|
|
|
|
+ <return type='int' info='0 in case of success and -1 in case of failure.'/>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
+ <arg name='name' type='const char *' info='name of the snapshot'/>
|
|
|
|
+ </function>
|
|
|
|
+ <function name='virDomainNumOfSnapshots' file='libvirt' module='libvirt'>
|
|
|
|
+ <info>Returns the number of snapshot a given domain has</info>
|
|
|
|
+ <return type='int' info='the number of snapshots in case of success and -1 in case of failure.'/>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
+ </function>
|
|
|
|
+ <function name='virDomainListSnapshots' file='libvirt' module='libvirt'>
|
|
|
|
+ <info>Returns the names of the snapshots of a domain</info>
|
|
|
|
+ <return type='int' info='0 in case of success and -1 in case of failure.'/>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
|
|
|
|
+ <arg name='names' type='char ** const' info='pointer to an array to store the snapshot names'/>
|
|
|
|
+ <arg name='maxnames' type='int' info='size of the names array'/>
|
|
|
|
+ </function>
|
|
|
|
<function name='virDomainUndefine' file='libvirt' module='libvirt'>
|
2009-11-05 04:56:27 +01:00
|
|
|
<info><![CDATA[Undefine a domain but does not stop it if it is running]]></info>
|
2009-02-03 22:58:24 +01:00
|
|
|
<return type='int' info='0 in case of success, -1 in case of error'/>
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/libvirt_public.syms
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/libvirt_public.syms
|
|
|
|
+++ libvirt-0.7.6/src/libvirt_public.syms
|
2009-11-05 04:56:27 +01:00
|
|
|
@@ -215,6 +215,11 @@ LIBVIRT_0.4.2 {
|
|
|
|
LIBVIRT_0.4.5 {
|
|
|
|
global:
|
|
|
|
virConnectFindStoragePoolSources;
|
|
|
|
+ virDomainSnapshotCreate;
|
|
|
|
+ virDomainSnapshotApply;
|
|
|
|
+ virDomainSnapshotDelete;
|
|
|
|
+ virDomainNumOfSnapshots;
|
|
|
|
+ virDomainListSnapshots;
|
|
|
|
} LIBVIRT_0.4.2;
|
2009-10-21 01:23:16 +02:00
|
|
|
|
2009-11-05 04:56:27 +01:00
|
|
|
LIBVIRT_0.5.0 {
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/python/generator.py
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/python/generator.py
|
|
|
|
+++ libvirt-0.7.6/python/generator.py
|
|
|
|
@@ -289,6 +289,7 @@ skip_impl = (
|
2009-11-05 04:56:27 +01:00
|
|
|
'virDomainSetSchedulerParameters',
|
|
|
|
'virDomainGetVcpus',
|
|
|
|
'virDomainPinVcpu',
|
|
|
|
+ 'virDomainListSnapshots',
|
|
|
|
'virSecretGetValue',
|
|
|
|
'virSecretSetValue',
|
|
|
|
'virSecretGetUUID',
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/python/libvirt-override.c
|
2009-10-21 01:23:16 +02:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/python/libvirt-override.c
|
|
|
|
+++ libvirt-0.7.6/python/libvirt-override.c
|
|
|
|
@@ -1542,6 +1542,34 @@ libvirt_virStoragePoolGetInfo(PyObject *
|
2009-02-03 22:58:24 +01:00
|
|
|
return(py_retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static PyObject *
|
|
|
|
+libvirt_virDomainListSnapshots(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|
|
|
+ PyObject *py_retval;
|
|
|
|
+ int i, num;
|
|
|
|
+ char** names;
|
|
|
|
+ virDomainPtr domain;
|
|
|
|
+ PyObject *pyobj_domain;
|
|
|
|
+
|
|
|
|
+ if (!PyArg_ParseTuple(args, (char *)"O:virDomainListSnapshots",
|
|
|
|
+ &pyobj_domain))
|
|
|
|
+ return(NULL);
|
|
|
|
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
|
|
|
+
|
|
|
|
+LIBVIRT_BEGIN_ALLOW_THREADS;
|
|
|
|
+ num = virDomainNumOfSnapshots(domain);
|
|
|
|
+ names = malloc(num * sizeof(*names));
|
|
|
|
+ virDomainListSnapshots(domain, names, num);
|
|
|
|
+LIBVIRT_END_ALLOW_THREADS;
|
|
|
|
+
|
|
|
|
+ py_retval = PyList_New(num);
|
|
|
|
+ for (i = 0; i < num; i++) {
|
|
|
|
+ PyList_SetItem(py_retval, i, Py_BuildValue("s", names[i]));
|
|
|
|
+ free(names[i]);
|
|
|
|
+ }
|
|
|
|
+ free(names);
|
|
|
|
+
|
|
|
|
+ return(py_retval);
|
|
|
|
+}
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
2010-02-04 21:17:25 +01:00
|
|
|
@@ -2717,6 +2745,7 @@ static PyMethodDef libvirtMethods[] = {
|
2009-10-21 01:23:16 +02:00
|
|
|
{(char *) "virStoragePoolGetAutostart", libvirt_virStoragePoolGetAutostart, METH_VARARGS, NULL},
|
2009-11-05 04:56:27 +01:00
|
|
|
{(char *) "virStoragePoolListVolumes", libvirt_virStoragePoolListVolumes, METH_VARARGS, NULL},
|
|
|
|
{(char *) "virStoragePoolGetInfo", libvirt_virStoragePoolGetInfo, METH_VARARGS, NULL},
|
|
|
|
+ {(char *) "virDomainListSnapshots", libvirt_virDomainListSnapshots, METH_VARARGS, NULL},
|
|
|
|
{(char *) "virStorageVolGetInfo", libvirt_virStorageVolGetInfo, METH_VARARGS, NULL},
|
|
|
|
{(char *) "virStoragePoolGetUUID", libvirt_virStoragePoolGetUUID, METH_VARARGS, NULL},
|
|
|
|
{(char *) "virStoragePoolGetUUIDString", libvirt_virStoragePoolGetUUIDString, METH_VARARGS, NULL},
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/python/libvirt-override-api.xml
|
2009-02-03 22:58:24 +01:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/python/libvirt-override-api.xml
|
|
|
|
+++ libvirt-0.7.6/python/libvirt-override-api.xml
|
|
|
|
@@ -150,6 +150,11 @@
|
2009-02-03 22:58:24 +01:00
|
|
|
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
|
|
|
|
<arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/>
|
|
|
|
</function>
|
|
|
|
+ <function name='virDomainListSnapshots' file='python'>
|
|
|
|
+ <info>Returns the names of the snapshots of a domain</info>
|
|
|
|
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
|
|
|
|
+ <return type='str *' info='the list of Names or None in case of error'/>
|
|
|
|
+ </function>
|
|
|
|
<function name='virConnectListStoragePools' file='python'>
|
|
|
|
<info>list the storage pools, stores the pointers to the names in @names</info>
|
|
|
|
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
|
2010-02-04 21:17:25 +01:00
|
|
|
Index: libvirt-0.7.6/src/xen/xen_inotify.c
|
2009-10-21 01:23:16 +02:00
|
|
|
===================================================================
|
2010-02-04 21:17:25 +01:00
|
|
|
--- libvirt-0.7.6.orig/src/xen/xen_inotify.c
|
|
|
|
+++ libvirt-0.7.6/src/xen/xen_inotify.c
|
2009-12-11 16:19:30 +01:00
|
|
|
@@ -86,6 +86,11 @@ struct xenUnifiedDriver xenInotifyDriver
|
2009-11-05 04:56:27 +01:00
|
|
|
NULL, /* domainGetSchedulerType */
|
|
|
|
NULL, /* domainGetSchedulerParameters */
|
|
|
|
NULL, /* domainSetSchedulerParameters */
|
|
|
|
+ NULL, /* domainSnapshotCreate */
|
|
|
|
+ NULL, /* domainSnapshotApply */
|
|
|
|
+ NULL, /* domainSnapshotDelete */
|
|
|
|
+ NULL, /* domainNumOfSnapshots */
|
|
|
|
+ NULL, /* domainListSnapshots */
|
|
|
|
};
|
2009-10-19 22:17:26 +02:00
|
|
|
|
2009-11-05 04:56:27 +01:00
|
|
|
static int
|