From nobody Tue May 7 13:36:08 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541601644421437.4573510838982; Wed, 7 Nov 2018 06:40:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A13A3C05B00E; Wed, 7 Nov 2018 14:40:41 +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 4E79867140; Wed, 7 Nov 2018 14:40:41 +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 F168118005B6; Wed, 7 Nov 2018 14:40:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA7EbWlX022108 for ; Wed, 7 Nov 2018 09:37:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id A33B267149; Wed, 7 Nov 2018 14:37:32 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 756A467147 for ; Wed, 7 Nov 2018 14:37:29 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id AC2A710073A; Wed, 7 Nov 2018 15:37:28 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 7 Nov 2018 15:37:26 +0100 Message-Id: <802e67d485d73e7686e790216c25e5759392732f.1541601352.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Drop unreachable code from qemuProcessHandleStop 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 07 Nov 2018 14:40:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If gotShutdown is true, the domain state cannot be running because of the following code in qemuProcessHandleShutdown: priv->gotShutdown =3D true; VIR_DEBUG("Transitioned guest %s to shutdown state", vm->def->name); virDomainObjSetState(vm, VIR_DOMAIN_SHUTDOWN, VIR_DOMAIN_SHUTDOWN_UNKNOWN); Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4e93b2d741..820d90aef7 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -649,11 +649,6 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNU= SED, if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { qemuDomainObjPrivatePtr priv =3D vm->privateData; =20 - if (priv->gotShutdown) { - VIR_DEBUG("Ignoring STOP event after SHUTDOWN"); - goto unlock; - } - if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_OUT) { if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) { @@ -690,7 +685,6 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUS= ED, } } =20 - unlock: virObjectUnlock(vm); virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 13:36:08 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541601657038481.06851185771575; Wed, 7 Nov 2018 06:40:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C56DE3086254; Wed, 7 Nov 2018 14:40:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A161672FC; Wed, 7 Nov 2018 14:40:54 +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 1264AEF05; Wed, 7 Nov 2018 14:40:54 +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 wA7EbX50022113 for ; Wed, 7 Nov 2018 09:37:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 408BD60920; Wed, 7 Nov 2018 14:37:33 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12B4E18C43 for ; Wed, 7 Nov 2018 14:37:30 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id AECE81046EB; Wed, 7 Nov 2018 15:37:28 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 7 Nov 2018 15:37:27 +0100 Message-Id: <907599e639816ec1a8f64a702ee1495afb91d548.1541601352.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemu: Drop priv->gotShutdown 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 07 Nov 2018 14:40:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The gotShutdown bool has been redundant since we started setting VIR_DOMAIN_SHUTDOWN state after receiving SHUTDOWN event from QEMU. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_domain.h | 1 - src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_process.c | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 80bd4bde91..63d645a31a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -286,7 +286,6 @@ struct _qemuDomainObjPrivate { qemuAgentPtr agent; bool agentError; =20 - bool gotShutdown; bool beingDestroyed; char *pidfile; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a52e2495d5..cc7fde0695 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4748,7 +4748,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, goto endjob; } =20 - if (priv->monJSON && !priv->gotShutdown) { + if (priv->monJSON && + virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_SHUTDOWN) { VIR_DEBUG("Monitor connection to '%s' closed without SHUTDOWN even= t; " "assuming the domain crashed", vm->def->name); eventReason =3D VIR_DOMAIN_EVENT_STOPPED_FAILED; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 820d90aef7..0f74d72490 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -491,7 +491,6 @@ qemuProcessFakeReboot(void *opaque) "%s", _("resume operation failed")); goto endjob; } - priv->gotShutdown =3D false; =20 if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->cap= s) < 0) { VIR_WARN("Unable to save status on vm %s after state change", @@ -578,7 +577,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_= UNUSED, virObjectLock(vm); =20 priv =3D vm->privateData; - if (priv->gotShutdown) { + if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_SHUTDOWN) { VIR_DEBUG("Ignoring repeated SHUTDOWN event from domain %s", vm->def->name); goto unlock; @@ -587,7 +586,6 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_= UNUSED, vm->def->name); goto unlock; } - priv->gotShutdown =3D true; =20 VIR_DEBUG("Transitioned guest %s to shutdown state", vm->def->name); @@ -5980,7 +5978,6 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, priv->monJSON =3D true; priv->monError =3D false; priv->monStart =3D 0; - priv->gotShutdown =3D false; priv->runningReason =3D VIR_DOMAIN_RUNNING_UNKNOWN; =20 VIR_DEBUG("Updating guest CPU definition"); @@ -7394,8 +7391,6 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UN= USED, monConfig =3D NULL; priv->monJSON =3D monJSON; =20 - priv->gotShutdown =3D false; - /* Attaching to running QEMU so we need to detect whether it was start= ed * with -no-reboot. */ qemuProcessPrepareAllowReboot(vm); --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list