[libvirt] [PATCH] qemu_process: add pid of vm in domain log

Chen Hanxiao chen_han_xiao at 126.com
Wed Sep 28 11:43:35 UTC 2016


From: Chen Hanxiao <chenhanxiao at gmail.com>

Add pid of VM in domain log.
We used to show this info in debug log.

For example:
If a process send SIGKILL to a qemu process,
we could find something in audit logs.
Then the pid of VM in domain log will be helpful.

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

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 27d04a4..8510a89 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5392,11 +5392,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);
+        qemuDomainLogContextWrite(logCtxt,
+                                  "QEMU vm=%p name=%s running with pid=%llu\n",
+                                  vm,
+                                  vm->def->name,
+                                  (unsigned long long)vm->pid);
     } else {
-        VIR_DEBUG("QEMU vm=%p name=%s failed to spawn",
-                  vm, vm->def->name);
+        qemuDomainLogContextWrite(logCtxt, "QEMU vm=%p name=%s failed to spawn",
+                                  vm, vm->def->name);
     }
 
     VIR_DEBUG("Writing early domain status to disk");
-- 
1.8.3.1





More information about the libvir-list mailing list