On 2018-03-09 22:46, Kevin Wolf wrote: > This adds the .bdrv_co_create driver callback to parallels, which > enables image creation over QMP. > > Signed-off-by: Kevin Wolf <[email protected]> > --- > qapi/block-core.json | 18 ++++- > block/parallels.c | 199 > ++++++++++++++++++++++++++++++++++++++------------- > 2 files changed, 168 insertions(+), 49 deletions(-)
[...]
> diff --git a/block/parallels.c b/block/parallels.c
> index c13cb619e6..2da5e56a9d 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
[...]
> @@ -542,24 +580,107 @@ static int coroutine_fn parallels_co_create_opts(const
> char *filename,
[...]
> +static int coroutine_fn parallels_co_create_opts(const char *filename,
> + QemuOpts *opts,
> + Error **errp)
> +{
[...]
> + /* Now get the QAPI type BlockdevCreateOptions */
> + qdict_put_str(qdict, "driver", "parallels");
> + qdict_put_str(qdict, "file", bs->node_name);
> +
> + qobj = qdict_crumple(qdict, errp);
Any reason for this crumpling other than because it doesn't change
anything and if it did, it would be for the better?
The rest looks OK to me, and I just think this creates an exact copy of
qdict, so I guess:
Reviewed-by: Max Reitz <[email protected]>
> + QDECREF(qdict);
> + qdict = qobject_to_qdict(qobj);
> + if (qdict == NULL) {
> + ret = -EINVAL;
> + goto done;
> + }
> +
> + v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
> + visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
> + visit_free(v);
signature.asc
Description: OpenPGP digital signature
