From b55e17781694a65f4a9fa9d56ac1a37a19cf820386d2f1726826f278f5d68eb7 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Thu, 15 Apr 2010 22:56:55 +0000 Subject: [PATCH] Updating link to change in openSUSE:Factory/libvirt revision 52.0 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=3edde9bf7d8e38f0fe238af7b554d82a --- libvirt-0.7.7.tar.bz2 | 3 - libvirt-0.8.0.tar.bz2 | 3 + libvirt.changes | 22 + libvirt.spec | 52 +- libvirtd-defaults.patch | 16 +- lxc-cgroup.patch | 45 -- snapshots.patch | 1056 -------------------------------------- socat.patch | 8 +- suse-network.patch | 256 --------- xen-domctl-ver7.patch | 10 +- xen-name-for-devid.patch | 25 +- xen-pv-cdrom.patch | 8 +- xen-tap2-support.patch | 10 +- xend-disk-order.patch | 14 +- 14 files changed, 102 insertions(+), 1426 deletions(-) delete mode 100644 libvirt-0.7.7.tar.bz2 create mode 100644 libvirt-0.8.0.tar.bz2 delete mode 100644 lxc-cgroup.patch delete mode 100644 snapshots.patch delete mode 100644 suse-network.patch diff --git a/libvirt-0.7.7.tar.bz2 b/libvirt-0.7.7.tar.bz2 deleted file mode 100644 index 789c7aa..0000000 --- a/libvirt-0.7.7.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2f91e7437893aa66fa7f2bace9ec57967ee66ac80be5cb6bbfba0acce78eb708 -size 6512919 diff --git a/libvirt-0.8.0.tar.bz2 b/libvirt-0.8.0.tar.bz2 new file mode 100644 index 0000000..9b38ec6 --- /dev/null +++ b/libvirt-0.8.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98ff762add810e318d2d586ea419219e71fe29f25f32eab20bae1cd9edbbc703 +size 7478088 diff --git a/libvirt.changes b/libvirt.changes index 7d0973a..ab869a9 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,25 @@ +------------------------------------------------------------------- +Mon Apr 12 18:15:38 MDT 2010 - jfehlig@novell.com + +- Update to libvirt 0.8.0 + - Snapshot API framework + - Add managed save API entry points + - Timer subselection for domain clock + - Add hook utilities + - Network filtering API + - Introduce a new virDomainUpdateDeviceFlags public API + - Introduce a new public API for domain events + - Public virDomainMigrateSetMaxDowntime API + - Add public API for volume wiping + - xenapi: Initial commit of the new driver + - lots of improvements and bug fixes + +------------------------------------------------------------------- +Fri Mar 26 17:20:11 MDT 2010 - jfehlig@novell.com + +- Fix 'virsh dominfo' crash when no security driver is configured + fix-no-secdriver.patch + ------------------------------------------------------------------- Sun Mar 21 21:20:17 MST 2010 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index dee4294..5b04a5a 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1,5 +1,5 @@ # -# spec file for package libvirt (Version 0.7.7) +# spec file for package libvirt (Version 0.8.0) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -113,7 +113,7 @@ Url: http://libvirt.org/ License: LGPLv2.1+ Group: Development/Libraries/C and C++ AutoReqProv: yes -Version: 0.7.7 +Version: 0.8.0 Release: 1 Summary: A C toolkit to interract with the virtualization capabilities of Linux # The client side, i.e. shared libs and virsh are in a subpackage @@ -138,19 +138,16 @@ Requires: PolicyKit >= 0.6 Source0: %{name}-%{version}.tar.bz2 Source1: libvirtd.init # Upstream patches -Patch0: xen-name-for-devid.patch -Patch1: lxc-cgroup.patch # Need to go upstream -Patch100: socat.patch -Patch101: clone.patch -Patch102: xen-pv-cdrom.patch -Patch103: xen-domctl-ver7.patch -Patch104: xen-tap2-support.patch -Patch105: xend-disk-order.patch +Patch100: xen-name-for-devid.patch +Patch101: socat.patch +Patch102: clone.patch +Patch103: xen-pv-cdrom.patch +Patch104: xen-domctl-ver7.patch +Patch105: xen-tap2-support.patch +Patch106: xend-disk-order.patch # Our patches Patch200: libvirtd-defaults.patch -Patch201: suse-network.patch -Patch202: snapshots.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -254,17 +251,14 @@ Authors: %prep %setup -q -%patch0 -p1 -%patch1 -p1 %patch100 -p1 -%patch101 -%patch102 -p1 +%patch101 -p1 +%patch102 %patch103 -p1 %patch104 -p1 %patch105 -p1 +%patch106 -p1 %patch200 -p1 -%patch201 -p1 -%patch202 -p1 %build %if ! %{with_xen} @@ -364,10 +358,15 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a %if ! %{with_lxc} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc %endif %if ! %{with_qemu} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu +%endif +%if ! %{with_uml} +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml %endif ln_dupes() { @@ -420,10 +419,11 @@ rm -rf $RPM_BUILD_ROOT %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart +%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/ +%{_sysconfdir}/libvirt/nwfilter/*.xml %config /etc/init.d/libvirtd %{_sbindir}/rclibvirtd %config %{_sysconfdir}/libvirt/libvirtd.conf -%config %{_sysconfdir}/logrotate.d/libvirtd %config %{_sysconfdir}/libvirt/qemu/networks/default.xml %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/ %dir %{_localstatedir}/run/libvirt/ @@ -439,24 +439,27 @@ rm -rf $RPM_BUILD_ROOT %endif %{_datadir}/augeas %if %{with_qemu} -%config %{_sysconfdir}/libvirt/qemu.conf +%config (noreplace)%{_sysconfdir}/libvirt/qemu.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/qemu/ +%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ %endif %if %{with_lxc} -%config %{_sysconfdir}/libvirt/lxc.conf +%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/lxc/ %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/ +%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ %attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc %endif %if %{with_uml} +%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/uml/ %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/ -%endif -%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ -%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/ +%endif %if 0%{with_storage_disk} %{_libdir}/%{name}/libvirt_parthelper %endif @@ -487,6 +490,7 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/libvirt/schemas/secret.rng %{_datadir}/libvirt/schemas/storageencryption.rng %{_datadir}/libvirt/cpu_map.xml +%{_datadir}/libvirt/schemas/nwfilter.rng %config %{_sysconfdir}/sasl2/libvirt.conf %files devel diff --git a/libvirtd-defaults.patch b/libvirtd-defaults.patch index e030d0b..3f15365 100644 --- a/libvirtd-defaults.patch +++ b/libvirtd-defaults.patch @@ -1,7 +1,7 @@ -Index: libvirt-0.7.5/daemon/libvirtd.conf +Index: libvirt-0.8.0/daemon/libvirtd.conf =================================================================== ---- libvirt-0.7.5.orig/daemon/libvirtd.conf -+++ libvirt-0.7.5/daemon/libvirtd.conf +--- libvirt-0.8.0.orig/daemon/libvirtd.conf ++++ libvirt-0.8.0/daemon/libvirtd.conf @@ -18,8 +18,8 @@ # It is necessary to setup a CA and issue server certificates before # using this capability. @@ -28,11 +28,11 @@ Index: libvirt-0.7.5/daemon/libvirtd.conf # Override the default mDNS advertizement name. This must be # unique on the immediate broadcast network. -Index: libvirt-0.7.5/daemon/libvirtd.c +Index: libvirt-0.8.0/daemon/libvirtd.c =================================================================== ---- libvirt-0.7.5.orig/daemon/libvirtd.c -+++ libvirt-0.7.5/daemon/libvirtd.c -@@ -137,7 +137,7 @@ static int sigwrite = -1; /* Signa +--- libvirt-0.8.0.orig/daemon/libvirtd.c ++++ libvirt-0.8.0/daemon/libvirtd.c +@@ -141,7 +141,7 @@ static int sigwrite = -1; /* Signa static int ipsock = 0; /* -l Listen for TCP/IP */ /* Defaults for configuration file elements */ @@ -41,7 +41,7 @@ Index: libvirt-0.7.5/daemon/libvirtd.c static int listen_tcp = 0; static char *listen_addr = (char *) LIBVIRTD_LISTEN_ADDR; static char *tls_port = (char *) LIBVIRTD_TLS_PORT; -@@ -159,7 +159,7 @@ static int auth_tcp = REMOTE_AUTH_NONE; +@@ -163,7 +163,7 @@ static int auth_tcp = REMOTE_AUTH_NONE; #endif static int auth_tls = REMOTE_AUTH_NONE; diff --git a/lxc-cgroup.patch b/lxc-cgroup.patch deleted file mode 100644 index e778986..0000000 --- a/lxc-cgroup.patch +++ /dev/null @@ -1,45 +0,0 @@ -commit f034c0bfd7089ba3400b7a44b97540c4a8785e35 -Author: Jim Fehlig -Date: Sun Mar 21 19:59:13 2010 -0600 - - Avoid libvirtd crash when cgroups is not configured on host - - Invoking virDomainSetMemory() on lxc driver results in libvirtd - segfault when cgroups has not been configured on the host. - - Ensure driver->cgroup is non-null before invoking - virCgroupForDomain(). To prevent similar segfaults in the future, - ensure driver parameter to virCgroupForDomain() is non-null before - dereferencing. - -diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c -index aeec593..ba13065 100644 ---- a/src/lxc/lxc_driver.c -+++ b/src/lxc/lxc_driver.c -@@ -625,6 +625,12 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) { - } - - if (virDomainObjIsActive(vm)) { -+ if (driver->cgroup == NULL) { -+ lxcError(VIR_ERR_NO_SUPPORT, -+ "%s", _("cgroups must be configured on the host")); -+ goto cleanup; -+ } -+ - if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { - lxcError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get cgroup for %s\n"), vm->def->name); -diff --git a/src/util/cgroup.c b/src/util/cgroup.c -index 8777781..496d9d3 100644 ---- a/src/util/cgroup.c -+++ b/src/util/cgroup.c -@@ -692,6 +692,9 @@ int virCgroupForDomain(virCgroupPtr driver, - int rc; - char *path; - -+ if (driver == NULL) -+ return -EINVAL; -+ - if (virAsprintf(&path, "%s/%s", driver->path, name) < 0) - return -ENOMEM; - diff --git a/snapshots.patch b/snapshots.patch deleted file mode 100644 index 1e5f310..0000000 --- a/snapshots.patch +++ /dev/null @@ -1,1056 +0,0 @@ -Index: libvirt-0.7.7/include/libvirt/libvirt.h.in -=================================================================== ---- libvirt-0.7.7.orig/include/libvirt/libvirt.h.in -+++ libvirt-0.7.7/include/libvirt/libvirt.h.in -@@ -621,6 +621,21 @@ int virDomainRestore - 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, -Index: libvirt-0.7.7/src/libvirt.c -=================================================================== ---- libvirt-0.7.7.orig/src/libvirt.c -+++ libvirt-0.7.7/src/libvirt.c -@@ -2379,6 +2379,166 @@ error: - } - - /** -+ * 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; -+} -+ -+/** - * virDomainCoreDump: - * @domain: a domain object - * @to: path for the core file -Index: libvirt-0.7.7/src/driver.h -=================================================================== ---- libvirt-0.7.7.orig/src/driver.h -+++ libvirt-0.7.7/src/driver.h -@@ -136,6 +136,21 @@ typedef int - (*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); -@@ -473,6 +488,11 @@ struct _virDriver { - virDrvCPUBaseline cpuBaseline; - virDrvDomainGetJobInfo domainGetJobInfo; - virDrvDomainAbortJob domainAbortJob; -+ virDrvDomainSnapshotCreate domainSnapshotCreate; -+ virDrvDomainSnapshotApply domainSnapshotApply; -+ virDrvDomainSnapshotDelete domainSnapshotDelete; -+ virDrvDomainNumOfSnapshots domainNumOfSnapshots; -+ virDrvDomainListSnapshots domainListSnapshots; - }; - - typedef int -Index: libvirt-0.7.7/src/xen/xen_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xen_driver.c -+++ libvirt-0.7.7/src/xen/xen_driver.c -@@ -1052,6 +1052,81 @@ xenUnifiedDomainRestore (virConnectPtr c - } - - 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); -@@ -1906,6 +1981,11 @@ static virDriver xenUnifiedDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ xenUnifiedDomainSnapshotCreate, /* domainSnapshotCreate */ -+ xenUnifiedDomainSnapshotApply, /* domainSnapshotApply */ -+ xenUnifiedDomainSnapshotDelete, /* domainSnapshotDelete */ -+ xenUnifiedDomainNumOfSnapshots, /* domainNumOfSnapshots */ -+ xenUnifiedDomainListSnapshots, /* domainListSnapshots */ - }; - - /** -Index: libvirt-0.7.7/src/xen/xen_driver.h -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xen_driver.h -+++ libvirt-0.7.7/src/xen/xen_driver.h -@@ -100,6 +100,11 @@ struct xenUnifiedDriver { - virDrvDomainGetSchedulerType domainGetSchedulerType; - virDrvDomainGetSchedulerParameters domainGetSchedulerParameters; - virDrvDomainSetSchedulerParameters domainSetSchedulerParameters; -+ virDrvDomainSnapshotCreate domainSnapshotCreate; -+ virDrvDomainSnapshotApply domainSnapshotApply; -+ virDrvDomainSnapshotDelete domainSnapshotDelete; -+ virDrvDomainNumOfSnapshots domainNumOfSnapshots; -+ virDrvDomainListSnapshots domainListSnapshots; - }; - - typedef struct xenXMConfCache *xenXMConfCachePtr; -Index: libvirt-0.7.7/src/xen/xend_internal.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xend_internal.c -+++ libvirt-0.7.7/src/xen/xend_internal.c -@@ -53,6 +53,12 @@ - - #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 - */ -@@ -3297,6 +3303,87 @@ xenDaemonDomainRestore(virConnectPtr con - } - 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 */ - - /** -@@ -5245,6 +5332,11 @@ struct xenUnifiedDriver xenDaemonDriver - xenDaemonGetSchedulerType, /* domainGetSchedulerType */ - xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */ - xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */ -+ xenDaemonDomainSnapshotCreate, /* domainSnapshotCreate */ -+ xenDaemonDomainSnapshotApply, /* domainSnapshotApply */ -+ xenDaemonDomainSnapshotDelete, /* domainSnapshotDelete */ -+ xenDaemonDomainNumOfSnapshots, /* domainNumOfSnapshots */ -+ xenDaemonDomainListSnapshots, /* domainListSnapshots */ - }; - - /************************************************************************ -Index: libvirt-0.7.7/src/xen/proxy_internal.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/proxy_internal.c -+++ libvirt-0.7.7/src/xen/proxy_internal.c -@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenProxyDriver = - NULL, /* domainGetSchedulerType */ - NULL, /* domainGetSchedulerParameters */ - NULL, /* domainSetSchedulerParameters */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - -Index: libvirt-0.7.7/src/xen/xen_hypervisor.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xen_hypervisor.c -+++ libvirt-0.7.7/src/xen/xen_hypervisor.c -@@ -850,6 +850,11 @@ struct xenUnifiedDriver xenHypervisorDri - xenHypervisorGetSchedulerType, /* domainGetSchedulerType */ - xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */ - xenHypervisorSetSchedulerParameters, /* domainSetSchedulerParameters */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - #endif /* !PROXY */ - -Index: libvirt-0.7.7/src/xen/xm_internal.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xm_internal.c -+++ libvirt-0.7.7/src/xen/xm_internal.c -@@ -118,6 +118,11 @@ struct xenUnifiedDriver xenXMDriver = { - NULL, /* domainGetSchedulerType */ - NULL, /* domainGetSchedulerParameters */ - NULL, /* domainSetSchedulerParameters */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - #define xenXMError(conn, code, fmt...) \ -Index: libvirt-0.7.7/src/xen/xs_internal.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xs_internal.c -+++ libvirt-0.7.7/src/xen/xs_internal.c -@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenStoreDriver = - NULL, /* domainGetSchedulerType */ - NULL, /* domainGetSchedulerParameters */ - NULL, /* domainSetSchedulerParameters */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - #endif /* ! PROXY */ -Index: libvirt-0.7.7/tools/virsh.c -=================================================================== ---- libvirt-0.7.7.orig/tools/virsh.c -+++ libvirt-0.7.7/tools/virsh.c -@@ -1268,6 +1268,188 @@ cmdSave(vshControl *ctl, const vshCmd *c - } - - /* -+ * "snapshot-create" command -+ */ -+static vshCmdInfo info_snapshot_create[] = { -+ {"syntax", "snapshot-create "}, -+ {"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; -+ -+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain))) -+ return FALSE; -+ -+ if (virDomainSnapshotCreate(dom, name) == 0) { -+ vshPrint(ctl, _("Snapshot %s created for domain %s\n"), name, domain); -+ } else { -+ vshError(ctl, _("Failed to create snapshot %s for domain %s"), -+ name, domain); -+ ret = FALSE; -+ } -+ -+ virDomainFree(dom); -+ return ret; -+} -+ -+/* -+ * "snapshot-apply" command -+ */ -+static vshCmdInfo info_snapshot_apply[] = { -+ {"syntax", "snapshot-apply "}, -+ {"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; -+ -+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain))) -+ return FALSE; -+ -+ if (virDomainSnapshotApply(dom, name) == 0) { -+ vshPrint(ctl, _("Domain %s started using snapshot %s\n"), -+ domain, name); -+ } else { -+ vshError(ctl, _("Failed to start domain %s using snapshot %s"), -+ domain, name); -+ ret = FALSE; -+ } -+ -+ virDomainFree(dom); -+ return ret; -+} -+ -+/* -+ * "snapshot-delete" command -+ */ -+static vshCmdInfo info_snapshot_delete[] = { -+ {"syntax", "snapshot-delete "}, -+ {"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; -+ -+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain))) -+ return FALSE; -+ -+ if (virDomainSnapshotDelete(dom, name) == 0) { -+ vshPrint(ctl, _("Snapshot %s deleted from domain %s\n"), name, domain); -+ } else { -+ vshError(ctl, _("Failed to delete snapshot %s from domain %s"), -+ name, domain); -+ ret = FALSE; -+ } -+ -+ virDomainFree(dom); -+ return ret; -+} -+ -+/* -+ * "snapshot-list" command -+ */ -+static vshCmdInfo info_snapshot_list[] = { -+ {"syntax", "snapshot-list "}, -+ {"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; -+ -+ if (!(dom = vshCommandOptDomain(ctl, cmd, &domain))) -+ 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; -+} -+ -+/* - * "schedinfo" command - */ - static const vshCmdInfo info_schedinfo[] = { -@@ -7753,6 +7935,12 @@ static const vshCmdDef commands[] = { - {"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}, - {"vol-create-from", cmdVolCreateFrom, opts_vol_create_from, info_vol_create_from}, - {"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as}, -Index: libvirt-0.7.7/src/lxc/lxc_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/lxc/lxc_driver.c -+++ libvirt-0.7.7/src/lxc/lxc_driver.c -@@ -2459,6 +2459,11 @@ static virDriver lxcDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - static virStateDriver lxcStateDriver = { -Index: libvirt-0.7.7/src/openvz/openvz_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/openvz/openvz_driver.c -+++ libvirt-0.7.7/src/openvz/openvz_driver.c -@@ -1540,6 +1540,11 @@ static virDriver openvzDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - int openvzRegister(void) { -Index: libvirt-0.7.7/src/qemu/qemu_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/qemu/qemu_driver.c -+++ libvirt-0.7.7/src/qemu/qemu_driver.c -@@ -9535,6 +9535,11 @@ static virDriver qemuDriver = { - qemuCPUBaseline, /* cpuBaseline */ - qemuDomainGetJobInfo, /* domainGetJobInfo */ - qemuDomainAbortJob, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - -Index: libvirt-0.7.7/src/esx/esx_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/esx/esx_driver.c -+++ libvirt-0.7.7/src/esx/esx_driver.c -@@ -3410,6 +3410,11 @@ static virDriver esxDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - -Index: libvirt-0.7.7/src/test/test_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/test/test_driver.c -+++ libvirt-0.7.7/src/test/test_driver.c -@@ -5245,6 +5245,11 @@ static virDriver testDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - static virNetworkDriver testNetworkDriver = { -Index: libvirt-0.7.7/src/uml/uml_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/uml/uml_driver.c -+++ libvirt-0.7.7/src/uml/uml_driver.c -@@ -1932,6 +1932,11 @@ static virDriver umlDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - -Index: libvirt-0.7.7/src/vbox/vbox_tmpl.c -=================================================================== ---- libvirt-0.7.7.orig/src/vbox/vbox_tmpl.c -+++ libvirt-0.7.7/src/vbox/vbox_tmpl.c -@@ -7065,6 +7065,11 @@ virDriver NAME(Driver) = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - virNetworkDriver NAME(NetworkDriver) = { -Index: libvirt-0.7.7/src/opennebula/one_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/opennebula/one_driver.c -+++ libvirt-0.7.7/src/opennebula/one_driver.c -@@ -788,6 +788,11 @@ static virDriver oneDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - static virStateDriver oneStateDriver = { -Index: libvirt-0.7.7/src/phyp/phyp_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/phyp/phyp_driver.c -+++ libvirt-0.7.7/src/phyp/phyp_driver.c -@@ -1656,6 +1656,11 @@ virDriver phypDriver = { - NULL, /* cpuBaseline */ - NULL, /* domainGetJobInfo */ - NULL, /* domainAbortJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - int -Index: libvirt-0.7.7/src/remote/remote_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/remote/remote_driver.c -+++ libvirt-0.7.7/src/remote/remote_driver.c -@@ -9143,6 +9143,11 @@ static virDriver remote_driver = { - remoteCPUBaseline, /* cpuBaseline */ - remoteDomainGetJobInfo, /* domainGetJobInfo */ - remoteDomainAbortJob, /* domainFinishJob */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - static virNetworkDriver network_driver = { -Index: libvirt-0.7.7/docs/libvirt-api.xml -=================================================================== ---- libvirt-0.7.7.orig/docs/libvirt-api.xml -+++ libvirt-0.7.7/docs/libvirt-api.xml -@@ -300,6 +300,11 @@ - - - -+ -+ -+ -+ -+ - - - -@@ -2040,6 +2045,36 @@ This function may requires privileged ac - - - -+ -+ Start a shut off domain based on a previously taken snapshot -+ -+ -+ -+ -+ -+ Create a snapshot from a running domain -+ -+ -+ -+ -+ -+ Delete a snapshot from a domain -+ -+ -+ -+ -+ -+ Returns the number of snapshot a given domain has -+ -+ -+ -+ -+ Returns the names of the snapshots of a domain -+ -+ -+ -+ -+ - - - -Index: libvirt-0.7.7/src/libvirt_public.syms -=================================================================== ---- libvirt-0.7.7.orig/src/libvirt_public.syms -+++ libvirt-0.7.7/src/libvirt_public.syms -@@ -215,6 +215,11 @@ LIBVIRT_0.4.2 { - LIBVIRT_0.4.5 { - global: - virConnectFindStoragePoolSources; -+ virDomainSnapshotCreate; -+ virDomainSnapshotApply; -+ virDomainSnapshotDelete; -+ virDomainNumOfSnapshots; -+ virDomainListSnapshots; - } LIBVIRT_0.4.2; - - LIBVIRT_0.5.0 { -Index: libvirt-0.7.7/python/generator.py -=================================================================== ---- libvirt-0.7.7.orig/python/generator.py -+++ libvirt-0.7.7/python/generator.py -@@ -290,6 +290,7 @@ skip_impl = ( - 'virDomainSetSchedulerParameters', - 'virDomainGetVcpus', - 'virDomainPinVcpu', -+ 'virDomainListSnapshots', - 'virSecretGetValue', - 'virSecretSetValue', - 'virSecretGetUUID', -Index: libvirt-0.7.7/python/libvirt-override.c -=================================================================== ---- libvirt-0.7.7.orig/python/libvirt-override.c -+++ libvirt-0.7.7/python/libvirt-override.c -@@ -1542,6 +1542,34 @@ libvirt_virStoragePoolGetInfo(PyObject * - 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) { -@@ -2805,6 +2833,7 @@ static PyMethodDef libvirtMethods[] = { - {(char *) "virStoragePoolGetAutostart", libvirt_virStoragePoolGetAutostart, METH_VARARGS, NULL}, - {(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}, -Index: libvirt-0.7.7/python/libvirt-override-api.xml -=================================================================== ---- libvirt-0.7.7.orig/python/libvirt-override-api.xml -+++ libvirt-0.7.7/python/libvirt-override-api.xml -@@ -155,6 +155,11 @@ - - - -+ -+ Returns the names of the snapshots of a domain -+ -+ -+ - - list the storage pools, stores the pointers to the names in @names - -Index: libvirt-0.7.7/src/xen/xen_inotify.c -=================================================================== ---- libvirt-0.7.7.orig/src/xen/xen_inotify.c -+++ libvirt-0.7.7/src/xen/xen_inotify.c -@@ -86,6 +86,11 @@ struct xenUnifiedDriver xenInotifyDriver - NULL, /* domainGetSchedulerType */ - NULL, /* domainGetSchedulerParameters */ - NULL, /* domainSetSchedulerParameters */ -+ NULL, /* domainSnapshotCreate */ -+ NULL, /* domainSnapshotApply */ -+ NULL, /* domainSnapshotDelete */ -+ NULL, /* domainNumOfSnapshots */ -+ NULL, /* domainListSnapshots */ - }; - - static int diff --git a/socat.patch b/socat.patch index 0ca543f..f0be201 100644 --- a/socat.patch +++ b/socat.patch @@ -1,8 +1,8 @@ -Index: libvirt-0.7.7/src/remote/remote_driver.c +Index: libvirt-0.8.0/src/remote/remote_driver.c =================================================================== ---- libvirt-0.7.7.orig/src/remote/remote_driver.c -+++ libvirt-0.7.7/src/remote/remote_driver.c -@@ -766,12 +766,29 @@ doRemoteOpen (virConnectPtr conn, +--- libvirt-0.8.0.orig/src/remote/remote_driver.c ++++ libvirt-0.8.0/src/remote/remote_driver.c +@@ -768,12 +768,29 @@ doRemoteOpen (virConnectPtr conn, cmd_argv[j++] = strdup ("none"); } cmd_argv[j++] = strdup (priv->hostname); diff --git a/suse-network.patch b/suse-network.patch deleted file mode 100644 index 92d7bbc..0000000 --- a/suse-network.patch +++ /dev/null @@ -1,256 +0,0 @@ -Index: libvirt-0.7.7/src/conf/network_conf.c -=================================================================== ---- libvirt-0.7.7.orig/src/conf/network_conf.c -+++ libvirt-0.7.7/src/conf/network_conf.c -@@ -845,6 +845,135 @@ error: - return NULL; - } - -+int virNetworkIsBridge(const char *name) -+{ -+ char *path = NULL; -+ int ret = 0; -+ struct stat s; -+ -+ if (asprintf(&path, "/sys/class/net/%s/bridge", name) < 0) -+ goto out; -+ -+ if (stat(path, &s) != 0) -+ goto out; -+ -+ if (S_ISDIR(s.st_mode)) -+ ret = 1; -+ -+out: -+ free(path); -+ return ret; -+ } -+ -+static unsigned long virNetworkDefSuseGetValue(const char *netName, const char *valName) -+{ -+ unsigned long ret = 0; -+ char *path = NULL; -+ FILE *f; -+ -+ if (asprintf(&path, "/sys/class/net/%s/bridge/%s", netName, valName) < 0) -+ return ret; -+ -+ if ((f = fopen(path, "r")) == NULL) -+ goto out; -+ -+ if (fscanf(f, "%lu", &ret) != 1) { -+ ret = 0; -+ goto out; -+ } -+ -+ out: -+ if (f != NULL) -+ fclose(f); -+ free(path); -+ return ret; -+} -+ -+static virNetworkObjPtr virNetworkLoadSuseNet(virNetworkObjListPtr nets, -+ const char *name) -+{ -+ virNetworkDefPtr def; -+ virNetworkObjPtr network; -+ int err; -+ -+ if ((network = virNetworkFindByName(nets, name))) { -+ virNetworkObjUnlock(network); -+ return network; -+ } -+ -+ if (VIR_ALLOC(network) < 0) { -+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL); -+ return NULL; -+ } -+ -+ network->autostart = 1; -+ network->active = 1; -+ network->suse = 1; -+ -+ if (VIR_ALLOC(def) < 0) { -+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL); -+ goto error; -+ } -+ -+ network->def = def; -+ -+ /* name */ -+ def->name = strdup(name); -+ if (def->name == NULL) { -+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL); -+ goto error; -+ } -+ -+ /* uuid */ -+ if ((err = virUUIDGenerate(def->uuid))) { -+ virNetworkReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Failed to generate UUID: %s"), strerror(err)); -+ goto error; -+ } -+ -+ /* bridge information */ -+ def->bridge = strdup(name); -+ if (def->bridge == NULL) { -+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL); -+ goto error; -+ } -+ def->stp = (int)virNetworkDefSuseGetValue(name, "stp_state"); -+ def->delay = virNetworkDefSuseGetValue(name, "forward_delay"); -+ -+ /* Add network to the list */ -+ if (VIR_REALLOC_N(nets->objs, nets->count + 1) < 0) { -+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL); -+ VIR_FREE(network); -+ return NULL; -+ } -+ -+ nets->objs[nets->count] = network; -+ nets->count++; -+ -+ return network; -+ -+error: -+ virNetworkObjFree(network); -+ return NULL; -+} -+ -+void virNetworkLoadSuseNetworks(virNetworkObjListPtr nets) -+{ -+ DIR *dir = NULL; -+ struct dirent *de; -+ -+ dir = opendir("/sys/class/net"); -+ if (dir == NULL) -+ return; -+ -+ while ((de = readdir(dir))) { -+ if (virNetworkIsBridge(de->d_name)) { -+ virNetworkLoadSuseNet(nets, de->d_name); -+ } -+ } -+ closedir(dir); -+} -+ - int virNetworkLoadAllConfigs(virNetworkObjListPtr nets, - const char *configDir, - const char *autostartDir) -@@ -882,6 +1011,7 @@ int virNetworkLoadAllConfigs(virNetworkO - - closedir(dir); - -+ virNetworkLoadSuseNetworks(nets); - return 0; - } - -Index: libvirt-0.7.7/src/conf/network_conf.h -=================================================================== ---- libvirt-0.7.7.orig/src/conf/network_conf.h -+++ libvirt-0.7.7/src/conf/network_conf.h -@@ -94,6 +94,7 @@ struct _virNetworkObj { - unsigned int active : 1; - unsigned int autostart : 1; - unsigned int persistent : 1; -+ unsigned int suse : 1; - - virNetworkDefPtr def; /* The current definition */ - virNetworkDefPtr newDef; /* New definition to activate at shutdown */ -@@ -172,4 +173,7 @@ int virNetworkSetBridgeName(const virNet - void virNetworkObjLock(virNetworkObjPtr obj); - void virNetworkObjUnlock(virNetworkObjPtr obj); - -+int virNetworkIsBridge(const char *name); -+void virNetworkLoadSuseNetworks(virNetworkObjListPtr nets); -+ - #endif /* __NETWORK_CONF_H__ */ -Index: libvirt-0.7.7/src/network/bridge_driver.c -=================================================================== ---- libvirt-0.7.7.orig/src/network/bridge_driver.c -+++ libvirt-0.7.7/src/network/bridge_driver.c -@@ -811,7 +811,8 @@ networkReloadIptablesRules(struct networ - for (i = 0 ; i < driver->networks.count ; i++) { - virNetworkObjLock(driver->networks.objs[i]); - -- if (virNetworkObjIsActive(driver->networks.objs[i])) { -+ if (virNetworkObjIsActive(driver->networks.objs[i]) && -+ !(driver->networks.objs[i]->suse)) { - networkRemoveIptablesRules(driver, driver->networks.objs[i]); - if (!networkAddIptablesRules(driver, driver->networks.objs[i])) { - /* failed to add but already logged */ -@@ -1003,6 +1004,12 @@ static int networkShutdownNetworkDaemon( - unlink(stateFile); - VIR_FREE(stateFile); - -+ if (network->suse) { -+ VIR_WARN("Network '%s' is not under libvirt control and will not be " -+ "shutdown\n", network->def->name); -+ return -1; -+ } -+ - if (network->dnsmasqPid > 0) - kill(network->dnsmasqPid, SIGTERM); - -@@ -1098,11 +1105,25 @@ static int networkCloseNetwork(virConnec - return 0; - } - -+static void networkDriverSuseRefresh(struct network_driver *driver) { -+ int i = 0; -+ virNetworkObjPtr netObj; -+ -+ virNetworkLoadSuseNetworks(&driver->networks); -+ while (i < driver->networks.count) { -+ netObj = driver->networks.objs[i]; -+ if (netObj->suse && !virNetworkIsBridge(netObj->def->name)) -+ virNetworkRemoveInactive(&driver->networks, netObj); -+ i++; -+ } -+} -+ - static int networkNumNetworks(virConnectPtr conn) { - int nactive = 0, i; - struct network_driver *driver = conn->networkPrivateData; - - networkDriverLock(driver); -+ networkDriverSuseRefresh(driver); - for (i = 0 ; i < driver->networks.count ; i++) { - virNetworkObjLock(driver->networks.objs[i]); - if (virNetworkObjIsActive(driver->networks.objs[i])) -@@ -1119,6 +1140,7 @@ static int networkListNetworks(virConnec - int got = 0, i; - - networkDriverLock(driver); -+ networkDriverSuseRefresh(driver); - for (i = 0 ; i < driver->networks.count && got < nnames ; i++) { - virNetworkObjLock(driver->networks.objs[i]); - if (virNetworkObjIsActive(driver->networks.objs[i])) { -@@ -1499,6 +1521,13 @@ static int networkSetAutostart(virNetwor - goto cleanup; - } - -+ if (network->suse) { -+ networkReportError(VIR_ERR_INTERNAL_ERROR, -+ ": Network '%s' is not under libvirt control", -+ network->def->name); -+ return -1; -+ } -+ - autostart = (autostart != 0); - - if (network->autostart != autostart) { -Index: libvirt-0.7.7/src/libvirt_private.syms -=================================================================== ---- libvirt-0.7.7.orig/src/libvirt_private.syms -+++ libvirt-0.7.7/src/libvirt_private.syms -@@ -411,6 +411,8 @@ virNetworkSaveConfig; - virNetworkSetBridgeName; - virNetworkObjLock; - virNetworkObjUnlock; -+virNetworkLoadSuseNetworks; -+virNetworkIsBridge; - - - # nodeinfo.h diff --git a/xen-domctl-ver7.patch b/xen-domctl-ver7.patch index 2989bc1..af7f4c5 100644 --- a/xen-domctl-ver7.patch +++ b/xen-domctl-ver7.patch @@ -1,7 +1,7 @@ -Index: libvirt-0.7.6/src/xen/xen_hypervisor.c +Index: libvirt-0.8.0/src/xen/xen_hypervisor.c =================================================================== ---- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c -+++ libvirt-0.7.6/src/xen/xen_hypervisor.c +--- libvirt-0.8.0.orig/src/xen/xen_hypervisor.c ++++ libvirt-0.8.0/src/xen/xen_hypervisor.c @@ -230,11 +230,28 @@ struct xen_v2d6_getdomaininfo { }; typedef struct xen_v2d6_getdomaininfo xen_v2d6_getdomaininfo; @@ -251,11 +251,11 @@ Index: libvirt-0.7.6/src/xen/xen_hypervisor.c static int -@@ -2106,8 +2156,16 @@ xenHypervisorInit(void) +@@ -2105,8 +2155,16 @@ xenHypervisorInit(void) sys_interface_version = 7; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { dom_interface_version = 6; /* XEN_DOMCTL_INTERFACE_VERSION */ -- DEBUG0("Using hypervisor call v2, sys ver7 dom ver6\n"); +- DEBUG0("Using hypervisor call v2, sys ver7 dom ver6"); - goto done; + if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ + DEBUG0("Using hypervisor call v2, sys ver6 dom ver6\n"); diff --git a/xen-name-for-devid.patch b/xen-name-for-devid.patch index 86eb00d..0bafde2 100644 --- a/xen-name-for-devid.patch +++ b/xen-name-for-devid.patch @@ -13,11 +13,11 @@ Date: Wed Jan 27 16:11:41 2010 -0700 This approach allows removing a disk when domain is inactive. We obviously can't search xenstore when the domain is inactive. -Index: libvirt-0.7.7/src/xen/xend_internal.c +Index: libvirt-0.8.0/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.7.orig/src/xen/xend_internal.c -+++ libvirt-0.7.7/src/xen/xend_internal.c -@@ -93,6 +93,7 @@ xenDaemonFormatSxprOnePCI(virConnectPtr +--- libvirt-0.8.0.orig/src/xen/xend_internal.c ++++ libvirt-0.8.0/src/xen/xend_internal.c +@@ -91,6 +91,7 @@ xenDaemonFormatSxprOnePCI(virDomainHostd static int virDomainXMLDevID(virDomainPtr domain, @@ -25,7 +25,7 @@ Index: libvirt-0.7.7/src/xen/xend_internal.c virDomainDeviceDefPtr dev, char *class, char *ref, -@@ -4212,7 +4213,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr +@@ -4161,7 +4162,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr sexpr = virBufferContentAndReset(&buf); @@ -34,7 +34,16 @@ Index: libvirt-0.7.7/src/xen/xend_internal.c /* device doesn't exist, define it */ ret = xend_op(domain->conn, domain->name, "op", "device_create", "config", sexpr, NULL); -@@ -4306,7 +4307,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr +@@ -4274,7 +4275,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr + + sexpr = virBufferContentAndReset(&buf); + +- if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) { ++ if (virDomainXMLDevID(domain, def, dev, class, ref, sizeof(ref))) { + virXendError(VIR_ERR_OPERATION_INVALID, "%s", + _("requested device does not exist")); + goto cleanup; +@@ -4366,7 +4367,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr def, xml, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; @@ -43,7 +52,7 @@ Index: libvirt-0.7.7/src/xen/xend_internal.c goto cleanup; if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { -@@ -6060,6 +6061,7 @@ error: +@@ -6114,6 +6115,7 @@ error: */ static int virDomainXMLDevID(virDomainPtr domain, @@ -51,7 +60,7 @@ Index: libvirt-0.7.7/src/xen/xend_internal.c virDomainDeviceDefPtr dev, char *class, char *ref, -@@ -6068,27 +6070,33 @@ virDomainXMLDevID(virDomainPtr domain, +@@ -6122,27 +6124,33 @@ virDomainXMLDevID(virDomainPtr domain, xenUnifiedPrivatePtr priv = domain->conn->privateData; char *xref; char *tmp; diff --git a/xen-pv-cdrom.patch b/xen-pv-cdrom.patch index 29a4f90..f3e89cf 100644 --- a/xen-pv-cdrom.patch +++ b/xen-pv-cdrom.patch @@ -1,8 +1,8 @@ -Index: libvirt-0.7.7/src/xen/xend_internal.c +Index: libvirt-0.8.0/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.7.orig/src/xen/xend_internal.c -+++ libvirt-0.7.7/src/xen/xend_internal.c -@@ -5475,7 +5475,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co +--- libvirt-0.8.0.orig/src/xen/xend_internal.c ++++ libvirt-0.8.0/src/xen/xend_internal.c +@@ -5524,7 +5524,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { virBufferVSprintf(buf, "(dev '%s:cdrom')", def->dst); } else { diff --git a/xen-tap2-support.patch b/xen-tap2-support.patch index 696c951..82c52f9 100644 --- a/xen-tap2-support.patch +++ b/xen-tap2-support.patch @@ -1,8 +1,8 @@ -Index: libvirt-0.7.6/src/xen/xend_internal.c +Index: libvirt-0.8.0/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.6.orig/src/xen/xend_internal.c -+++ libvirt-0.7.6/src/xen/xend_internal.c -@@ -1606,7 +1606,8 @@ xenDaemonParseSxprDisks(virConnectPtr co +--- libvirt-0.8.0.orig/src/xen/xend_internal.c ++++ libvirt-0.8.0/src/xen/xend_internal.c +@@ -1593,7 +1593,8 @@ xenDaemonParseSxprDisks(virDomainDefPtr but blktap disks ended up in a differently named (device (tap ....)) block.... */ if (sexpr_lookup(node, "device/vbd") || @@ -12,7 +12,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c char *offset; const char *src = NULL; const char *dst = NULL; -@@ -1617,10 +1618,14 @@ xenDaemonParseSxprDisks(virConnectPtr co +@@ -1604,10 +1605,14 @@ xenDaemonParseSxprDisks(virDomainDefPtr src = sexpr_node(node, "device/vbd/uname"); dst = sexpr_node(node, "device/vbd/dev"); mode = sexpr_node(node, "device/vbd/mode"); diff --git a/xend-disk-order.patch b/xend-disk-order.patch index 8779e87..4c47ffe 100644 --- a/xend-disk-order.patch +++ b/xend-disk-order.patch @@ -1,8 +1,8 @@ -Index: libvirt-0.7.6/src/xen/xend_internal.c +Index: libvirt-0.8.0/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.6.orig/src/xen/xend_internal.c -+++ libvirt-0.7.6/src/xen/xend_internal.c -@@ -1612,20 +1612,24 @@ xenDaemonParseSxprDisks(virConnectPtr co +--- libvirt-0.8.0.orig/src/xen/xend_internal.c ++++ libvirt-0.8.0/src/xen/xend_internal.c +@@ -1599,20 +1599,24 @@ xenDaemonParseSxprDisks(virDomainDefPtr const char *src = NULL; const char *dst = NULL; const char *mode = NULL; @@ -27,13 +27,11 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c } if (VIR_ALLOC(disk) < 0) -@@ -1749,8 +1753,13 @@ xenDaemonParseSxprDisks(virConnectPtr co - +@@ -1737,7 +1741,12 @@ xenDaemonParseSxprDisks(virDomainDefPtr if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) goto no_memory; -- + - def->disks[def->ndisks++] = disk; -+ + if (bootable == 1 && def->ndisks > 0) { + memmove(def->disks + 1, def->disks, sizeof(def->disks) * def->ndisks); + def->disks[0] = disk;