[PATCH 22/66] vbox: Rewrite vboxDomainIsPersistent

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

 



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

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 89095f5..d29539d 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2324,3 +2324,22 @@ int vboxDomainIsActive(virDomainPtr dom)
 
     return ret;
 }
+
+int vboxDomainIsPersistent(virDomainPtr dom)
+{
+    /* All domains are persistent.  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 = 1;
+
+ cleanup:
+    VBOX_RELEASE(machine);
+    vboxIIDUnalloc(&iid);
+    return ret;
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 2971af2..1bec175 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -932,32 +932,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,
     return result;
 }
 
-static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED)
-{
-    /* All domains are persistent.  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 = 1;
-
- cleanup:
-    VBOX_RELEASE(machine);
-    vboxIIDUnalloc(&iid);
-    return ret;
-}
-
-
 static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
 {
     /* VBox domains never have a persistent state that differs from
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 6fc97ed..72b29e2 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -412,6 +412,7 @@ int vboxDomainCreate(virDomainPtr dom);
 virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
                                  unsigned int flags);
 int vboxDomainIsActive(virDomainPtr dom);
+int vboxDomainIsPersistent(virDomainPtr dom);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
1.7.9.5

--
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]