提交 75f4a7b2 编写于 作者: P Peter Krempa

qemu: Move, rename and export qemuDomObjFromDomain

Move it to qemu_domain.c and rename it to qemuDomainObjFromDomain. This
will allow reusing it after splitting out checkpoint code from
qemu_driver.c.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 44bf3bf3
...@@ -119,6 +119,37 @@ VIR_ENUM_IMPL(qemuDomainNamespace, ...@@ -119,6 +119,37 @@ VIR_ENUM_IMPL(qemuDomainNamespace,
"mount", "mount",
); );
/**
* qemuDomainObjFromDomain:
* @domain: Domain pointer that has to be looked up
*
* This function looks up @domain and returns the appropriate virDomainObjPtr
* that has to be released by calling virDomainObjEndAPI().
*
* Returns the domain object with incremented reference counter which is locked
* on success, NULL otherwise.
*/
virDomainObjPtr
qemuDomainObjFromDomain(virDomainPtr domain)
{
virDomainObjPtr vm;
virQEMUDriverPtr driver = domain->conn->privateData;
char uuidstr[VIR_UUID_STRING_BUFLEN];
vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
virUUIDFormat(domain->uuid, uuidstr);
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s' (%s)"),
uuidstr, domain->name);
return NULL;
}
return vm;
}
struct _qemuDomainLogContext { struct _qemuDomainLogContext {
virObject parent; virObject parent;
......
...@@ -593,6 +593,7 @@ struct _qemuDomainXmlNsDef { ...@@ -593,6 +593,7 @@ struct _qemuDomainXmlNsDef {
char **capsdel; char **capsdel;
}; };
virDomainObjPtr qemuDomainObjFromDomain(virDomainPtr domain);
qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm); qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册