]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Implementations of virDomainIsUpdated for drivers except qemu
authorOsier Yang <jyang@redhat.com>
Wed, 24 Nov 2010 07:43:15 +0000 (15:43 +0800)
committerEric Blake <eblake@redhat.com>
Wed, 24 Nov 2010 18:22:30 +0000 (11:22 -0700)
Except LXC and UML driver, implementations of all other drivers
simply return 0, 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
src/lxc/lxc_driver.c
src/opennebula/one_driver.c
src/openvz/openvz_driver.c
src/phyp/phyp_driver.c
src/test/test_driver.c
src/uml/uml_driver.c
src/vbox/vbox_tmpl.c
src/xen/xen_driver.c
src/xenapi/xenapi_driver.c

index 5c04596db43548db08ecb475642532a62577c92c..8ea6219f86a6a975df3864181b1b38351f8e3348 100644 (file)
@@ -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 */
index 886286b526f752d1e6638dad832d2cb287d2edcc..eb580868382e0a17214061cd58a372f501972c03 100644 (file)
@@ -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 */
index 4fe7f9bf8cfac30c6046230ba54366c17e08043a..a2d9ab3bb02992c63d5c42024b846db1dde7fcbd 100644 (file)
@@ -106,6 +106,10 @@ static int oneIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
     return 0;
 }
 
+static int oneIsUpdated(virDomainPtr 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 */
index 5089e37f3f3a6701edc2b8d20e46142837093afa..807bb7c09b2fba22448d855b5900be794866c9dc 100644 (file)
@@ -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 */
index 24b426e92379022696245ec020d90a668858c43d..350889136a23366faf1dca544b11b60fef3ef132 100644 (file)
@@ -1277,6 +1277,11 @@ phypIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
     return 1;
 }
 
+static int
+phypIsUpdated(virDomainPtr 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 */
index b6838c287ba01d3579bbe4c924a6f16a1dc5a2de..ddff160e2e54e4191a7fcd8b0c55ae45d7cc033a 100644 (file)
@@ -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 */
index 6c28c7660e3607255f0e2012a8b3aea9f0961322..f42a6675d142270046fb07cabb5c0c93ccbeed5d 100644 (file)
@@ -1236,6 +1236,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 +2268,7 @@ static virDriver umlDriver = {
     umlIsSecure, /* isSecure */
     umlDomainIsActive, /* domainIsActive */
     umlDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    umlDomainIsUpdated, /* domainIsUpdated */
     NULL, /* cpuCompare */
     NULL, /* cpuBaseline */
     NULL, /* domainGetJobInfo */
index 0a7a247c18debf5241b51f99170c56d9339a5ff9..ada71b497997066d01856cb9e84396cd20ac9d89 100644 (file)
@@ -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 */
index 959cc7d814adba3a9f469b3a6ebd6a94bd9abaf5..4c11b11d19e4a02bac86a4dc701c4cf07b8af38c 100644 (file)
@@ -740,7 +740,7 @@ xenUnifiedDomainIsActive(virDomainPtr dom)
 }
 
 static int
-xenUnifiedDomainisPersistent(virDomainPtr dom)
+xenUnifiedDomainIsPersistent(virDomainPtr dom)
 {
     GET_PRIVATE(dom->conn);
     virDomainPtr currdom = NULL;
@@ -790,6 +790,12 @@ done:
     return ret;
 }
 
+static int
+xenUnifiedDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
 static int
 xenUnifiedDomainSuspend (virDomainPtr dom)
 {
@@ -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 */
index dec2d25d129258416b704a838f2a9c45344dba0a..6fff276806327e97f7afd7fd2d3d2399c062ffd6 100644 (file)
@@ -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 */