From nobody Mon May 6 00:53:30 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 1542142620395311.4042705106125; Tue, 13 Nov 2018 12:57:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CC28308FEC9; Tue, 13 Nov 2018 20:56:58 +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 522B35D738; Tue, 13 Nov 2018 20:56:56 +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 514914CA94; Tue, 13 Nov 2018 20:56:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wADKb4GZ016056 for ; Tue, 13 Nov 2018 15:37:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 46C0C5D96E; Tue, 13 Nov 2018 20:37:04 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-124-253.rdu2.redhat.com [10.10.124.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84CAC5D969; Tue, 13 Nov 2018 20:37:00 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 13 Nov 2018 15:36:59 -0500 Message-Id: <20181113203659.32624-1-jferlan@redhat.com> In-Reply-To: <1538997668-625740-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1538997668-625740-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Nikolay Shirokovskiy Subject: [libvirt] [PATCHv2] libvirt: add daemon itself as shutdown reason 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 13 Nov 2018 20:56:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Nikolay Shirokovskiy This patch introduces a new shutdown reason "daemon" in order to indicate that the daemon needed to force shutdown the domain as the best course of action to take at the moment. This action would occur during reconnection when processing encounters an error once the monitor reconnection is successful. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: John Ferlan Reviewed-by: Erik Skultety --- Since I hadn't seen a yay or nay on my last response related to changes - figured I'd post things as they are now just to make it easier to determine whether the changes made were acceptible This is essentially your original patch merged with my other changes and the removal of the qemu_process.c change. include/libvirt/libvirt-domain.h | 2 ++ src/conf/domain_conf.c | 3 ++- src/qemu/qemu_process.c | 6 +++++- tools/virsh-domain-monitor.c | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index fdd2d6b8ea..71debd92b8 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -145,6 +145,8 @@ typedef enum { VIR_DOMAIN_SHUTOFF_FAILED =3D 6, /* domain failed to start */ VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT =3D 7, /* restored from a snapshot wh= ich was * taken while domain was shutof= f */ + VIR_DOMAIN_SHUTOFF_DAEMON =3D 8, /* daemon decides to kill domain + during reconnection processing = */ # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_SHUTOFF_LAST # endif diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e8e0adc819..b45f25fabb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -779,7 +779,8 @@ VIR_ENUM_IMPL(virDomainShutoffReason, VIR_DOMAIN_SHUTOF= F_LAST, "migrated", "saved", "failed", - "from snapshot") + "from snapshot", + "daemon") =20 VIR_ENUM_IMPL(virDomainCrashedReason, VIR_DOMAIN_CRASHED_LAST, "unknown", diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1850923914..59a94bb74a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7978,10 +7978,14 @@ qemuProcessReconnect(void *opaque) * * If we cannot get to the monitor when the QEMU command * line used -no-shutdown, then we can safely say that the - * domain crashed; otherwise, we don't really know. */ + * domain crashed; otherwise, if the monitor was started, + * then we can blame ourselves, else we failed before the + * monitor started so we don't really know. */ if (!priv->mon && tryMonReconn && qemuDomainIsUsingNoShutdown(priv)) state =3D VIR_DOMAIN_SHUTOFF_CRASHED; + else if (priv->mon) + state =3D VIR_DOMAIN_SHUTOFF_DAEMON; else state =3D VIR_DOMAIN_SHUTOFF_UNKNOWN; =20 diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 3a2636377d..f0ad558f87 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -212,7 +212,8 @@ VIR_ENUM_IMPL(virshDomainShutoffReason, N_("migrated"), N_("saved"), N_("failed"), - N_("from snapshot")) + N_("from snapshot"), + N_("daemon")) =20 VIR_ENUM_DECL(virshDomainCrashedReason) VIR_ENUM_IMPL(virshDomainCrashedReason, --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list