mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
virDomainObjListFindByName: Return referenced object
Every domain that grabs a domain object to work over should reference it to make sure it won't disappear meanwhile. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
79d14a9930
commit
620ff93bd3
@ -797,8 +797,7 @@ static virDomainPtr bhyveDomainLookupByName(virConnectPtr conn,
|
||||
dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -1157,10 +1157,12 @@ virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms,
|
||||
virDomainObjPtr obj;
|
||||
virObjectLock(doms);
|
||||
obj = virHashSearch(doms->objs, virDomainObjListSearchName, name);
|
||||
virObjectRef(obj);
|
||||
if (obj) {
|
||||
virObjectLock(obj);
|
||||
if (obj->removing) {
|
||||
virObjectUnlock(obj);
|
||||
virObjectUnref(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1001,8 +1001,7 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
@ -4955,12 +4954,12 @@ libxlDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish3ParamsEnsureACL(dconn, vm->def) < 0) {
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) {
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -4969,8 +4968,7 @@ libxlDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
if (!libxlDomainObjEndJob(driver, vm))
|
||||
vm = NULL;
|
||||
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -321,8 +321,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn,
|
||||
dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -427,8 +427,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
|
||||
dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
@ -1007,6 +1006,7 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Already an OPENVZ VM active with the id '%s'"),
|
||||
vmdef->name);
|
||||
virDomainObjEndAPI(&vm);
|
||||
goto cleanup;
|
||||
}
|
||||
if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
|
||||
@ -1103,6 +1103,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Already an OPENVZ VM defined with the id '%s'"),
|
||||
vmdef->name);
|
||||
virDomainObjEndAPI(&vm);
|
||||
goto cleanup;
|
||||
}
|
||||
if (!(vm = virDomainObjListAdd(driver->domains,
|
||||
@ -1208,8 +1209,7 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2508,8 +2508,7 @@ openvzDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -526,8 +526,7 @@ parallelsDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
ret->id = dom->def->id;
|
||||
|
||||
cleanup:
|
||||
if (dom)
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1511,8 +1511,7 @@ static virDomainPtr qemuDomainLookupByName(virConnectPtr conn,
|
||||
if (dom) dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
@ -12287,11 +12286,10 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish2EnsureACL(dconn, vm->def) < 0) {
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virObjectRef(vm);
|
||||
/* Do not use cookies in v2 protocol, since the cookie
|
||||
* length was not sufficiently large, causing failures
|
||||
* migrating between old & new libvirtd
|
||||
@ -12702,12 +12700,10 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish3EnsureACL(dconn, vm->def) < 0) {
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virObjectRef(vm);
|
||||
|
||||
return qemuMigrationFinish(driver, dconn, vm,
|
||||
cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen,
|
||||
@ -12747,12 +12743,10 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish3ParamsEnsureACL(dconn, vm->def) < 0) {
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virObjectRef(vm);
|
||||
|
||||
return qemuMigrationFinish(driver, dconn, vm,
|
||||
cookiein, cookieinlen,
|
||||
cookieout, cookieoutlen,
|
||||
|
@ -1859,8 +1859,7 @@ static virDomainPtr testDomainLookupByName(virConnectPtr conn,
|
||||
ret->id = dom->def->id;
|
||||
|
||||
cleanup:
|
||||
if (dom)
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1899,16 +1898,12 @@ static int testDomainDestroy(virDomainPtr domain)
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
|
||||
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
if (!privdom->persistent)
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -1946,8 +1941,7 @@ static int testDomainResume(virDomainPtr domain)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event) {
|
||||
testDriverLock(privconn);
|
||||
testObjectEventQueue(privconn, event);
|
||||
@ -1988,8 +1982,7 @@ static int testDomainSuspend(virDomainPtr domain)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
|
||||
if (event) {
|
||||
testDriverLock(privconn);
|
||||
@ -2029,16 +2022,12 @@ static int testDomainShutdownFlags(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
if (!privdom->persistent)
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -2104,17 +2093,13 @@ static int testDomainReboot(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
if (!privdom->persistent)
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -2153,8 +2138,7 @@ static int testDomainGetInfo(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2184,8 +2168,7 @@ testDomainGetState(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2268,11 +2251,8 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SAVED);
|
||||
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
if (!privdom->persistent)
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@ -2285,8 +2265,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
unlink(path);
|
||||
}
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -2458,18 +2437,14 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
|
||||
event = virDomainEventLifecycleNewFromObj(privdom,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
if (!privdom->persistent)
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -2517,8 +2492,7 @@ testDomainGetMaxMemory(virDomainPtr domain)
|
||||
ret = virDomainDefGetMemoryActual(privdom->def);
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2544,8 +2518,7 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2575,8 +2548,7 @@ static int testDomainSetMemory(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2806,8 +2778,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
|
||||
|
||||
ret = maxinfo;
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2863,8 +2834,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2894,8 +2864,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3014,8 +2983,7 @@ static char *testDomainGetMetadata(virDomainPtr dom,
|
||||
privconn->xmlopt, flags);
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3048,8 +3016,7 @@ static int testDomainSetMetadata(virDomainPtr dom,
|
||||
NULL, NULL, flags);
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3118,8 +3085,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -3183,19 +3149,15 @@ static int testDomainUndefineFlags(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
|
||||
privdom->hasManagedSave = false;
|
||||
|
||||
if (virDomainObjIsActive(privdom)) {
|
||||
if (virDomainObjIsActive(privdom))
|
||||
privdom->persistent = 0;
|
||||
} else {
|
||||
virDomainObjListRemove(privconn->domains,
|
||||
privdom);
|
||||
privdom = NULL;
|
||||
}
|
||||
else
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
if (event)
|
||||
testObjectEventQueue(privconn, event);
|
||||
testDriverUnlock(privconn);
|
||||
@ -3228,8 +3190,7 @@ static int testDomainGetAutostart(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3255,8 +3216,7 @@ static int testDomainSetAutostart(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3305,8 +3265,7 @@ testDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3356,8 +3315,7 @@ testDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3417,8 +3375,7 @@ static int testDomainBlockStats(virDomainPtr domain,
|
||||
|
||||
ret = 0;
|
||||
error:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3476,8 +3433,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
|
||||
|
||||
ret = 0;
|
||||
error:
|
||||
if (privdom)
|
||||
virObjectUnlock(privdom);
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6211,8 +6167,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags)
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event) {
|
||||
testDriverLock(privconn);
|
||||
testObjectEventQueue(privconn, event);
|
||||
@ -6242,8 +6197,7 @@ testDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
|
||||
|
||||
ret = vm->hasManagedSave;
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
testDriverUnlock(privconn);
|
||||
return ret;
|
||||
}
|
||||
@ -6268,8 +6222,7 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
|
||||
vm->hasManagedSave = false;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
testDriverUnlock(privconn);
|
||||
return ret;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ umlInotifyEvent(int watch,
|
||||
if (e.mask & IN_DELETE) {
|
||||
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
|
||||
if (!virDomainObjIsActive(dom)) {
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -348,20 +348,17 @@ umlInotifyEvent(int watch,
|
||||
event = virDomainEventLifecycleNewFromObj(dom,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
if (!dom->persistent) {
|
||||
virDomainObjListRemove(driver->domains,
|
||||
dom);
|
||||
dom = NULL;
|
||||
}
|
||||
if (!dom->persistent)
|
||||
virDomainObjListRemove(driver->domains, dom);
|
||||
} else if (e.mask & (IN_CREATE | IN_MODIFY)) {
|
||||
VIR_DEBUG("Got inotify domain startup '%s'", name);
|
||||
if (virDomainObjIsActive(dom)) {
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (umlReadPidFile(driver, dom) < 0) {
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -382,11 +379,8 @@ umlInotifyEvent(int watch,
|
||||
event = virDomainEventLifecycleNewFromObj(dom,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_FAILED);
|
||||
if (!dom->persistent) {
|
||||
virDomainObjListRemove(driver->domains,
|
||||
dom);
|
||||
dom = NULL;
|
||||
}
|
||||
if (!dom->persistent)
|
||||
virDomainObjListRemove(driver->domains, dom);
|
||||
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
|
||||
VIR_WARN("Could not identify character devices for new domain");
|
||||
umlShutdownVMDaemon(driver, dom,
|
||||
@ -395,15 +389,11 @@ umlInotifyEvent(int watch,
|
||||
event = virDomainEventLifecycleNewFromObj(dom,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_FAILED);
|
||||
if (!dom->persistent) {
|
||||
virDomainObjListRemove(driver->domains,
|
||||
dom);
|
||||
dom = NULL;
|
||||
}
|
||||
if (!dom->persistent)
|
||||
virDomainObjListRemove(driver->domains, dom);
|
||||
}
|
||||
}
|
||||
if (dom)
|
||||
virObjectUnlock(dom);
|
||||
virDomainObjEndAPI(&dom);
|
||||
if (event) {
|
||||
umlDomainEventQueue(driver, event);
|
||||
event = NULL;
|
||||
@ -1448,8 +1438,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
|
||||
if (dom) dom->id = vm->def->id;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user