[libvirt] [PATCH] qemu_process: show shutoff reasons when debug log disabled

Chen Hanxiao chen_han_xiao at 126.com
Mon Sep 19 08:17:57 UTC 2016


From: Chen Hanxiao <chenhanxiao at gmail.com>

We have a few of senarios that libvirtd would invoke qemuProcessStop
and leave a "shutting down" in /var/log/libvirt/qemu/$DOMAIN.log.

The shutoff reason showing in debug log is also very important
for us to know why VM shutting down in domain log,
as we seldom enable debug log of libvirtd.

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 src/qemu/qemu_process.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b10b053..73e9271 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5803,7 +5803,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virDomainObjBroadcast(vm);
 
     if ((timestamp = virTimeStringNow()) != NULL) {
-        qemuDomainLogAppendMessage(driver, vm, "%s: shutting down\n", timestamp);
+        qemuDomainLogAppendMessage(driver, vm, "%s: shutting down, reason=%s\n",
+                                   timestamp,
+                                   virDomainShutoffReasonTypeToString(reason));
         VIR_FREE(timestamp);
     }
 
-- 
1.8.3.1





More information about the libvir-list mailing list