[PATCH] Debug: Record the VM PID in per-VM logs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For certain situations such as Out-of-memory scenarios, it is helpful to
record the QEMU PID in the per-VM logs, so that correlation with kernel-reported
events is easier.

While this is already recorded in libvirt daemon logs as a DEBUG message,
I believe it merits more attention :-)
Hence introducing it in per-VM log.

Signed-off-by: Prerna Saxena <saxenap.ltc@xxxxxxxxx>
---
 src/qemu/qemu_process.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4adb14e..2d3b0f5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4983,6 +4983,7 @@ qemuProcessLaunch(virConnectPtr conn,
     int ret = -1;
     int rv;
     int logfile = -1;
+    char *msg_buffer = NULL;
     qemuDomainLogContextPtr logCtxt = NULL;
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virCommandPtr cmd = NULL;
@@ -5095,8 +5096,14 @@ qemuProcessLaunch(virConnectPtr conn,
                            _("Domain %s didn't show up"), vm->def->name);
             rv = -1;
         }
+
         VIR_DEBUG("QEMU vm=%p name=%s running with pid=%llu",
                   vm, vm->def->name, (unsigned long long)vm->pid);
+        ignore_value(virAsprintf(&msg_buffer,
+                    "QEMU vm=%p name=%s running with pid=%llu",
+                    vm, vm->def->name, (unsigned long long)vm->pid));
+        qemuLogOperation(vm, msg_buffer, NULL, logCtxt);
+        virFree(msg_buffer);
     } else {
         VIR_DEBUG("QEMU vm=%p name=%s failed to spawn",
                   vm, vm->def->name);
-- 
1.8.1.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]