[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 09/11] block/qcow2: implement blockdev-amend
From: |
Maxim Levitsky |
Subject: |
Re: [PATCH v2 09/11] block/qcow2: implement blockdev-amend |
Date: |
Fri, 08 Nov 2019 17:18:56 +0200 |
On Fri, 2019-10-04 at 21:03 +0200, Max Reitz wrote:
> On 13.09.19 00:30, Maxim Levitsky wrote:
> > Currently only for changing crypto parameters
>
> Yep, that elegantly avoids most of the problems we’d have otherwise. :-)
>
> > Signed-off-by: Maxim Levitsky <address@hidden>
> > ---
> > block/qcow2.c | 71 ++++++++++++++++++++++++++++++++++++++++++++
> > qapi/block-core.json | 6 ++--
> > 2 files changed, 75 insertions(+), 2 deletions(-)
> >
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index 26f83aeb44..c8847ec6e2 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -3079,6 +3079,18 @@ qcow2_co_create(BlockdevCreateOptions
> > *create_options, Error **errp)
> > assert(create_options->driver == BLOCKDEV_DRIVER_QCOW2);
> > qcow2_opts = &create_options->u.qcow2;
> >
> > + if (!qcow2_opts->has_size) {
> > + error_setg(errp, "Size is manadatory for image creation");
> > + return -EINVAL;
> > +
> > + }
> > +
> > + if (!qcow2_opts->has_file) {
> > + error_setg(errp, "'file' is manadatory for image creation");
> > + return -EINVAL;
> > +
> > + }
> > +
> > bs = bdrv_open_blockdev_ref(qcow2_opts->file, errp);
> > if (bs == NULL) {
> > return -EIO;
> > @@ -5111,6 +5123,64 @@ static int qcow2_amend_options(BlockDriverState *bs,
> > QemuOpts *opts,
> > return 0;
> > }
> >
> > +
> > +static int coroutine_fn qcow2_co_amend(BlockDriverState *bs,
> > + BlockdevCreateOptions *opts,
> > + bool force,
> > + Error **errp)
> > +{
> > + BlockdevCreateOptionsQcow2 *qopts = &opts->u.qcow2;
> > + BDRVQcow2State *s = bs->opaque;
> > + int ret;
> > +
> > + /*
> > + * This is ugly as hell, in later versions of this patch
> > + * something has to be done about this
>
> Well, at least the language of the comment needs adjustment. :-)
Thats for sure :-)
BTW, if I opt for having a separate amend parameter struct,
this will fix this problem as well, as all unsupported
fields will just not be there.
[..]
Best regards,
Maxim Levitsky