mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: Don't report failure to destroy a destroyed domain
When destroying a domain libvirt marks it internally with a beingDestroyed flag to make sure the qemuDomainDestroyFlags API itself cleans up after the domain rather than letting an uninformed EOF handler do it. However, when the domain is being started at the moment libvirt was asked to destroy it, only the starting thread can properly clean up after the domain and thus it ignores the beingDestroyed flag. Once qemuDomainDestroyFlags finally gets a job, the domain may not be running anymore, which should not be reported as an error if the domain has been starting up. https://bugzilla.redhat.com/show_bug.cgi?id=1445600 Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
ecd53ca43a
commit
c5d1dcbcd9
@ -2224,6 +2224,9 @@ qemuDomainDestroyFlags(virDomainPtr dom,
|
||||
virObjectEventPtr event = NULL;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
unsigned int stopFlags = 0;
|
||||
int state;
|
||||
int reason;
|
||||
bool starting;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_DESTROY_GRACEFUL, -1);
|
||||
|
||||
@ -2235,13 +2238,29 @@ qemuDomainDestroyFlags(virDomainPtr dom,
|
||||
if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
state = virDomainObjGetState(vm, &reason);
|
||||
starting = (state == VIR_DOMAIN_PAUSED &&
|
||||
reason == VIR_DOMAIN_PAUSED_STARTING_UP &&
|
||||
!priv->beingDestroyed);
|
||||
|
||||
if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY,
|
||||
!(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
if (starting) {
|
||||
VIR_DEBUG("Domain %s is not running anymore", vm->def->name);
|
||||
ret = 0;
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
}
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user