From nobody Thu May 2 22:11:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1504900285710449.86334615710336; Fri, 8 Sep 2017 12:51:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E9ADC047B68; Fri, 8 Sep 2017 19:51:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC59B6BF67; Fri, 8 Sep 2017 19:51:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AE34F1806106; Fri, 8 Sep 2017 19:51:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v88JPdLN026758 for ; Fri, 8 Sep 2017 15:25:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9257660A9B; Fri, 8 Sep 2017 19:25:39 +0000 (UTC) Received: from mamuti.net (ovpn-204-57.brq.redhat.com [10.40.204.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B7B560C28 for ; Fri, 8 Sep 2017 19:25:37 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id A9C5C100481; Fri, 8 Sep 2017 21:25:35 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1E9ADC047B68 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 8 Sep 2017 21:25:34 +0200 Message-Id: <4c11ed7afb910805e788105ae6414e7071eb4e9e.1504898734.git.jdenemar@redhat.com> Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Don't report failure to destroy a destroyed domain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 08 Sep 2017 19:51:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=3D1445600 Signed-off-by: Jiri Denemark Reviewed-by: Martin Kletzander --- src/qemu/qemu_driver.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6255d89310..a25daae866 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2224,6 +2224,9 @@ qemuDomainDestroyFlags(virDomainPtr dom, virObjectEventPtr event =3D NULL; qemuDomainObjPrivatePtr priv; unsigned int stopFlags =3D 0; + int state; + int reason; + bool starting; =20 virCheckFlags(VIR_DOMAIN_DESTROY_GRACEFUL, -1); =20 @@ -2235,13 +2238,29 @@ qemuDomainDestroyFlags(virDomainPtr dom, if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto cleanup; + } + + state =3D virDomainObjGetState(vm, &reason); + starting =3D (state =3D=3D VIR_DOMAIN_PAUSED && + reason =3D=3D VIR_DOMAIN_PAUSED_STARTING_UP && + !priv->beingDestroyed); + if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, !(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < = 0) goto cleanup; =20 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 =3D 0; + } else { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + } goto endjob; } =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list