From nobody Thu May 2 02:03:25 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538997709610991.8103280667992; Mon, 8 Oct 2018 04:21:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE33781DF7; Mon, 8 Oct 2018 11:21:47 +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 358D4308BDA1; Mon, 8 Oct 2018 11:21:47 +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 6434E180474F; Mon, 8 Oct 2018 11:21:46 +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 w98BLjPA000625 for ; Mon, 8 Oct 2018 07:21:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A47C6AEA5; Mon, 8 Oct 2018 11:21:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6143561170 for ; Mon, 8 Oct 2018 11:21:43 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5C36311C3D3 for ; Mon, 8 Oct 2018 11:21:40 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g9TbV-0004S8-JO for libvir-list@redhat.com; Mon, 08 Oct 2018 14:21:37 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Mon, 8 Oct 2018 14:21:08 +0300 Message-Id: <1538997668-625740-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 236 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 08 Oct 2018 11:21:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 08 Oct 2018 11:21:42 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 08 Oct 2018 11:21:48 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's introduce shutdown reason "daemon" which means we have to kill running domain ourselves as the best action we can take at that moment. Failure to pick up domain on daemon restart is one example of such case. Using reason "crashed" is a bit misleading as it is used when qemu is actually crashed or qemu destroyed on guest panic as result of user choice that is the problem was in qemu/guest itself. So I propose to use "crashed" only for qemu side issues and introduce "daemon" when we have to kill the qemu for good. There is another example where "daemon" will be useful. If we can not reboot domain we kill it and got "crashed" reason now. Looks like good candidate for "daemon" reason. Signed-off-by: Nikolay Shirokovskiy --- include/libvirt/libvirt-domain.h | 1 + src/conf/domain_conf.c | 3 ++- src/qemu/qemu_process.c | 11 ++++------- tools/virsh-domain-monitor.c | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index fdd2d6b..11fdab5 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -145,6 +145,7 @@ 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 have to kill domain */ # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_SHUTOFF_LAST # endif diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56..e441723 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 e9c7618..c4bc9ca 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7988,15 +7988,12 @@ qemuProcessReconnect(void *opaque) /* We can't get the monitor back, so must kill the VM * to remove danger of it ending up running twice if * user tries to start it again later - * If we couldn't get the monitor since QEMU supports - * no-shutdown, we can safely say that the domain - * crashed ... */ - state =3D VIR_DOMAIN_SHUTOFF_CRASHED; - /* If BeginJob failed, we jumped here without a job, let's hope an= other + * If BeginJob failed, we jumped here without a job, let's hope an= other * thread didn't have a chance to start playing with the domain yet * (it's all we can do anyway). */ - qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags= ); + qemuProcessStop(driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON, + QEMU_ASYNC_JOB_NONE, stopFlags); } goto cleanup; } @@ -8035,7 +8032,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj, * is no thread that could be doing anything else with the same do= main * object. */ - qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, + qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON, QEMU_ASYNC_JOB_NONE, 0); qemuDomainRemoveInactiveJobLocked(src->driver, obj); =20 diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 3a26363..f0ad558 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 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list