From a944bd925902d9ecce81e08900ad6a1adee06c6c Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Thu, 22 Sep 2016 01:04:18 +0530 Subject: [PATCH] qemu: conf: add option for tuning debug logging level 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 Signed-off-by: Peter Krempa --- 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 73ebeda011..f3cc9e6843 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 c4fcb6d435..070d37b657 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 109668bc35..0ed88f5fee 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 12b2661d04..f6e3257604 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 */