From: John Ferlan Date: Thu, 1 Nov 2018 15:19:02 +0000 (-0400) Subject: qemu: Narrow the shutdown reconnection failure reason window X-Git-Tag: v4.10.0-rc1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f0f8425d732e4b807505c7de5441e9d617f15f5;p=thirdparty%2Flibvirt.git qemu: Narrow the shutdown reconnection failure reason window The current qemuProcessReconnect logic paints a broad brush determining that the shutdown reason must be crashed if it was determined that the domain was started with -no-shutdown; however, there's many other ways to get to the error label, so let's narrow our reasoning window for using VIR_DOMAIN_SHUTOFF_CRASHED to the period where we essentially know we've tried to create to the monitor and before we were successful in opening the connection. Failures that occur outside that window would thus be considered as VIR_DOMAIN_SHUTOFF_UNKNOWN, at least for now. Signed-off-by: John Ferlan ACKed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f1639463f0..3bf84834ec 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7757,6 +7757,7 @@ qemuProcessReconnect(void *opaque) bool jobStarted = false; virCapsPtr caps = NULL; bool retry = true; + bool tryMonReconn = false; VIR_FREE(data); @@ -7797,6 +7798,8 @@ qemuProcessReconnect(void *opaque) VIR_DEBUG("Reconnect monitor to def=%p name='%s' retry=%d", obj, obj->def->name, retry); + tryMonReconn = true; + /* XXX check PID liveliness & EXE path */ if (qemuConnectMonitor(driver, obj, QEMU_ASYNC_JOB_NONE, retry, NULL) < 0) goto error; @@ -7993,7 +7996,8 @@ 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. */ - if (qemuDomainIsUsingNoShutdown(priv)) + if (!priv->mon && tryMonReconn && + qemuDomainIsUsingNoShutdown(priv)) state = VIR_DOMAIN_SHUTOFF_CRASHED; else state = VIR_DOMAIN_SHUTOFF_UNKNOWN;