]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libvirt: add daemon itself as shutdown reason
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Mon, 8 Oct 2018 11:21:08 +0000 (14:21 +0300)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 14 Nov 2018 11:52:23 +0000 (06:52 -0500)
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 <nshirokovskiy@virtuozzo.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
include/libvirt/libvirt-domain.h
src/conf/domain_conf.c
src/qemu/qemu_process.c
tools/virsh-domain-monitor.c

index fdd2d6b8eac7ff075d9a48172868162af7a529c3..71debd92b8adfb7e98c43ba73fab9af1d43e8486 100644 (file)
@@ -145,6 +145,8 @@ typedef enum {
     VIR_DOMAIN_SHUTOFF_FAILED = 6,      /* domain failed to start */
     VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7, /* restored from a snapshot which was
                                            * taken while domain was shutoff */
+    VIR_DOMAIN_SHUTOFF_DAEMON = 8,      /* daemon decides to kill domain
+                                           during reconnection processing */
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_SHUTOFF_LAST
 # endif
index e8e0adc8194e26823cf3ee46e7a84af1b068a462..b45f25fabbef3c93e8135597ae1911d0a0f5f38b 100644 (file)
@@ -779,7 +779,8 @@ VIR_ENUM_IMPL(virDomainShutoffReason, VIR_DOMAIN_SHUTOFF_LAST,
               "migrated",
               "saved",
               "failed",
-              "from snapshot")
+              "from snapshot",
+              "daemon")
 
 VIR_ENUM_IMPL(virDomainCrashedReason, VIR_DOMAIN_CRASHED_LAST,
               "unknown",
index 185092391483425a167059805b67ab1e2a4d13a6..59a94bb74aa5c3b9e60d36c4665c5a5a58d312ae 100644 (file)
@@ -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 = VIR_DOMAIN_SHUTOFF_CRASHED;
+        else if (priv->mon)
+            state = VIR_DOMAIN_SHUTOFF_DAEMON;
         else
             state = VIR_DOMAIN_SHUTOFF_UNKNOWN;
 
index 3a2636377dc3ef5abe8900ea4cb535a22625053a..f0ad558f874ee7c7cf2148af7cb2883a8119c60f 100644 (file)
@@ -212,7 +212,8 @@ VIR_ENUM_IMPL(virshDomainShutoffReason,
               N_("migrated"),
               N_("saved"),
               N_("failed"),
-              N_("from snapshot"))
+              N_("from snapshot"),
+              N_("daemon"))
 
 VIR_ENUM_DECL(virshDomainCrashedReason)
 VIR_ENUM_IMPL(virshDomainCrashedReason,