diff mbox

[v3,1/3] block/gluster: fix QMP to match debug option

Message ID 1478105438-20883-2-git-send-email-prasanna.kalever@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Prasanna Kumar Kalever Nov. 2, 2016, 4:50 p.m. UTC
The QMP definition of BlockdevOptionsGluster:
{ 'struct': 'BlockdevOptionsGluster',
  'data': { 'volume': 'str',
            'path': 'str',
            'server': ['GlusterServer'],
            '*debug-level': 'int',
            '*logfile': 'str' } }

But instead of 'debug-level we have exported 'debug' as the option for choosing
debug level of gluster protocol driver.

This patch fix QMP definition BlockdevOptionsGluster
s/debug-level/debug/

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
---
 block/gluster.c      | 34 +++++++++++++++++-----------------
 qapi/block-core.json |  4 ++--
 2 files changed, 19 insertions(+), 19 deletions(-)

Comments

Eric Blake Dec. 5, 2016, 9:10 p.m. UTC | #1
On 11/02/2016 11:50 AM, Prasanna Kumar Kalever wrote:
> The QMP definition of BlockdevOptionsGluster:
> { 'struct': 'BlockdevOptionsGluster',
>   'data': { 'volume': 'str',
>             'path': 'str',
>             'server': ['GlusterServer'],
>             '*debug-level': 'int',
>             '*logfile': 'str' } }
> 
> But instead of 'debug-level we have exported 'debug' as the option for choosing
> debug level of gluster protocol driver.
> 
> This patch fix QMP definition BlockdevOptionsGluster
> s/debug-level/debug/
> 
> Suggested-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> ---
>  block/gluster.c      | 34 +++++++++++++++++-----------------
>  qapi/block-core.json |  4 ++--
>  2 files changed, 19 insertions(+), 19 deletions(-)
> 
> @@ -787,17 +787,17 @@ static int qemu_gluster_open(BlockDriverState *bs,  QDict *options,
>  
>      filename = qemu_opt_get(opts, GLUSTER_OPT_FILENAME);
>  
> -    s->debug_level = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
> +    s->debug = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
>                                           GLUSTER_DEBUG_DEFAULT);

Indentation is now off.  That's minor, a maintainer could fix it on commit.

> @@ -1010,14 +1010,14 @@ static int qemu_gluster_create(const char *filename,
>      char *tmp = NULL;
>  
>      gconf = g_new0(BlockdevOptionsGluster, 1);
> -    gconf->debug_level = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
> +    gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
>                                                   GLUSTER_DEBUG_DEFAULT);

and again

> +++ b/qapi/block-core.json
> @@ -2195,7 +2195,7 @@
>  #
>  # @server:      gluster servers description
>  #
> -# @debug-level: #optional libgfapi log level (default '4' which is Error)
> +# @debug:       #optional libgfapi log level (default '4' which is Error)
>  #
>  # @logfile:     #optional libgfapi log file (default /dev/stderr) (Since 2.8)
>  #
> @@ -2205,7 +2205,7 @@
>    'data': { 'volume': 'str',
>              'path': 'str',
>              'server': ['GlusterServer'],
> -            '*debug-level': 'int',
> +            '*debug': 'int',

This changes what introspection shows. We already declared that
blockdev-add is not stable in 2.7, and made some radical changes in 2.8
that are visible through introspection.  But we WANT to avoid any more
backwards-incompatible changes beyond 2.8, so on that grounds, this HAS
to go in to 2.8 if it is going in at all (otherwise, we have
inconsistent naming between QMP and the command line that we have to
document and keep forevermore).

Reviewed-by: Eric Blake <eblake@redhat.com>
Jeff Cody Dec. 5, 2016, 9:18 p.m. UTC | #2
On Mon, Dec 05, 2016 at 03:10:32PM -0600, Eric Blake wrote:
> On 11/02/2016 11:50 AM, Prasanna Kumar Kalever wrote:
> > The QMP definition of BlockdevOptionsGluster:
> > { 'struct': 'BlockdevOptionsGluster',
> >   'data': { 'volume': 'str',
> >             'path': 'str',
> >             'server': ['GlusterServer'],
> >             '*debug-level': 'int',
> >             '*logfile': 'str' } }
> > 
> > But instead of 'debug-level we have exported 'debug' as the option for choosing
> > debug level of gluster protocol driver.
> > 
> > This patch fix QMP definition BlockdevOptionsGluster
> > s/debug-level/debug/
> > 
> > Suggested-by: Eric Blake <eblake@redhat.com>
> > Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> > ---
> >  block/gluster.c      | 34 +++++++++++++++++-----------------
> >  qapi/block-core.json |  4 ++--
> >  2 files changed, 19 insertions(+), 19 deletions(-)
> > 
> > @@ -787,17 +787,17 @@ static int qemu_gluster_open(BlockDriverState *bs,  QDict *options,
> >  
> >      filename = qemu_opt_get(opts, GLUSTER_OPT_FILENAME);
> >  
> > -    s->debug_level = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
> > +    s->debug = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
> >                                           GLUSTER_DEBUG_DEFAULT);
> 
> Indentation is now off.  That's minor, a maintainer could fix it on commit.
> 
> > @@ -1010,14 +1010,14 @@ static int qemu_gluster_create(const char *filename,
> >      char *tmp = NULL;
> >  
> >      gconf = g_new0(BlockdevOptionsGluster, 1);
> > -    gconf->debug_level = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
> > +    gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
> >                                                   GLUSTER_DEBUG_DEFAULT);
> 
> and again
> 
> > +++ b/qapi/block-core.json
> > @@ -2195,7 +2195,7 @@
> >  #
> >  # @server:      gluster servers description
> >  #
> > -# @debug-level: #optional libgfapi log level (default '4' which is Error)
> > +# @debug:       #optional libgfapi log level (default '4' which is Error)
> >  #
> >  # @logfile:     #optional libgfapi log file (default /dev/stderr) (Since 2.8)
> >  #
> > @@ -2205,7 +2205,7 @@
> >    'data': { 'volume': 'str',
> >              'path': 'str',
> >              'server': ['GlusterServer'],
> > -            '*debug-level': 'int',
> > +            '*debug': 'int',
> 
> This changes what introspection shows. We already declared that
> blockdev-add is not stable in 2.7, and made some radical changes in 2.8
> that are visible through introspection.  But we WANT to avoid any more
> backwards-incompatible changes beyond 2.8, so on that grounds, this HAS
> to go in to 2.8 if it is going in at all (otherwise, we have
> inconsistent naming between QMP and the command line that we have to
> document and keep forevermore).
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 




Thanks,

Applied the series to my block branch, with Eric's indent suggestions fixed:

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

-Jeff
diff mbox

Patch

diff --git a/block/gluster.c b/block/gluster.c
index 0ce15f7..e23dc3b 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -48,7 +48,7 @@  typedef struct BDRVGlusterState {
     struct glfs_fd *fd;
     char *logfile;
     bool supports_seek_data;
-    int debug_level;
+    int debug;
 } BDRVGlusterState;
 
 typedef struct BDRVGlusterReopenState {
@@ -433,7 +433,7 @@  static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
         }
     }
 
-    ret = glfs_set_logging(glfs, gconf->logfile, gconf->debug_level);
+    ret = glfs_set_logging(glfs, gconf->logfile, gconf->debug);
     if (ret < 0) {
         goto out;
     }
@@ -787,17 +787,17 @@  static int qemu_gluster_open(BlockDriverState *bs,  QDict *options,
 
     filename = qemu_opt_get(opts, GLUSTER_OPT_FILENAME);
 
-    s->debug_level = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
+    s->debug = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG,
                                          GLUSTER_DEBUG_DEFAULT);
-    if (s->debug_level < 0) {
-        s->debug_level = 0;
-    } else if (s->debug_level > GLUSTER_DEBUG_MAX) {
-        s->debug_level = GLUSTER_DEBUG_MAX;
+    if (s->debug < 0) {
+        s->debug = 0;
+    } else if (s->debug > GLUSTER_DEBUG_MAX) {
+        s->debug = GLUSTER_DEBUG_MAX;
     }
 
     gconf = g_new0(BlockdevOptionsGluster, 1);
-    gconf->debug_level = s->debug_level;
-    gconf->has_debug_level = true;
+    gconf->debug = s->debug;
+    gconf->has_debug = true;
 
     logfile = qemu_opt_get(opts, GLUSTER_OPT_LOGFILE);
     s->logfile = g_strdup(logfile ? logfile : GLUSTER_LOGFILE_DEFAULT);
@@ -873,8 +873,8 @@  static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
     qemu_gluster_parse_flags(state->flags, &open_flags);
 
     gconf = g_new0(BlockdevOptionsGluster, 1);
-    gconf->debug_level = s->debug_level;
-    gconf->has_debug_level = true;
+    gconf->debug = s->debug;
+    gconf->has_debug = true;
     gconf->logfile = g_strdup(s->logfile);
     gconf->has_logfile = true;
     reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, NULL, errp);
@@ -1010,14 +1010,14 @@  static int qemu_gluster_create(const char *filename,
     char *tmp = NULL;
 
     gconf = g_new0(BlockdevOptionsGluster, 1);
-    gconf->debug_level = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
+    gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
                                                  GLUSTER_DEBUG_DEFAULT);
-    if (gconf->debug_level < 0) {
-        gconf->debug_level = 0;
-    } else if (gconf->debug_level > GLUSTER_DEBUG_MAX) {
-        gconf->debug_level = GLUSTER_DEBUG_MAX;
+    if (gconf->debug < 0) {
+        gconf->debug = 0;
+    } else if (gconf->debug > GLUSTER_DEBUG_MAX) {
+        gconf->debug = GLUSTER_DEBUG_MAX;
     }
-    gconf->has_debug_level = true;
+    gconf->has_debug = true;
 
     gconf->logfile = qemu_opt_get_del(opts, GLUSTER_OPT_LOGFILE);
     if (!gconf->logfile) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index bcd3b9e..a569cfb 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2195,7 +2195,7 @@ 
 #
 # @server:      gluster servers description
 #
-# @debug-level: #optional libgfapi log level (default '4' which is Error)
+# @debug:       #optional libgfapi log level (default '4' which is Error)
 #
 # @logfile:     #optional libgfapi log file (default /dev/stderr) (Since 2.8)
 #
@@ -2205,7 +2205,7 @@ 
   'data': { 'volume': 'str',
             'path': 'str',
             'server': ['GlusterServer'],
-            '*debug-level': 'int',
+            '*debug': 'int',
             '*logfile': 'str' } }
 
 ##