From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuf98-0003Z5-Jr for qemu-devel@nongnu.org; Fri, 06 Nov 2015 06:25:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zuf93-0003xe-6b for qemu-devel@nongnu.org; Fri, 06 Nov 2015 06:25:30 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:42139 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuf92-0003wO-UN for qemu-devel@nongnu.org; Fri, 06 Nov 2015 06:25:25 -0500 Message-ID: <563C8E1E.9030908@kamp.de> Date: Fri, 06 Nov 2015 12:25:18 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1446762334-554-1-git-send-email-pl@kamp.de> <20151106112339.GG12285@stefanha-x1.localdomain> In-Reply-To: <20151106112339.GG12285@stefanha-x1.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V4] block/nfs: add support for setting debug level List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com Am 06.11.2015 um 12:23 schrieb Stefan Hajnoczi: > On Thu, Nov 05, 2015 at 11:25:34PM +0100, Peter Lieven wrote: >> 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 >> --- >> 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 | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/block/nfs.c b/block/nfs.c >> index fd79f89..fbea25a 100644 >> --- a/block/nfs.c >> +++ b/block/nfs.c >> @@ -36,6 +36,7 @@ >> #include >> >> #define QEMU_NFS_MAX_READAHEAD_SIZE 1048576 >> +#define QEMU_NFS_MAX_DEBUG_LEVEL 2 >> >> typedef struct NFSClient { >> struct nfs_context *context; >> @@ -334,6 +335,15 @@ 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")) { >> + 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 > Please include the rationale for limiting the debug level as a comment > in the code. Otherwise people may read the code and not understand why > we do this. Okay. Then we should add this to the readahead limitation as well. > > The error message should indicate how to set high debug levels (if > possible). A simple "You can't do that" error message is frustrating > :). But thats the case at the moment ;-) Peter