This helps in selecting log level of the gluster gfapi, output to stderr.
The option is 'qemu_gfapi_debuglevel', 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(a)redhat.com>
--
v2:
Modify test cases and syntax check changes as suggested by Peter in v1.
Rename qemu_gfapi_debuglevel to glusterfs_debug_level as per Daniel comments.
Fix to make debug_level changes effects on URI along with JSON.
TODO:
* changes in libvirtd_qemu.aug
Which I don't understand for now
* comment on debug_level variable in storage source
Not sure what is the right place
* Capablities check
v1:
Initial post
---
src/qemu/qemu.conf | 20 ++++++++++++++++++++
src/qemu/qemu_command.c | 14 +++++++++++++-
src/qemu/qemu_conf.c | 3 +++
src/qemu/qemu_conf.h | 1 +
src/util/virstoragefile.h | 2 ++
.../qemuargv2xml-disk-drive-network-gluster.args | 7 ++++---
.../qemuxml2argv-disk-drive-network-gluster.args | 12 ++++++------
7 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index e4c2aae..a6cdcf3 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -621,3 +621,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
+#
+# glusterfs_debug_level = 9
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3a61863..c333795 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1383,6 +1383,11 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
}
virBufferAddLit(buf, ",");
+ if (disk->src &&
+ disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
+ virBufferAsprintf(buf, "file.debug=%d,",
disk->src->debug_level);
+ }
+
if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) {
/* NB: If libvirt starts using the more modern option based
* syntax to build the command line (e.g., "-drive driver=rbd,
@@ -2177,6 +2182,7 @@ qemuBuildDriveDevStr(const virDomainDef *def,
static int
qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
+ virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
@@ -2255,6 +2261,12 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, "-drive");
+ if (disk->src &&
+ disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
+ if (cfg->glusterfsDebugLevel)
+ disk->src->debug_level = cfg->glusterfsDebugLevel;
+ }
+
if (!(optstr = qemuBuildDriveStr(disk, driveBoot, qemuCaps)))
return -1;
virCommandAddArg(cmd, optstr);
@@ -9613,7 +9625,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
goto error;
- if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps) < 0)
+ if (qemuBuildDiskDriveCommandLine(cmd, cfg, def, qemuCaps) < 0)
goto error;
if (qemuBuildFSDevCommandLine(cmd, def, qemuCaps) < 0)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index dad8334..ff2b58e 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->glusterfsDebugLevel = 4;
cfg->stdioLogD = true;
#ifdef DEFAULT_LOADER_NVRAM
@@ -780,6 +781,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup;
}
}
+ if (virConfGetValueUInt(conf, "glusterfs_debug_level",
&cfg->glusterfsDebugLevel) < 0)
+ goto cleanup;
ret = 0;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index d8232cc..89d046d 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -190,6 +190,7 @@ struct _virQEMUDriverConfig {
virFirmwarePtr *firmwares;
size_t nfirmwares;
+ unsigned int glusterfsDebugLevel;
};
/* Main driver state */
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 3d09468..9f3add3 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -237,6 +237,8 @@ struct _virStorageSource {
virStorageAuthDefPtr auth;
virStorageEncryptionPtr encryption;
+ unsigned int debug_level;
+
char *driverName;
int format; /* virStorageFileFormat in domain backing chains, but
* pool-specific enum for storage volumes */
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args
b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args
index f560308..deec7a7 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.args
@@ -16,9 +16,10 @@ QEMU_AUDIO_DRV=none \
-no-acpi \
-boot c \
-usb \
--drive file=gluster://example.org:6000/Volume1/Image,format=raw,if=virtio \
--drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,format=raw,\
-if=virtio' \
+-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\
+if=virtio \
+-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
+format=raw,if=virtio' \
-net none \
-serial none \
-parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args
index 634ed75..cd5294e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-gluster.args
@@ -17,18 +17,18 @@ QEMU_AUDIO_DRV=none \
-no-acpi \
-boot c \
-usb \
--drive file=gluster://example.org:6000/Volume1/Image,format=raw,if=none,\
-id=drive-virtio-disk0 \
+-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\
+if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0 \
--drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,format=raw,\
-if=none,id=drive-virtio-disk1' \
+-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
+format=raw,if=none,id=drive-virtio-disk1' \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive file.driver=gluster,file.volume=Volume3,file.path=/Image.qcow2,\
file.server.0.type=tcp,file.server.0.host=example.org,file.server.0.port=6000,\
file.server.1.type=tcp,file.server.1.host=example.org,file.server.1.port=24007,\
-file.server.2.type=unix,file.server.2.socket=/path/to/sock,format=qcow2,\
-if=none,id=drive-virtio-disk2 \
+file.server.2.type=unix,file.server.2.socket=/path/to/sock,file.debug=4,\
+format=qcow2,if=none,id=drive-virtio-disk2 \
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk2,\
id=virtio-disk2
--
2.7.4