mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemuDomainObjWait: Report error when VM is being destroyed
Since we started handling the monitor EOF event inside a job any code
which uses virDomainObjWait would no longer properly abort in case when
the VM crashed during the wait.
This is because virDomainObjWait uses virDomainObjIsActive which checks
'vm->def->id' to see if the VM is still active. Unfortunately the domain
id is cleared in qemuProcessStop which is run only inside the job.
To fix this we can use the 'beingDestroyed' flag stored in the VM
private data which is set to true around the time when the condition is
signalled.
Reported-by: Pavel Hrdina <phrdina@redhat.com>
Fixes: 8c9ff9960b
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
24fb0270c6
commit
4d1a1fdffd
@ -11780,5 +11780,15 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
|
||||
int
|
||||
qemuDomainObjWait(virDomainObj *vm)
|
||||
{
|
||||
return virDomainObjWait(vm);
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
|
||||
if (virDomainObjWait(vm) < 0)
|
||||
return -1;
|
||||
|
||||
if (priv->beingDestroyed) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain is not running"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2078,7 +2078,7 @@ qemuMigrationSrcWaitForCompletion(virDomainObj *vm,
|
||||
return rv;
|
||||
|
||||
if (qemuDomainObjWait(vm) < 0) {
|
||||
if (virDomainObjIsActive(vm))
|
||||
if (virDomainObjIsActive(vm) && !priv->beingDestroyed)
|
||||
jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
|
||||
return -2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user