mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
test: Need to relock afer virDomainObjListRemove
For all @dom's fetched from a testDomObjFromDomain because virDomainObjListRemove will return an unlocked domain object we should relock it prior to the cleanup label which will use virDomainObjEndAPI which would Unlock and Unref the passed object (and we should avoid unlocking an unlocked object). Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
This commit is contained in:
parent
9c75425aa2
commit
7f8ac4bbc4
@ -1806,8 +1806,10 @@ static int testDomainDestroyFlags(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
|
||||
|
||||
if (!privdom->persistent)
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@ -1905,8 +1907,10 @@ static int testDomainShutdownFlags(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
|
||||
if (!privdom->persistent)
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@ -1975,8 +1979,10 @@ static int testDomainReboot(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
|
||||
if (!privdom->persistent)
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
@ -2114,8 +2120,10 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SAVED);
|
||||
|
||||
if (!privdom->persistent)
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@ -2300,8 +2308,10 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
|
||||
event = virDomainEventLifecycleNewFromObj(privdom,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
|
||||
if (!privdom->persistent)
|
||||
if (!privdom->persistent) {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
@ -3080,10 +3090,12 @@ static int testDomainUndefineFlags(virDomainPtr domain,
|
||||
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
|
||||
privdom->hasManagedSave = false;
|
||||
|
||||
if (virDomainObjIsActive(privdom))
|
||||
if (virDomainObjIsActive(privdom)) {
|
||||
privdom->persistent = 0;
|
||||
else
|
||||
} else {
|
||||
virDomainObjListRemove(privconn->domains, privdom);
|
||||
virObjectLock(privdom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user