[libvirt] [PATCH v2 14/15] qemu: conf: add option for tuning debug logging level

Peter Krempa pkrempa at redhat.com
Wed Nov 2 16:13:46 UTC 2016


From: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>

This helps in selecting log level of the gluster gfapi, output to stderr.
The option is 'gluster_debug_level', can be tuned by editing
'/etc/libvirt/qemu.conf'

Debug levels ranges 0-9, with 9 being the most verbose, and 0
representing no debugging output.  The default is the same as it was
before, which is a level of 4.  The current logging levels defined in
the gluster gfapi are:

    0 - None
    1 - Emergency
    2 - Alert
    3 - Critical
    4 - Error
    5 - Warning
    6 - Notice
    7 - Info
    8 - Debug
    9 - Trace

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever at redhat.com>
Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/libvirtd_qemu.aug |  3 +++
 src/qemu/qemu.conf         | 20 ++++++++++++++++++++
 src/qemu/qemu_conf.c       |  3 +++
 src/qemu/qemu_conf.h       |  1 +
 4 files changed, 27 insertions(+)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 73ebeda..f3cc9e6 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -106,6 +106,8 @@ module Libvirtd_qemu =

    let nvram_entry = str_array_entry "nvram"

+   let gluster_debug_level_entry = int_entry "gluster_debug_level"
+
    (* Each entry in the config is one of the following ... *)
    let entry = default_tls_entry
              | vnc_entry
@@ -121,6 +123,7 @@ module Libvirtd_qemu =
              | network_entry
              | log_entry
              | nvram_entry
+             | gluster_debug_level_entry

    let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
    let empty = [ label "#empty" . eol ]
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index c4fcb6d..070d37b 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -645,3 +645,23 @@
 #          rollover when a size limit is hit.
 #
 #stdio_handler = "logd"
+
+# Qemu gluster libgfapi log level, debug levels are 0-9, with 9 being the
+# most verbose, and 0 representing no debugging output.
+#
+# The current logging levels defined in the gluster GFAPI are:
+#
+#    0 - None
+#    1 - Emergency
+#    2 - Alert
+#    3 - Critical
+#    4 - Error
+#    5 - Warning
+#    6 - Notice
+#    7 - Info
+#    8 - Debug
+#    9 - Trace
+#
+# Defaults to 4
+#
+# gluster_debug_level = 9
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 109668b..0ed88f5 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -311,6 +311,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
     cfg->seccompSandbox = -1;

     cfg->logTimestamp = true;
+    cfg->glusterDebugLevel = 4;
     cfg->stdioLogD = true;

 #ifdef DEFAULT_LOADER_NVRAM
@@ -794,6 +795,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
                 goto cleanup;
         }
     }
+    if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebugLevel) < 0)
+        goto cleanup;

     ret = 0;

diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 12b2661..f6e3257 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -192,6 +192,7 @@ struct _virQEMUDriverConfig {

     virFirmwarePtr *firmwares;
     size_t nfirmwares;
+    unsigned int glusterDebugLevel;
 };

 /* Main driver state */
-- 
2.10.2




More information about the libvir-list mailing list