mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +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)
|
static int chDomainIsActive(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
virCHDriver *driver = dom->conn->privateData;
|
|
||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
chDriverLock(driver);
|
|
||||||
if (!(vm = virCHDomainObjFromDomain(dom)))
|
if (!(vm = virCHDomainObjFromDomain(dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -378,7 +376,6 @@ static int chDomainIsActive(virDomainPtr dom)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
chDriverUnlock(driver);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,9 +633,7 @@ static virDomainPtr chDomainLookupByID(virConnectPtr conn,
|
|||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
|
|
||||||
chDriverLock(driver);
|
|
||||||
vm = virDomainObjListFindByID(driver->domains, id);
|
vm = virDomainObjListFindByID(driver->domains, id);
|
||||||
chDriverUnlock(driver);
|
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN,
|
virReportError(VIR_ERR_NO_DOMAIN,
|
||||||
@ -663,9 +658,7 @@ static virDomainPtr chDomainLookupByName(virConnectPtr conn,
|
|||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
|
|
||||||
chDriverLock(driver);
|
|
||||||
vm = virDomainObjListFindByName(driver->domains, name);
|
vm = virDomainObjListFindByName(driver->domains, name);
|
||||||
chDriverUnlock(driver);
|
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN,
|
virReportError(VIR_ERR_NO_DOMAIN,
|
||||||
@ -690,9 +683,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
|
|||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
|
|
||||||
chDriverLock(driver);
|
|
||||||
vm = virDomainObjListFindByUUID(driver->domains, uuid);
|
vm = virDomainObjListFindByUUID(driver->domains, uuid);
|
||||||
chDriverUnlock(driver);
|
|
||||||
|
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
|
Loading…
Reference in New Issue
Block a user