On Sun, Jul 17, 2016 at 11:17:01PM -0700, Prerna Saxena wrote:
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(a)gmail.com>
---
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);
I don't think we need to log the qemu version and hostname again.
We don't do that on shutdown either.
qemuDomainLogContextWrite should be enough.
Also, logging a pointer seems pointless, and so does logging the vm
name (which should be in the filename).
+ virFree(msg_buffer);
'make syntax-check' complains:
src/qemu/qemu_process.c:5106: virFree(msg_buffer);
maint.mk: use VIR_ macros instead of internal functions
cfg.mk:321: recipe for target 'sc_prohibit_internal_functions' failed
Jan