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

[libvirt] [PATCH 24/29] vbox: Rewrite vboxDomainIsUpdated



---
 src/vbox/vbox_common.c        |   19 +++++++++++++++++++
 src/vbox/vbox_tmpl.c          |   25 -------------------------
 src/vbox/vbox_uniformed_api.h |    1 +
 3 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 3aca1b8..cc25633 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2335,3 +2335,22 @@ int vboxDomainIsPersistent(virDomainPtr dom)
     vboxIIDUnalloc(&iid);
     return ret;
 }
+
+int vboxDomainIsUpdated(virDomainPtr dom)
+{
+    /* VBox domains never have a persistent state that differs from
+     * current state.  However, we do want to check for existence.  */
+    VBOX_OBJECT_CHECK(dom->conn, int, -1);
+    vboxIIDUnion iid;
+    IMachine *machine = NULL;
+
+    if (openSessionForMachine(data, dom->uuid, &iid, &machine, false) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    VBOX_RELEASE(machine);
+    vboxIIDUnalloc(&iid);
+    return ret;
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index dfa9dcf..96df49c 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -916,31 +916,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,
     return result;
 }
 
-static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
-{
-    /* VBox domains never have a persistent state that differs from
-     * current state.  However, we do want to check for existence.  */
-    VBOX_OBJECT_CHECK(dom->conn, int, -1);
-    vboxIID iid = VBOX_IID_INITIALIZER;
-    IMachine *machine = NULL;
-    nsresult rc;
-
-    vboxIIDFromUUID(&iid, dom->uuid);
-    rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
-    if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_NO_DOMAIN, "%s",
-                       _("no domain with matching UUID"));
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VBOX_RELEASE(machine);
-    vboxIIDUnalloc(&iid);
-    return ret;
-}
-
 static int vboxDomainSuspend(virDomainPtr dom)
 {
     VBOX_OBJECT_CHECK(dom->conn, int, -1);
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 1df6e76..8397d1b 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -430,6 +430,7 @@ virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
                                  unsigned int flags);
 int vboxDomainIsActive(virDomainPtr dom);
 int vboxDomainIsPersistent(virDomainPtr dom);
+int vboxDomainIsUpdated(virDomainPtr dom);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
1.7.9.5


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