[libvirt] Question about qemuDomainLogContextNew()

Feng Feng24 Liu liufeng24 at lenovo.com
Mon Mar 27 03:29:05 UTC 2017


Hi, Dear all
	I have a question, and need your help. 
  I want to output some log message to "/var/log/libvirt/qemu/instance-xxxxxx" when guest kernel crashed, so I add following the code:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

static int
qemuProcessHandleGuestPanic(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                            virDomainObjPtr vm,
                            void *opaque)
{
......
+    qemuDomainLogContextPtr logCtxt = NULL;

+    if (!(logCtxt = qemuDomainLogContextNew(driver, vm, QEMU_DOMAIN_LOG_CONTEXT_MODE_START))){
+        VIR_WARN("Unable to open domainlog");
+        goto cleanup;
+    }

......
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

But this code cannot get the logCtxt,   
logCtxt = qemuDomainLogContextNew(driver, vm, QEMU_DOMAIN_LOG_CONTEXT_MODE_START)  always return NULL, so I CANNOT write message to log file.

Really Need your help, Thanks!

Thanks
Feng





More information about the libvir-list mailing list