[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               |   51 +++++++++++++++++++++++++++++++++++++++++++
 src/libvirt_public.syms     |    5 ++++
 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, 72 insertions(+), 0 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index c7e4fbf..8f8592a 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -360,6 +360,10 @@ typedef int
                         const char *cpu,
                         unsigned int flags);
 
+typedef int
+    (*virDrvDomainGetJobInfo)(virDomainPtr domain,
+                              virDomainJobInfoPtr info);
+
 /**
  * _virDriver:
  *
@@ -448,6 +452,7 @@ struct _virDriver {
     virDrvDomainIsActive       domainIsActive;
     virDrvDomainIsPersistent   domainIsPersistent;
     virDrvCPUCompare            cpuCompare;
+    virDrvDomainGetJobInfo     domainGetJobInfo;
 };
 
 typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index fc254c6..e7312a7 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3401,6 +3401,7 @@ static virDriver esxDriver = {
     esxDomainIsActive,               /* domainIsActive */
     esxDomainIsPersistent,           /* domainIsPersistent */
     NULL,                            /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 8a9ee20..a5dedf7 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -10980,3 +10980,54 @@ error:
     virDispatchError(conn);
     return VIR_CPU_COMPARE_ERROR;
 }
+
+
+
+/**
+ * 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 0521158..7afdc05 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -349,4 +349,9 @@ LIBVIRT_0.7.5 {
         virDomainMemoryStats;
 } LIBVIRT_0.7.3;
 
+LIBVIRT_0.7.7 {
+    global:
+        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 d78f7f7..983cab7 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2456,6 +2456,7 @@ static virDriver lxcDriver = {
     lxcDomainIsActive,
     lxcDomainIsPersistent,
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 static virStateDriver lxcStateDriver = {
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index ad7faca..2c1dd52 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -783,6 +783,7 @@ static virDriver oneDriver = {
     NULL, /* domainIsActive */
     NULL, /* domainIsPersistent */
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 static virStateDriver oneStateDriver = {
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 196fd8c..a7bf72d 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1535,6 +1535,7 @@ static virDriver openvzDriver = {
     openvzDomainIsActive,
     openvzDomainIsPersistent,
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 int openvzRegister(void) {
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index bd5cfc7..f723f03 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1651,6 +1651,7 @@ virDriver phypDriver = {
     NULL,                       /* domainIsActive */
     NULL,                       /* domainIsPersistent */
     NULL,                       /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1e796ef..1e3a8b7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8606,6 +8606,7 @@ static virDriver qemuDriver = {
     qemuDomainIsActive,
     qemuDomainIsPersistent,
     qemuCPUCompare, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index d6f5fce..692c83c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8923,6 +8923,7 @@ static virDriver remote_driver = {
     remoteDomainIsActive, /* domainIsActive */
     remoteDomainIsPersistent, /* domainIsPersistent */
     remoteCPUCompare, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2122a1b..d23fb68 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5238,6 +5238,7 @@ static virDriver testDriver = {
     testDomainIsActive, /* domainIsActive */
     testDomainIsPersistent, /* domainIsPersistent */
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 static virNetworkDriver testNetworkDriver = {
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 31cea5c..de42e26 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1924,6 +1924,7 @@ static virDriver umlDriver = {
     umlDomainIsActive,
     umlDomainIsPersistent,
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index e40c848..5abb9f2 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -7035,6 +7035,7 @@ virDriver NAME(Driver) = {
     vboxDomainIsActive,
     vboxDomainIsPersistent,
     NULL, /* cpuCompare */
+    NULL, /* domainGetJobInfo */
 };
 
 virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 72f56ae..71fc9e9 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1864,6 +1864,7 @@ static virDriver xenUnifiedDriver = {
     xenUnifiedDomainIsActive,
     xenUnifiedDomainisPersistent,
     NULL, /* cpuCompare */
+    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]