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

[libvirt] [PATCH] Implementations of virDomainIsUpdated for drivers except qemu



Except LXC and UML driver, implementations of all other drivers
return 0 simpley, because these drivers doesn't have config both
in memory and on disk, no need to track if the domain of these
drivers updated or not.

Rename "xenUnifiedDomainisPersistent" to "xenUnifiedDomainIsPersistent"

* esx/esx_driver.c
* lxc/lxc_driver.c
* opennebula/one_driver.c
* openvz/openvz_driver.c
* phyp/phyp_driver.c
* test/test_driver.c
* uml/uml_driver.c
* vbox/vbox_tmpl.c
* xen/xen_driver.c
* xenapi/xenapi_driver.c
---
 src/esx/esx_driver.c        |    8 ++++++--
 src/lxc/lxc_driver.c        |   25 ++++++++++++++++++++++++-
 src/opennebula/one_driver.c |    6 +++++-
 src/openvz/openvz_driver.c  |    6 +++++-
 src/phyp/phyp_driver.c      |    7 ++++++-
 src/test/test_driver.c      |    7 ++++++-
 src/uml/uml_driver.c        |   24 +++++++++++++++++++++---
 src/vbox/vbox_tmpl.c        |    6 +++++-
 src/xen/xen_driver.c        |   12 +++++++++---
 src/xenapi/xenapi_driver.c  |    8 +++++++-
 10 files changed, 94 insertions(+), 15 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5c04596..8ea6219 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3765,7 +3765,11 @@ esxDomainIsPersistent(virDomainPtr domain ATTRIBUTE_UNUSED)
     return 1;
 }

-
+static int
+esxDomainIsUpdated(virDomainPtr domain ATTRIBUTE_UNUSED)
+{
+    return 0;
+}

 static virDomainSnapshotPtr
 esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
@@ -4360,7 +4364,7 @@ static virDriver esxDriver = {
     esxIsSecure,                     /* isSecure */
     esxDomainIsActive,               /* domainIsActive */
     esxDomainIsPersistent,           /* domainIsPersistent */
-    NULL,                            /* domainIsUpdated */
+    esxDomainIsUpdated,              /* domainIsUpdated */
     NULL,                            /* cpuCompare */
     NULL,                            /* cpuBaseline */
     NULL,                            /* domainGetJobInfo */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 886286b..eb58086 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -325,6 +325,29 @@ cleanup:
     return ret;
 }

+static int lxcDomainIsUpdated(virDomainPtr dom)
+{
+    lxc_driver_t *driver = dom->conn->privateData;
+    virDomainObjPtr obj;
+    int ret = -1;
+
+    lxcDriverLock(driver);
+    obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+    lxcDriverUnlock(driver);
+    if (!obj) {
+        char uuidstr[VIR_UUID_STRING_BUFLEN];
+        virUUIDFormat(dom->uuid, uuidstr);
+        lxcError(VIR_ERR_NO_DOMAIN,
+                 _("No domain with matching uuid '%s'"), uuidstr);
+        goto cleanup;
+    }
+    ret = obj->updated;
+
+cleanup:
+    if (obj)
+        virDomainObjUnlock(obj);
+    return ret;
+}

 static int lxcListDomains(virConnectPtr conn, int *ids, int nids) {
     lxc_driver_t *driver = conn->privateData;
@@ -2882,7 +2905,7 @@ static virDriver lxcDriver = {
     lxcIsSecure, /* isSecure */
     lxcDomainIsActive, /* domainIsActive */
     lxcDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    lxcDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 4fe7f9b..c31f132 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -106,6 +106,10 @@ static int oneIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
     return 0;
 }

+static int oneIsUpdated(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
+    return 0;
+}

 static virDomainPtr oneDomainLookupByID(virConnectPtr conn,
                                         int id)
@@ -800,7 +804,7 @@ static virDriver oneDriver = {
     oneIsSecure, /* isSecure */
     NULL, /* domainIsActive */
     NULL, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    oneIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 5089e37..807bb7c 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -459,6 +459,10 @@ cleanup:
     return ret;
 }

+static int openvzDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+    return 0;
+}

 static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
     struct openvz_driver *driver = dom->conn->privateData;
@@ -1670,7 +1674,7 @@ static virDriver openvzDriver = {
     openvzIsSecure,
     openvzDomainIsActive,
     openvzDomainIsPersistent,
-    NULL, /* domainIsUpdated */
+    openvzDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 24b426e..08faa9b 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1277,6 +1277,11 @@ phypIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
     return 1;
 }

+static int
+phypIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
+    return 0;
+}

 /* return the lpar_id given a name and a managed system name */
 static int
@@ -4021,7 +4026,7 @@ static virDriver phypDriver = {
     phypIsSecure,               /* isSecure */
     NULL,                       /* domainIsActive */
     NULL,                       /* domainIsPersistent */
-    NULL,                       /* domainIsUpdated */
+    phypIsUpdated,              /* domainIsUpdated */
     NULL,                       /* cpuCompare */
     NULL,                       /* cpuBaseline */
     NULL,                       /* domainGetJobInfo */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b6838c2..ddff160 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1295,6 +1295,11 @@ cleanup:
     return ret;
 }

+static int testDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
 static virDomainPtr
 testDomainCreateXML(virConnectPtr conn, const char *xml,
                       unsigned int flags)
@@ -5413,7 +5418,7 @@ static virDriver testDriver = {
     testIsSecure, /* isEncrypted */
     testDomainIsActive, /* domainIsActive */
     testDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    testDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 6c28c76..26b6b50 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1213,8 +1213,6 @@ cleanup:
         virDomainObjUnlock(obj);
     return ret;
 }
-
-
 static int umlDomainIsPersistent(virDomainPtr dom)
 {
     struct uml_driver *driver = dom->conn->privateData;
@@ -1236,6 +1234,26 @@ cleanup:
     return ret;
 }

+static int umlDomainIsUpdated(virDomainPtr dom)
+{
+    struct uml_driver *driver = dom->conn->privateData;
+    virDomainObjPtr obj;
+    int ret = -1;
+
+    umlDriverLock(driver);
+    obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+    umlDriverUnlock(driver);
+    if (!obj) {
+        umlReportError(VIR_ERR_NO_DOMAIN, NULL);
+        goto cleanup;
+    }
+    ret = obj->updated;
+
+cleanup:
+    if (obj)
+        virDomainObjUnlock(obj);
+    return ret;
+}

 static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
     struct uml_driver *driver = conn->privateData;
@@ -2248,7 +2266,7 @@ static virDriver umlDriver = {
     umlIsSecure, /* isSecure */
     umlDomainIsActive, /* domainIsActive */
     umlDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    umlDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0a7a247..ada71b4 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1347,6 +1347,10 @@ static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) {
 }


+static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) {
+    return 0;
+}
+
 static int vboxDomainSuspend(virDomainPtr dom) {
     VBOX_OBJECT_CHECK(dom->conn, int, -1);
     IMachine *machine    = NULL;
@@ -8451,7 +8455,7 @@ virDriver NAME(Driver) = {
     vboxIsSecure, /* isSecure */
     vboxDomainIsActive, /* domainIsActive */
     vboxDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    vboxDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 959cc7d..4c11b11 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -740,7 +740,7 @@ xenUnifiedDomainIsActive(virDomainPtr dom)
 }

 static int
-xenUnifiedDomainisPersistent(virDomainPtr dom)
+xenUnifiedDomainIsPersistent(virDomainPtr dom)
 {
     GET_PRIVATE(dom->conn);
     virDomainPtr currdom = NULL;
@@ -791,6 +791,12 @@ done:
 }

 static int
+xenUnifiedDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+static int
 xenUnifiedDomainSuspend (virDomainPtr dom)
 {
     GET_PRIVATE(dom->conn);
@@ -2069,8 +2075,8 @@ static virDriver xenUnifiedDriver = {
     xenUnifiedIsEncrypted, /* isEncrypted */
     xenUnifiedIsSecure, /* isSecure */
     xenUnifiedDomainIsActive, /* domainIsActive */
-    xenUnifiedDomainisPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    xenUnifiedDomainIsPersistent, /* domainIsPersistent */
+    xenUnifiedDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index dec2d25..6fff276 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1745,6 +1745,12 @@ xenapiNodeGetFreeMemory (virConnectPtr conn)
     return freeMem;
 }

+static int
+xenapiDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
 /*
  * xenapiNodeGetCellsFreeMemory
  *
@@ -1847,7 +1853,7 @@ static virDriver xenapiDriver = {
     NULL, /* isSecure */
     NULL, /* domainIsActive */
     NULL, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    xenapiDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
--
1.7.3.2


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