[libvirt] [PATCH 2/9] Stub out internal driver entry points for job processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The internal glue layer for the new pubic API

* src/driver.h: Define internal driver API contract
* src/libvirt.c, src/libvirt_public.syms: Wire up public
  API to internal 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 new entry point
---
 src/driver.h                |    5 ++++
 src/esx/esx_driver.c        |    1 +
 src/libvirt.c               |   48 +++++++++++++++++++++++++++++++++++++++++++
 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, 65 insertions(+), 0 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index fe21ea3..8c5d97d 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -373,6 +373,10 @@ typedef char *
                          unsigned int ncpus,
                          unsigned int flags);
 
+typedef int
+    (*virDrvDomainGetJobInfo)(virDomainPtr domain,
+                              virDomainJobInfoPtr info);
+
 /**
  * _virDriver:
  *
@@ -464,6 +468,7 @@ struct _virDriver {
     virDrvDomainIsPersistent   domainIsPersistent;
     virDrvCPUCompare            cpuCompare;
     virDrvCPUBaseline           cpuBaseline;
+    virDrvDomainGetJobInfo     domainGetJobInfo;
 };
 
 typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e125a09..226a6a0 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3404,6 +3404,7 @@ static virDriver esxDriver = {
     esxDomainIsPersistent,           /* domainIsPersistent */
     NULL,                            /* cpuCompare */
     NULL,                            /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 0e5f4a2..46e1221 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -11147,3 +11147,51 @@ error:
     virDispatchError(conn);
     return NULL;
 }
+
+
+/**
+ * virDomainGetJobInfo:
+ * @domain: a domain object
+ * @info: pointer to a virDomainJobInfo structure allocated by the user
+ *
+ * Extract information about progress of a background job on a domain.
+ * Will return an error if the domain is not active.
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
+{
+    virConnectPtr conn;
+    DEBUG("domain=%p, info=%p", domain, info);
+
+    virResetLastError();
+
+    if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virDispatchError(NULL);
+        return (-1);
+    }
+    if (info == NULL) {
+        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        goto error;
+    }
+
+    memset(info, 0, sizeof(virDomainJobInfo));
+
+    conn = domain->conn;
+
+    if (conn->driver->domainGetJobInfo) {
+        int ret;
+        ret = conn->driver->domainGetJobInfo (domain, info);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+    virDispatchError(domain->conn);
+    return -1;
+}
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 152aae4..6997b7b 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -354,6 +354,7 @@ LIBVIRT_0.7.7 {
         virDomainAttachDeviceFlags;
         virDomainDetachDeviceFlags;
         virConnectBaselineCPU;
+        virDomainGetJobInfo;
 } 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 f7e9c7d..2613bd5 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2451,6 +2451,7 @@ static virDriver lxcDriver = {
     lxcDomainIsPersistent,
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 static virStateDriver lxcStateDriver = {
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 57825d5..5ffc5eb 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -786,6 +786,7 @@ static virDriver oneDriver = {
     NULL, /* domainIsPersistent */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 static virStateDriver oneStateDriver = {
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 68d0398..071407f 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1538,6 +1538,7 @@ static virDriver openvzDriver = {
     openvzDomainIsPersistent,
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 int openvzRegister(void) {
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 1e8ed30..3dbf16a 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1654,6 +1654,7 @@ virDriver phypDriver = {
     NULL,                       /* domainIsPersistent */
     NULL,                       /* cpuCompare */
     NULL,                       /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8766ca2..a6dc4f9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8746,6 +8746,7 @@ static virDriver qemuDriver = {
     qemuDomainIsPersistent,
     qemuCPUCompare, /* cpuCompare */
     qemuCPUBaseline, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 13534ce..81016fc 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -9012,6 +9012,7 @@ static virDriver remote_driver = {
     remoteDomainIsPersistent, /* domainIsPersistent */
     remoteCPUCompare, /* cpuCompare */
     remoteCPUBaseline, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index e4720ef..e0c4f89 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5243,6 +5243,7 @@ static virDriver testDriver = {
     testDomainIsPersistent, /* domainIsPersistent */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 10268db..e2be5b3 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1920,6 +1920,7 @@ static virDriver umlDriver = {
     umlDomainIsPersistent,
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 8a9af52..b81f4d7 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -7063,6 +7063,7 @@ virDriver NAME(Driver) = {
     vboxDomainIsPersistent,
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 700682c..3e796d3 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1904,6 +1904,7 @@ static virDriver xenUnifiedDriver = {
     xenUnifiedDomainisPersistent,
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
+    NULL, /* domainGetJobInfo */
 };
 
 /**
-- 
1.6.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]