Re: [PATCH] qemu: include kernel version in QEMU log file

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

 



On Fri, May 18, 2018 at 12:24:32PM +0100, Daniel P. Berrangé wrote:
> We currently print the libvirt and qemu version strings into the
> per-guest logfile. It would be useful to know what kernel is running
> too, so add that.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_process.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

I applied your patch and built libvirt locally; then I started my
freshly-built libvirt, et al:

    $ sudo systemctl stop libvirtd virtlockd virtlogd
    # Start freshly-built libvirtd, virtlockd, virtlogd
    # Define and start a network 
    # Then, start a guest from an XML

When you start a guest with "sudo ./tools/virsh start cvm2", where will
the per-guest log file go?  Is it even configurable?  I never tried this
before.

FWIW I started guest the following way, preserving the log filters
environment variable:

    $> sudo LIBVIRT_LOG_FILTERS="1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 3:object 1:util" -E ./tools/virsh start cvm2
    2018-05-18 18:08:52.896+0000: 26556: info : libvirt version: 4.4.0
    2018-05-18 18:08:52.896+0000: 26556: info : hostname: paraplu
    2018-05-18 18:08:52.896+0000: 26556: debug : virLogParseFilters:1821 : filters=1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 3:object 1:util
    2018-05-18 18:08:52.896+0000: 26556: debug : virLogParseFilter:1699 : filter=1:libvirt
    2018-05-18 18:08:52.896+0000: 26556: debug : virLogParseFilter:1699 : filter=1:qemu
    2018-05-18 18:08:52.896+0000: 26556: debug : virLogParseFilter:1699 : filter=1:conf
    [...]
    Domain cvm2 started

I think I am simply looking in the wrong place (the libvirtd log),
instead of the per-guest log.  But I'm not where it goes when running a
custom libvirtd.  I looked in the `journalctl --since=today`, also no
dice.

What am I missing?  I'm curious how you tested it.

> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 5b73a61962..174d932ae7 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -32,6 +32,8 @@
>  # include <sys/cpuset.h>
>  #endif
>  
> +#include <sys/utsname.h>
> +
>  #include "qemu_process.h"
>  #include "qemu_processpriv.h"
>  #include "qemu_alias.h"
> @@ -4283,17 +4285,21 @@ qemuLogOperation(virDomainObjPtr vm,
>      int qemuVersion = virQEMUCapsGetVersion(priv->qemuCaps);
>      const char *package = virQEMUCapsGetPackage(priv->qemuCaps);
>      char *hostname = virGetHostname();
> +    struct utsname uts;
> +
> +    uname(&uts);
>  
>      if ((timestamp = virTimeStringNow()) == NULL)
>          goto cleanup;
>  
>      if (qemuDomainLogContextWrite(logCtxt,
> -                                  "%s: %s %s, qemu version: %d.%d.%d%s, hostname: %s\n",
> +                                  "%s: %s %s, qemu version: %d.%d.%d%s, kernel: %s, hostname: %s\n",
>                                    timestamp, msg, VIR_LOG_VERSION_STRING,
>                                    (qemuVersion / 1000000) % 1000,
>                                    (qemuVersion / 1000) % 1000,
>                                    qemuVersion % 1000,
>                                    package ? package : "",
> +                                  uts.release,
>                                    hostname ? hostname : "") < 0)
>          goto cleanup;
>  
> -- 
> 2.17.0
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
/kashyap

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

  Powered by Linux