提交 c9537d13 编写于 作者: T Taowei 提交者: Michal Privoznik

vbox: Rewrite vboxDomainIsPersistent

上级 fa2f9abc
......@@ -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;
}
......@@ -933,32 +933,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
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册