* [Qemu-devel] [PULL 0/2] Block patches @ 2016-09-13 5:42 Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile Jeff Cody ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Jeff Cody @ 2016-09-13 5:42 UTC (permalink / raw) To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel The following changes since commit 7263da78045dc91cc207f350911efe4259e99b3c: Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging (2016-09-12 15:09:47 +0100) are available in the git repository at: git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request for you to fetch changes up to c76d7aab81c264e3452e778f030fb3760e5edbb9: qapi/block-core: add doc describing GlusterServer vs. SocketAddress (2016-09-13 01:34:55 -0400) ---------------------------------------------------------------- Block patches ---------------------------------------------------------------- Prasanna Kumar Kalever (2): block/gluster: add support to choose libgfapi logfile qapi/block-core: add doc describing GlusterServer vs. SocketAddress block/gluster.c | 42 ++++++++++++++++++++++++++++++++++++++---- qapi/block-core.json | 17 ++++++++++++++++- 2 files changed, 54 insertions(+), 5 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile 2016-09-13 5:42 [Qemu-devel] [PULL 0/2] Block patches Jeff Cody @ 2016-09-13 5:42 ` Jeff Cody 2016-09-13 15:23 ` Eric Blake 2016-09-13 5:42 ` [Qemu-devel] [PULL 2/2] qapi/block-core: add doc describing GlusterServer vs. SocketAddress Jeff Cody 2016-09-13 11:59 ` [Qemu-devel] [PULL 0/2] Block patches Peter Maydell 2 siblings, 1 reply; 6+ messages in thread From: Jeff Cody @ 2016-09-13 5:42 UTC (permalink / raw) To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> currently all the libgfapi logs defaults to '/dev/stderr' as it was hardcoded in a call to glfs logging api. When the debug level is chosen to DEBUG/TRACE, gfapi logs will be huge and fill/overflow the console view. This patch provides a commandline option to mention log file path which helps in logging to the specified file and also help in persisting the gfapi logs. Usage: ----- *URI Style: --------- -drive file=gluster://hostname/volname/image.qcow2,file.debug=9,\ file.logfile=/var/log/qemu/qemu-gfapi.log *JSON Style: ---------- 'json:{ "driver":"qcow2", "file":{ "driver":"gluster", "volume":"volname", "path":"image.qcow2", "debug":"9", "logfile":"/var/log/qemu/qemu-gfapi.log", "server":[ { "type":"tcp", "host":"1.2.3.4", "port":24007 }, { "type":"unix", "socket":"/var/run/glusterd.socket" } ] } }' Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> --- block/gluster.c | 42 ++++++++++++++++++++++++++++++++++++++---- qapi/block-core.json | 5 ++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index 01b479f..e7bd13c 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -30,6 +30,8 @@ #define GLUSTER_DEFAULT_PORT 24007 #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 */ #define GERR_INDEX_HINT "hint: check in 'server' array index '%d'\n" @@ -44,6 +46,7 @@ typedef struct GlusterAIOCB { typedef struct BDRVGlusterState { struct glfs *glfs; struct glfs_fd *fd; + char *logfile; bool supports_seek_data; int debug_level; } BDRVGlusterState; @@ -73,6 +76,11 @@ static QemuOptsList qemu_gluster_create_opts = { .type = QEMU_OPT_NUMBER, .help = "Gluster log level, valid range is 0-9", }, + { + .name = GLUSTER_OPT_LOGFILE, + .type = QEMU_OPT_STRING, + .help = "Logfile path of libgfapi", + }, { /* end of list */ } } }; @@ -91,6 +99,11 @@ static QemuOptsList runtime_opts = { .type = QEMU_OPT_NUMBER, .help = "Gluster log level, valid range is 0-9", }, + { + .name = GLUSTER_OPT_LOGFILE, + .type = QEMU_OPT_STRING, + .help = "Logfile path of libgfapi", + }, { /* end of list */ } }, }; @@ -341,7 +354,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, } } - ret = glfs_set_logging(glfs, "-", gconf->debug_level); + ret = glfs_set_logging(glfs, gconf->logfile, gconf->debug_level); if (ret < 0) { goto out; } @@ -576,7 +589,9 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf, if (ret < 0) { error_setg(errp, "invalid URI"); error_append_hint(errp, "Usage: file=gluster[+transport]://" - "[host[:port]]/volume/path[?socket=...]\n"); + "[host[:port]]volume/path[?socket=...]" + "[,file.debug=N]" + "[,file.logfile=/path/filename.log]\n"); errno = -ret; return NULL; } @@ -586,7 +601,9 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf, error_append_hint(errp, "Usage: " "-drive driver=qcow2,file.driver=gluster," "file.volume=testvol,file.path=/path/a.qcow2" - "[,file.debug=9],file.server.0.type=tcp," + "[,file.debug=9]" + "[,file.logfile=/path/filename.log]," + "file.server.0.type=tcp," "file.server.0.host=1.2.3.4," "file.server.0.port=24007," "file.server.1.transport=unix," @@ -677,7 +694,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, BlockdevOptionsGluster *gconf = NULL; QemuOpts *opts; Error *local_err = NULL; - const char *filename; + const char *filename, *logfile; opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); @@ -700,6 +717,13 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, gconf = g_new0(BlockdevOptionsGluster, 1); gconf->debug_level = s->debug_level; gconf->has_debug_level = true; + + logfile = qemu_opt_get(opts, GLUSTER_OPT_LOGFILE); + s->logfile = g_strdup(logfile ? logfile : GLUSTER_LOGFILE_DEFAULT); + + gconf->logfile = g_strdup(s->logfile); + gconf->has_logfile = true; + s->glfs = qemu_gluster_init(gconf, filename, options, errp); if (!s->glfs) { ret = -errno; @@ -738,6 +762,7 @@ out: if (!ret) { return ret; } + g_free(s->logfile); if (s->fd) { glfs_close(s->fd); } @@ -769,6 +794,8 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state, gconf = g_new0(BlockdevOptionsGluster, 1); gconf->debug_level = s->debug_level; gconf->has_debug_level = true; + gconf->logfile = g_strdup(s->logfile); + gconf->has_logfile = true; reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, NULL, errp); if (reop_s->glfs == NULL) { ret = -errno; @@ -914,6 +941,12 @@ static int qemu_gluster_create(const char *filename, } gconf->has_debug_level = true; + gconf->logfile = qemu_opt_get_del(opts, GLUSTER_OPT_LOGFILE); + if (!gconf->logfile) { + gconf->logfile = g_strdup(GLUSTER_LOGFILE_DEFAULT); + } + gconf->has_logfile = true; + glfs = qemu_gluster_init(gconf, filename, NULL, errp); if (!glfs) { ret = -errno; @@ -1025,6 +1058,7 @@ static void qemu_gluster_close(BlockDriverState *bs) { BDRVGlusterState *s = bs->opaque; + g_free(s->logfile); if (s->fd) { glfs_close(s->fd); s->fd = NULL; diff --git a/qapi/block-core.json b/qapi/block-core.json index 31f9990..59128f7 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2154,13 +2154,16 @@ # # @debug-level: #optional libgfapi log level (default '4' which is Error) # +# @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' } } ## # @BlockdevOptions -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile 2016-09-13 5:42 ` [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile Jeff Cody @ 2016-09-13 15:23 ` Eric Blake 2016-09-13 15:25 ` Jeff Cody 0 siblings, 1 reply; 6+ messages in thread From: Eric Blake @ 2016-09-13 15:23 UTC (permalink / raw) To: Jeff Cody, qemu-block; +Cc: peter.maydell, qemu-devel [-- Attachment #1: Type: text/plain, Size: 961 bytes --] On 09/13/2016 12:42 AM, Jeff Cody wrote: > From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> > > currently all the libgfapi logs defaults to '/dev/stderr' as it was hardcoded > in a call to glfs logging api. When the debug level is chosen to DEBUG/TRACE, > gfapi logs will be huge and fill/overflow the console view. > > This patch provides a commandline option to mention log file path which helps > in logging to the specified file and also help in persisting the gfapi logs. > > +++ b/qapi/block-core.json > @@ -2154,13 +2154,16 @@ > # > # @debug-level: #optional libgfapi log level (default '4' which is Error) > # > +# @logfile: #optional libgfapi log file (default /dev/stderr) > +# > # Since: 2.7 logfile missed 2.7; please add a '(since 2.8)' designator on the @logfile line as a followup patch. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 604 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile 2016-09-13 15:23 ` Eric Blake @ 2016-09-13 15:25 ` Jeff Cody 0 siblings, 0 replies; 6+ messages in thread From: Jeff Cody @ 2016-09-13 15:25 UTC (permalink / raw) To: Eric Blake; +Cc: qemu-block, peter.maydell, qemu-devel On Tue, Sep 13, 2016 at 10:23:32AM -0500, Eric Blake wrote: > On 09/13/2016 12:42 AM, Jeff Cody wrote: > > From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> > > > > currently all the libgfapi logs defaults to '/dev/stderr' as it was hardcoded > > in a call to glfs logging api. When the debug level is chosen to DEBUG/TRACE, > > gfapi logs will be huge and fill/overflow the console view. > > > > This patch provides a commandline option to mention log file path which helps > > in logging to the specified file and also help in persisting the gfapi logs. > > > > > +++ b/qapi/block-core.json > > @@ -2154,13 +2154,16 @@ > > # > > # @debug-level: #optional libgfapi log level (default '4' which is Error) > > # > > +# @logfile: #optional libgfapi log file (default /dev/stderr) > > +# > > # Since: 2.7 > > logfile missed 2.7; please add a '(since 2.8)' designator on the > @logfile line as a followup patch. > > Yep, thanks for catching that Eric. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/2] qapi/block-core: add doc describing GlusterServer vs. SocketAddress 2016-09-13 5:42 [Qemu-devel] [PULL 0/2] Block patches Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile Jeff Cody @ 2016-09-13 5:42 ` Jeff Cody 2016-09-13 11:59 ` [Qemu-devel] [PULL 0/2] Block patches Peter Maydell 2 siblings, 0 replies; 6+ messages in thread From: Jeff Cody @ 2016-09-13 5:42 UTC (permalink / raw) To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Added documentation describing relation between GlusterServer and SocketAddress qapi schemas. Thanks to Markus Armbruster <armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Message-id: 1471715924-3642-1-git-send-email-prasanna.kalever@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com> --- qapi/block-core.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qapi/block-core.json b/qapi/block-core.json index 59128f7..173fb08 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2133,6 +2133,18 @@ # # @tcp: host address and port number # +# This is similar to SocketAddress, only distinction: +# +# 1. GlusterServer is a flat union, SocketAddress is a simple union. +# A flat union is nicer than simple because it avoids nesting +# (i.e. more {}) on the wire. +# +# 2. GlusterServer lacks case 'fd', since gluster doesn't let you +# pass in a file descriptor. +# +# GlusterServer is actually not Gluster-specific, its a +# compatibility evolved into an alternate for SocketAddress. +# # Since: 2.7 ## { 'union': 'GlusterServer', -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/2] Block patches 2016-09-13 5:42 [Qemu-devel] [PULL 0/2] Block patches Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 2/2] qapi/block-core: add doc describing GlusterServer vs. SocketAddress Jeff Cody @ 2016-09-13 11:59 ` Peter Maydell 2 siblings, 0 replies; 6+ messages in thread From: Peter Maydell @ 2016-09-13 11:59 UTC (permalink / raw) To: Jeff Cody; +Cc: Qemu-block, QEMU Developers On 13 September 2016 at 06:42, Jeff Cody <jcody@redhat.com> wrote: > The following changes since commit 7263da78045dc91cc207f350911efe4259e99b3c: > > Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging (2016-09-12 15:09:47 +0100) > > are available in the git repository at: > > git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request > > for you to fetch changes up to c76d7aab81c264e3452e778f030fb3760e5edbb9: > > qapi/block-core: add doc describing GlusterServer vs. SocketAddress (2016-09-13 01:34:55 -0400) > > ---------------------------------------------------------------- > Block patches > ---------------------------------------------------------------- > > Prasanna Kumar Kalever (2): > block/gluster: add support to choose libgfapi logfile > qapi/block-core: add doc describing GlusterServer vs. SocketAddress > > block/gluster.c | 42 ++++++++++++++++++++++++++++++++++++++---- > qapi/block-core.json | 17 ++++++++++++++++- > 2 files changed, 54 insertions(+), 5 deletions(-) Applied, thanks. -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-13 15:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-13 5:42 [Qemu-devel] [PULL 0/2] Block patches Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 1/2] block/gluster: add support to choose libgfapi logfile Jeff Cody 2016-09-13 15:23 ` Eric Blake 2016-09-13 15:25 ` Jeff Cody 2016-09-13 5:42 ` [Qemu-devel] [PULL 2/2] qapi/block-core: add doc describing GlusterServer vs. SocketAddress Jeff Cody 2016-09-13 11:59 ` [Qemu-devel] [PULL 0/2] Block patches Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).