Skip to contentSkip to conversation

block/nfs: add support for setting debug level

PATCH Applied Peter Lieven 5 participants 10 messages Nov 9, 2015 – Jan 11, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
block/nfs.c +12 -0
index fd79f89..ab1e267 100644
@@ -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);
Signature · 1 line
1.9.1
Reviewed-by on v5 1/1
#1 lore raw
Quoted 34 lines · Peter Lieven

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
block/nfs.c +2 -0
index fd79f89..ab1e267 100644
@@ -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

block/nfs.c static int64_t nfs_client_open(NFSClient *client, const char *filename, · line 348

Quoted 10 lines
block/nfs.c +10 -0
+        } 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

It would be slightly nicer to do:

        } else if (!strcmp(qp->p[i].name, "debug")) {
#ifdef LIBNFS_FEATURE_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);

#else
error_report("Specifying debug level is only supported by libnfs"
" version >= XXX");
#endif

So that you know which one out of QEMU and libnfs to upgrade when the option is refused. :)

But it's your call. Either way:

Quoted 6 lines
block/nfs.c +0 -0
         } else {
             error_setg(errp, "Unknown NFS parameter name: %s",
                        qp->p[i].name);
Signature · 1 line
1.9.1
#2 lore raw
In reply to Peter Lieven
Quoted 14 lines · Peter Lieven

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Stefan

#3 lore raw

Am 13.11.2015 um 10:45 schrieb Stefan Hajnoczi:

Quoted 15 lines · Peter Lieven
Quoted 14 lines

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 6 lines
Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Okay. I think I used that email because you replayed to earlier versions of this Patch from your Gmail address.

Quoted 4 lines

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Thats not critical in this case. I think same applies for the ATAPI stuff we worked on? There you used also your GMail account. Or can this be treated as a bugfix?

Peter

#4 lore raw
Quoted 27 lines · Peter Lieven

Am 13.11.2015 um 10:45 schrieb Stefan Hajnoczi:

Quoted 15 lines · Peter Lieven
Quoted 14 lines

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 6 lines
Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Okay. I think I used that email because you replayed to earlier versions of this Patch from your Gmail address.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Thats not critical in this case. I think same applies for the ATAPI stuff we worked on? There you used also your GMail account. Or can this be treated as a bugfix?

The ATAPI patches go through John Snow. It's up to him whether they are considered a bug fix suitable for 2.5 or too risky.

Stefan

#5 lore raw
Quoted 32 lines · Stefan Hajnoczi
Quoted 31 lines · Peter Lieven

Am 13.11.2015 um 10:45 schrieb Stefan Hajnoczi:

Quoted 15 lines · Peter Lieven
Quoted 14 lines

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 6 lines
Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Okay. I think I used that email because you replayed to earlier versions of this Patch from your Gmail address.

Quoted 4 lines

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Quoted 9 lines
Quoted 3 lines

Thats not critical in this case. I think same applies for the ATAPI stuff we worked on? There you used also your GMail account. Or can this be treated as a bugfix?

The ATAPI patches go through John Snow. It's up to him whether they are considered a bug fix suitable for 2.5 or too risky.

Stefan

I've tested them pretty thoroughly; I think they're safe (ATAPI-wise) provided the buffered DMA helpers look sane (They look sane to me.) The modifications to the giant atapi-return-code blob are well understood at this point and are definitely fine.

--js

#6 lore raw
In reply to Stefan Hajnoczi
Quoted 18 lines · Stefan Hajnoczi
Quoted 14 lines · Peter Lieven

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 9 lines

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Actually, this should go in through my branch, right? I didn't see it before the hard freeze either (I was not on the cc list). If you want to queue it that is fine, otherwise I'll add it to my 2.6 queue.

#7 lore raw
Quoted 24 lines · Jeff Cody
Quoted 23 lines · Stefan Hajnoczi
Quoted 14 lines · Peter Lieven

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Quoted 8 lines
Quoted 4 lines

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Actually, this should go in through my branch, right? I didn't see it before the hard freeze either (I was not on the cc list). If you want to queue it that is fine, otherwise I'll add it to my 2.6 queue.

Yes:

$ scripts/get_maintainer.pl -f block/nfs.c
Jeff Cody <[email protected]> (maintainer:NFS)
Peter Lieven <[email protected]> (maintainer:NFS)
Kevin Wolf <[email protected]> (supporter:Block layer core)
[email protected] (open list:NFS)

I've been involved with the review of this series for a while and overlooked it.

Stefan

#8 lore raw
In reply to Stefan Hajnoczi

Am 13.11.2015 um 10:45 schrieb Stefan Hajnoczi:

Quoted 17 lines · Peter Lieven
Quoted 14 lines

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 8 lines

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Hi Stefan,

can you pick up this one for 2.6 now?

Thanks,
Peter

Applied
#9 lore raw
Quoted 27 lines · Peter Lieven

Am 13.11.2015 um 10:45 schrieb Stefan Hajnoczi:

Quoted 17 lines · Peter Lieven
Quoted 14 lines

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

---
v4->v5: add a comment in the code why we limit the debug level [Stefan] v3->v4: revert to the initial version, but limit max debug level v2->v3: use a per-drive option instead of a global one. [Stefan] v1->v2: reworked patch to accept the debug level as a cmdline
parameter instead of an URI parameter [Stefan]

Quoted 2 lines
 block/nfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 8 lines

Hi Peter,
Please use my official maintainer email address <[email protected]> when CCing me. I didn't spot the mail to GMail until after the QEMU 2.5 hard freeze deadline.

Only bug fixes are being merged for QEMU 2.5 now. I'm sorry that this patch didn't make it. My block-next branch will be opening on Monday and I'll merge this patch there for QEMU 2.6.

Quoted 8 lines

Hi Stefan,

can you pick up this one for 2.6 now?

Thanks,
Peter

Hi Peter,

I've applied it to my branch, for 2.6:

git://github.com/codyprime/qemu-kvm-jtc.git block

Thanks,
Jeff