提交 c5d1dcbc 编写于 作者: J Jiri Denemark

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=1445600Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
上级 ecd53ca4
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册