提交 60893841 编写于 作者: J John Ferlan

test: Use virDomainObjListFindByIDRef

Rather than using virDomainObjListFindByID, let's be more consistent
and return a reffed and locked object. Since we're using the Ref API,
use virDomainObjEndAPI on @dom and not just virObjectUnlock.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
上级 ea90e0fb
......@@ -1720,16 +1720,14 @@ static virDomainPtr testDomainLookupByID(virConnectPtr conn,
virDomainPtr ret = NULL;
virDomainObjPtr dom;
if (!(dom = virDomainObjListFindByID(privconn->domains, id))) {
if (!(dom = virDomainObjListFindByIDRef(privconn->domains, id))) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
return NULL;
}
ret = virGetDomain(conn, dom->def->name, dom->def->uuid, dom->def->id);
cleanup:
if (dom)
virObjectUnlock(dom);
virDomainObjEndAPI(&dom);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册