mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
test: Use virDomainObjListFindByUUIDRef
Rather than using virDomainObjListFindByUUID, 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: John Ferlan <jferlan@redhat.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
This commit is contained in:
parent
7f8ac4bbc4
commit
ea90e0fbb9
@ -1740,16 +1740,14 @@ static virDomainPtr testDomainLookupByUUID(virConnectPtr conn,
|
|||||||
virDomainPtr ret = NULL;
|
virDomainPtr ret = NULL;
|
||||||
virDomainObjPtr dom;
|
virDomainObjPtr dom;
|
||||||
|
|
||||||
if (!(dom = virDomainObjListFindByUUID(privconn->domains, uuid))) {
|
if (!(dom = virDomainObjListFindByUUIDRef(privconn->domains, uuid))) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
virReportError(VIR_ERR_NO_DOMAIN, NULL);
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = virGetDomain(conn, dom->def->name, dom->def->uuid, dom->def->id);
|
ret = virGetDomain(conn, dom->def->name, dom->def->uuid, dom->def->id);
|
||||||
|
|
||||||
cleanup:
|
virDomainObjEndAPI(&dom);
|
||||||
if (dom)
|
|
||||||
virObjectUnlock(dom);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user