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

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

 



On Thu, Oct 06, 2016 at 04:29:46PM +0200, Michal Privoznik wrote:
> On 28.09.2016 13:43, Chen Hanxiao wrote:
> > From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> > 
> > 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@xxxxxxxxx>
> > ---
> >  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");
> > 
> 
> Can't we have both?

IMHO writing to the QEMU log like this after QEMU is running is not
a good idea. Once QEMU is running we only want QEMU writing to this
log. We could be reporting errors QEMU prints in this log shortly and
don't want those mixed up with this message written by libvirt.

These log files really aren't intended as a general audit trail of
everything that's done by libvirt. If you want that info look at the
audit log stream where libvirt is already emitting the PID information
and much more, in a structured format.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
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]