Wire up internal entry points for virDomainAbortJob API

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
This commit is contained in:
Daniel P. Berrange 2010-02-04 16:16:35 +00:00
parent 4fee63fe1c
commit 0d8aa35f60
14 changed files with 63 additions and 0 deletions

View File

@ -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

View File

@ -3405,6 +3405,7 @@ static virDriver esxDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};

View File

@ -11207,3 +11207,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;
}

View File

@ -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 ....

View File

@ -2452,6 +2452,7 @@ static virDriver lxcDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
static virStateDriver lxcStateDriver = {

View File

@ -787,6 +787,7 @@ static virDriver oneDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
static virStateDriver oneStateDriver = {

View File

@ -1539,6 +1539,7 @@ static virDriver openvzDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
int openvzRegister(void) {

View File

@ -1655,6 +1655,7 @@ virDriver phypDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
int

View File

@ -8918,6 +8918,7 @@ static virDriver qemuDriver = {
qemuCPUCompare, /* cpuCompare */
qemuCPUBaseline, /* cpuBaseline */
qemuDomainGetJobInfo, /* domainGetJobInfo */
NULL, /* domainFinishJob */
};

View File

@ -9101,6 +9101,7 @@ static virDriver remote_driver = {
remoteCPUCompare, /* cpuCompare */
remoteCPUBaseline, /* cpuBaseline */
remoteDomainGetJobInfo, /* domainGetJobInfo */
NULL, /* domainFinishJob */
};
static virNetworkDriver network_driver = {

View File

@ -5244,6 +5244,7 @@ static virDriver testDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
static virNetworkDriver testNetworkDriver = {

View File

@ -1921,6 +1921,7 @@ static virDriver umlDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};

View File

@ -7064,6 +7064,7 @@ virDriver NAME(Driver) = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
virNetworkDriver NAME(NetworkDriver) = {

View File

@ -1905,6 +1905,7 @@ static virDriver xenUnifiedDriver = {
NULL, /* cpuCompare */
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
};
/**