aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2015-11-09 08:09:33 +0100
committerJeff Cody <jcody@redhat.com>2016-02-29 14:54:30 -0500
commit7725b8bf129de6887fb680da28775fab5eded914 (patch)
tree43b5d204a3632d4576dc4a73697227228f85ab49 /block
parent071608b519adf62bc29c914343a21c5407ab1ac9 (diff)
block/nfs: add support for setting debug level
recent libnfs versions support logging debug messages. Add support for it in qemu through an URL parameter. Example: qemu -cdrom nfs://127.0.0.1/iso/my.iso?debug=2 Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1447052973-14513-1-git-send-email-pl@kamp.de Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/nfs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/block/nfs.c b/block/nfs.c
index 5eb8c133b9..7220e8991b 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -36,6 +36,7 @@
#include <nfsc/libnfs.h>
#define QEMU_NFS_MAX_READAHEAD_SIZE 1048576
+#define QEMU_NFS_MAX_DEBUG_LEVEL 2
typedef struct NFSClient {
struct nfs_context *context;
@@ -334,6 +335,17 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename,
}
nfs_set_readahead(client->context, val);
#endif
+#ifdef LIBNFS_FEATURE_DEBUG
+ } else if (!strcmp(qp->p[i].name, "debug")) {
+ /* limit the maximum debug level to avoid potential flooding
+ * of our log files. */
+ if (val > QEMU_NFS_MAX_DEBUG_LEVEL) {
+ error_report("NFS Warning: Limiting NFS debug level"
+ " to %d", QEMU_NFS_MAX_DEBUG_LEVEL);
+ val = QEMU_NFS_MAX_DEBUG_LEVEL;
+ }
+ nfs_set_debug(client->context, val);
+#endif
} else {
error_setg(errp, "Unknown NFS parameter name: %s",
qp->p[i].name);