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; # .... define new API here using predicted next version number .... diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 2613bd5..35c8659 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2452,6 +2452,7 @@ static virDriver lxcDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; static virStateDriver lxcStateDriver = { diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c index 5ffc5eb..9fc0ada 100644 --- a/src/opennebula/one_driver.c +++ b/src/opennebula/one_driver.c @@ -787,6 +787,7 @@ static virDriver oneDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; static virStateDriver oneStateDriver = { diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 071407f..dcf4999 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1539,6 +1539,7 @@ static virDriver openvzDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; int openvzRegister(void) { diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 3dbf16a..8ed8f54 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1655,6 +1655,7 @@ virDriver phypDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; int diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b245eb2..7641fd7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8891,6 +8891,7 @@ static virDriver qemuDriver = { qemuCPUCompare, /* cpuCompare */ qemuCPUBaseline, /* cpuBaseline */ qemuDomainGetJobInfo, /* domainGetJobInfo */ + NULL, /* domainFinishJob */ }; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 82a6990..82a82f4 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -9053,6 +9053,7 @@ static virDriver remote_driver = { remoteCPUCompare, /* cpuCompare */ remoteCPUBaseline, /* cpuBaseline */ remoteDomainGetJobInfo, /* domainGetJobInfo */ + NULL, /* domainFinishJob */ }; static virNetworkDriver network_driver = { diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e0c4f89..5807288 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5244,6 +5244,7 @@ static virDriver testDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; static virNetworkDriver testNetworkDriver = { diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index e2be5b3..bbea429 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1921,6 +1921,7 @@ static virDriver umlDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index b81f4d7..41e5d3a 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -7064,6 +7064,7 @@ virDriver NAME(Driver) = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; virNetworkDriver NAME(NetworkDriver) = { diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 3e796d3..0eb3927 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1905,6 +1905,7 @@ static virDriver xenUnifiedDriver = { NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ + NULL, /* domainAbortJob */ }; /** -- 1.6.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list