On Thu, Feb 18, 2010 at 03:56:12PM +0000, Daniel P. Berrange wrote:
This provides the internal glue for the driver API
* src/driver.h: Internal API contract
* src/libvirt.c, src/libvirt_public.syms: Connect public API
to driver API
* src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
src/qemu/qemu_driver.c, src/remote/remote_driver.c,
src/test/test_driver.c src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
src/xen/xen_driver.c: Stub out entry points
---
src/driver.h | 4 +++
src/esx/esx_driver.c | 1 +
src/libvirt.c | 47 +++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 1 +
src/lxc/lxc_driver.c | 1 +
src/opennebula/one_driver.c | 1 +
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 1 +
src/qemu/qemu_driver.c | 1 +
src/remote/remote_driver.c | 1 +
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 1 +
src/vbox/vbox_tmpl.c | 1 +
src/xen/xen_driver.c | 1 +
14 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/src/driver.h b/src/driver.h
index 8c5d97d..7b7dfea 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -377,6 +377,9 @@ typedef int
(*virDrvDomainGetJobInfo)(virDomainPtr domain,
virDomainJobInfoPtr info);
+typedef int
+ (*virDrvDomainAbortJob)(virDomainPtr domain);
+
/**
* _virDriver:
*
@@ -469,6 +472,7 @@ struct _virDriver {
virDrvCPUCompare cpuCompare;
virDrvCPUBaseline cpuBaseline;
virDrvDomainGetJobInfo domainGetJobInfo;
+ virDrvDomainAbortJob domainAbortJob;
};
typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 226a6a0..fc2e68c 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3405,6 +3405,7 @@ static virDriver esxDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
+ NULL, /* domainAbortJob */
};
diff --git a/src/libvirt.c b/src/libvirt.c
index 46e1221..20bf3a9 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -11195,3 +11195,50 @@ error:
virDispatchError(domain->conn);
return -1;
}
+
+
+/**
+ * virDomainAbortJob:
+ * @domain: a domain object
+ *
+ * Requests that the current background job be aborted at the
+ * soonest opportunity. This will block until the job has
+ * either completed, or aborted.
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virDomainAbortJob(virDomainPtr domain)
+{
+ virConnectPtr conn;
+
+ DEBUG("domain=%p", domain);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virDispatchError(NULL);
+ return (-1);
+ }
+
+ conn = domain->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->driver->domainAbortJob) {
+ int ret;
+ ret = conn->driver->domainAbortJob(domain);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return -1;
+}
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 6997b7b..64e7505 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -355,6 +355,7 @@ LIBVIRT_0.7.7 {
virDomainDetachDeviceFlags;
virConnectBaselineCPU;
virDomainGetJobInfo;
+ virDomainAbortJob;
} LIBVIRT_0.7.5;
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/