[libvirt] Question about qemuDomainLogContextNew

Liu Feng feng.liu.linux at gmail.com
Mon Mar 27 03:39:09 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170327/c30368d9/attachment-0001.htm>


More information about the libvir-list mailing list