qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Jeff Cody <jcody@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org,
	armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] block/rbd: pull out qemu_rbd_convert_options
Date: Tue, 11 Sep 2018 14:06:12 -0400	[thread overview]
Message-ID: <332cf739-566c-d1a8-8423-6ee45f75aeb3@redhat.com> (raw)
In-Reply-To: <78d2f47b07325fce34a03b115159830f662b7f90.1536642773.git.jcody@redhat.com>



On 09/11/2018 01:15 AM, Jeff Cody wrote:
> Code movement to pull the conversion from Qdict to BlockdevOptionsRbd
> into a helper function.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  block/rbd.c | 36 ++++++++++++++++++++++++------------
>  1 file changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/block/rbd.c b/block/rbd.c
> index ca8e5bbace..a8e79d01d2 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -655,12 +655,34 @@ failed_opts:
>      return r;
>  }
>  
> +static int qemu_rbd_convert_options(BlockDriverState *bs, QDict *options,
> +                                    BlockdevOptionsRbd **opts, Error **errp)
> +{
> +    Visitor *v;
> +    Error *local_err = NULL;
> +
> +    /* Convert the remaining options into a QAPI object */
> +    v = qobject_input_visitor_new_flat_confused(options, errp);
> +    if (!v) {
> +        return -EINVAL;
> +    }
> +
> +    visit_type_BlockdevOptionsRbd(v, NULL, opts, &local_err);
> +    visit_free(v);
> +
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        return -EINVAL;
> +    }
> +
> +    return 0;
> +}
> +
>  static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
>                           Error **errp)
>  {
>      BDRVRBDState *s = bs->opaque;
>      BlockdevOptionsRbd *opts = NULL;
> -    Visitor *v;
>      const QDictEntry *e;
>      Error *local_err = NULL;
>      char *keypairs, *secretid;
> @@ -676,19 +698,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
>          qdict_del(options, "password-secret");
>      }
>  
> -    /* Convert the remaining options into a QAPI object */
> -    v = qobject_input_visitor_new_flat_confused(options, errp);
> -    if (!v) {
> -        r = -EINVAL;
> -        goto out;
> -    }
> -
> -    visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err);
> -    visit_free(v);
> -
> +    r = qemu_rbd_convert_options(bs, options, &opts, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
> -        r = -EINVAL;
>          goto out;
>      }
>  
> 

Reviewed-by: John Snow <jsnow@redhat.com>

  parent reply	other threads:[~2018-09-11 18:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  5:15 [Qemu-devel] [PATCH 0/2] block/rbd: enable filename parsing on open Jeff Cody
2018-09-11  5:15 ` [Qemu-devel] [PATCH 1/2] block/rbd: pull out qemu_rbd_convert_options Jeff Cody
2018-09-11 17:50   ` Eric Blake
2018-09-11 18:06   ` John Snow [this message]
2018-09-11  5:15 ` [Qemu-devel] [PATCH 2/2] block/rbd: Attempt to parse legacy filenames Jeff Cody
2018-09-11 17:53   ` Jeff Cody
2018-09-11 18:03   ` Eric Blake
2018-09-11 18:28     ` Jeff Cody
2018-09-11 18:22   ` John Snow
2018-09-11 18:37     ` Jeff Cody
2018-09-11 18:39       ` John Snow
2018-09-12 10:38       ` Kevin Wolf
2018-09-12 12:42         ` Jeff Cody
2018-09-12 12:49           ` Jeff Cody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=332cf739-566c-d1a8-8423-6ee45f75aeb3@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).