From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQb71-0003Xi-UE for qemu-devel@nongnu.org; Fri, 22 Jul 2016 10:07:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQb6x-0007tH-MO for qemu-devel@nongnu.org; Fri, 22 Jul 2016 10:07:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQb6x-0007t4-DK for qemu-devel@nongnu.org; Fri, 22 Jul 2016 10:07:31 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D89597EA82 for ; Fri, 22 Jul 2016 14:07:30 +0000 (UTC) References: <1469188874-9292-1-git-send-email-prasanna.kalever@redhat.com> From: Eric Blake Message-ID: <579228A1.5040007@redhat.com> Date: Fri, 22 Jul 2016 08:07:29 -0600 MIME-Version: 1.0 In-Reply-To: <1469188874-9292-1-git-send-email-prasanna.kalever@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EJNJFSanXgluTDSIaJrhsjWTMleJudJT0" Subject: Re: [Qemu-devel] [PATCH v3] block/gluster: add support to choose libgfapi logfile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Prasanna Kumar Kalever , qemu-devel@nongnu.org Cc: armbru@redhat.com, jcody@redhat.com, vbellur@redhat.com, rtalur@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EJNJFSanXgluTDSIaJrhsjWTMleJudJT0 From: Eric Blake To: Prasanna Kumar Kalever , qemu-devel@nongnu.org Cc: armbru@redhat.com, jcody@redhat.com, vbellur@redhat.com, rtalur@redhat.com Message-ID: <579228A1.5040007@redhat.com> Subject: Re: [PATCH v3] block/gluster: add support to choose libgfapi logfile References: <1469188874-9292-1-git-send-email-prasanna.kalever@redhat.com> In-Reply-To: <1469188874-9292-1-git-send-email-prasanna.kalever@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/22/2016 06:01 AM, Prasanna Kumar Kalever wrote: > currently all the libgfapi logs defaults to '/dev/stderr' as it was har= dcoded > in a call to glfs logging api, in case if debug level is chosen to DEBU= G/TRACE s/api, in case if/api. When the/ s/TRACE/TRACE,/ > gfapi logs will be huge and fill/overflow the console view. >=20 > this patch provides a commandline option to mention log file path which= helps s/this/This/ > in logging to the specified file and also help in persisting the gfapi = logs. >=20 > Usage: > ----- > *URI Style: > --------- > -drive file=3Dgluster://hostname/volname/image.qcow2,file.debug=3D9,\= > file.logfile=3D/var/log/qemu/qemu-gfapi.log >=20 > +++ b/block/gluster.c > @@ -26,10 +26,12 @@ > #define GLUSTER_OPT_IPV4 "ipv4" > #define GLUSTER_OPT_IPV6 "ipv6" > #define GLUSTER_OPT_SOCKET "socket" > -#define GLUSTER_OPT_DEBUG "debug" > #define GLUSTER_DEFAULT_PORT 24007 > +#define GLUSTER_OPT_DEBUG "debug" Why move this line? > #define GLUSTER_DEBUG_DEFAULT 4 > #define GLUSTER_DEBUG_MAX 9 > +#define GLUSTER_OPT_LOGFILE "logfile" > +#define GLUSTER_LOGFILE_DEFAULT "-" /* handled in libgfapi as /dev= /stderr */ > =20 > @@ -576,7 +589,9 @@ static struct glfs *qemu_gluster_init(BlockdevOptio= nsGluster *gconf, > if (ret < 0) { > error_setg(errp, "invalid URI"); > error_append_hint(errp, "Usage: file=3Dgluster[+transport]= ://" > - "[host[:port]]/volume/path[?socket= =3D...]\n"); > + "[host[:port]]volname/image[?socke= t=3D...]" Why did you change absolute "/volume/path" to relative "volname/image"? > + "[,file.debug=3DN]" > + "[,file.logfile=3D/path/filename.l= og]\n"); > errno =3D -ret; > return NULL; > } > @@ -586,7 +601,8 @@ static struct glfs *qemu_gluster_init(BlockdevOptio= nsGluster *gconf, > error_append_hint(errp, "Usage: " > "-drive driver=3Dqcow2,file.driver=3Dglus= ter," > "file.volume=3Dtestvol,file.path=3D/path/= a.qcow2" > - "[,file.debug=3D9],file.server.0.type=3Dt= cp," > + "[,file.debug=3D9][,file.logfile=3D/path/= filename.log]" > + "file.server.0.type=3Dtcp," Missing a comma between the file.logfile and file.server keys. > "file.server.0.host=3D1.2.3.4," > "file.server.0.port=3D24007," > "file.server.1.transport=3Dunix," > @@ -677,7 +693,7 @@ static int qemu_gluster_open(BlockDriverState *bs, = QDict *options, > BlockdevOptionsGluster *gconf =3D NULL; > QemuOpts *opts; > Error *local_err =3D NULL; > - const char *filename; > + const char *filename, *logfile; > =20 > opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); > qemu_opts_absorb_qdict(opts, options, &local_err); > @@ -700,6 +716,17 @@ static int qemu_gluster_open(BlockDriverState *bs,= QDict *options, > gconf =3D g_new0(BlockdevOptionsGluster, 1); > gconf->debug_level =3D s->debug_level; > gconf->has_debug_level =3D true; > + > + logfile =3D qemu_opt_get(opts, GLUSTER_OPT_LOGFILE); > + if (logfile) { > + s->logfile =3D g_strdup(logfile); > + } else { > + s->logfile =3D g_strdup(GLUSTER_LOGFILE_DEFAULT); > + } I might have written s->logfile =3D g_strdup(logfile ? logfile : GLUSTER_LOGFILE_DEFAULT); > +++ b/qapi/block-core.json > @@ -2138,13 +2138,16 @@ > # > # @debug-level: #optional libgfapi log level (default '4' which is Err= or) > # > +# @logfile: #optional libgfapi log file (default /dev/stderr) > +# > # Since: 2.7 > ## > { 'struct': 'BlockdevOptionsGluster', > 'data': { 'volume': 'str', > 'path': 'str', > 'server': ['GlusterServer'], > - '*debug_level': 'int' } } > + '*debug_level': 'int', > + '*logfile': 'str' } } Very borderline on whether this qualifies as a bugfix, or if it is a feature to be deferred to 2.8. I'll let the maintainer chime in. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --EJNJFSanXgluTDSIaJrhsjWTMleJudJT0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXkiihAAoJEKeha0olJ0NqEGgIAIk7M2/upmngQAkzrJ0TvzgM /q7IxDc5CDH3fMiwGC2+O+61Pd38Duu0zo1a8yoXXCj5tS8Oz+kJIwhGuRUgc6Gc o5Jz5lmcjz6mGeK2Zn4w9hVtYkYZx43Mh9CNuP9t8TCjAYE4qGSdTXEfH/HCMgi6 cdY3KXoizZ6ev34vs5l8noZyAlhVZLjwAgADf5gIAPagVwccdgl4z52p/VcQkYcG NhwUFfP4Rry+M1AQ/kv3Oy/F9yLL5DbnAJkrgG/b2vvZ2dYEjENpkVxPgEBR0tZf 3ipS7H8H2lv7hcRJ/jX7L0bnuhQpQVV7hzsrDSoiLhikxrqFMabU0Bac8JoAzGk= =yhS4 -----END PGP SIGNATURE----- --EJNJFSanXgluTDSIaJrhsjWTMleJudJT0--