mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
ch_driver: Don't lock driver when looking up domains
There is no need to lock whole driver when accessing virDomainObjList. Those APIs were specifically tailored to be thread safe (when we were dropping QEMU driver lock). Don't resurrect old history. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
31ef66f12e
commit
b1e7807711
@ -363,11 +363,9 @@ chDomainUndefine(virDomainPtr dom)
|
||||
|
||||
static int chDomainIsActive(virDomainPtr dom)
|
||||
{
|
||||
virCHDriver *driver = dom->conn->privateData;
|
||||
virDomainObj *vm;
|
||||
int ret = -1;
|
||||
|
||||
chDriverLock(driver);
|
||||
if (!(vm = virCHDomainObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
@ -378,7 +376,6 @@ static int chDomainIsActive(virDomainPtr dom)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
chDriverUnlock(driver);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -636,9 +633,7 @@ static virDomainPtr chDomainLookupByID(virConnectPtr conn,
|
||||
virDomainObj *vm;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
chDriverLock(driver);
|
||||
vm = virDomainObjListFindByID(driver->domains, id);
|
||||
chDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
@ -663,9 +658,7 @@ static virDomainPtr chDomainLookupByName(virConnectPtr conn,
|
||||
virDomainObj *vm;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
chDriverLock(driver);
|
||||
vm = virDomainObjListFindByName(driver->domains, name);
|
||||
chDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
@ -690,9 +683,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
|
||||
virDomainObj *vm;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
chDriverLock(driver);
|
||||
vm = virDomainObjListFindByUUID(driver->domains, uuid);
|
||||
chDriverUnlock(driver);
|
||||
|
||||
if (!vm) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
|
Loading…
Reference in New Issue
Block a user