Re: [PATCH 10/13] block: add generic infrastructure for x-blockdev-amend qmp command

2020-01-21 Thread Maxim Levitsky
On Tue, 2020-01-21 at 08:59 +0100, Markus Armbruster wrote:
> Maxim Levitsky  writes:
> 
> > blockdev-amend will be used similiar to blockdev-create
> > to allow on the fly changes of the structure of the format based block 
> > devices.
> > 
> > Current plan is to first support encryption keyslot management for luks
> > based formats (raw and embedded in qcow2)
> > 
> > Signed-off-by: Maxim Levitsky 
> 
> [...]
> > diff --git a/qapi/block-core.json b/qapi/block-core.json
> > index 7ff5e5edaf..601f7dc9a4 100644
> > --- a/qapi/block-core.json
> > +++ b/qapi/block-core.json
> > @@ -4743,6 +4743,48 @@
> >'data': { 'job-id': 'str',
> >  'options': 'BlockdevCreateOptions' } }
> >  
> > +##
> > +# @BlockdevAmendOptions:
> > +#
> > +# Options for amending an image format
> > +#
> > +# @driver   block driver that is suitable for the image
> > +#
> > +# Since: 5.0
> > +##
> > +{ 'union': 'BlockdevAmendOptions',
> > +  'base': {
> > +  'driver': 'BlockdevDriver' },
> > +  'discriminator': 'driver',
> > +  'data': {
> > +  } }
> > +
> > +##
> > +# @x-blockdev-amend:
> > +#
> > +# Starts a job to amend format specific options of an existing open block 
> > device
> > +# The job is automatically finalized, but a manual job-dismiss is required.
> > +#
> > +# @job-id:  Identifier for the newly created job.
> > +#
> > +# @node-name:   Name of the block node to work on
> > +#
> > +# @options: Options (driver specific)
> > +#
> > +# @force:   Allow unsafe operations, format specific
> > +#   For luks that allows erase of the last active keyslot
> > +#   (permanent loss of data),
> > +#   and replacement of an active keyslot
> > +#   (possible loss of data if IO error happens)
> 
> PATCH 2 appears to reject that.  What am I missing?

this parameter overrides the safety checks for both operations.
It allows to erase all the keyslots (to allow to destroy the data
in unrecoverable way very fast), and it allows to overwrite an active
keyslot, which is not as dramatic, but in case of IO failure can
also result in bad things happening.

> 
> > +#
> > +# Since: 5.0
> > +##
> > +{ 'command': 'x-blockdev-amend',
> > +  'data': { 'job-id': 'str',
> > +'node-name': 'str',
> > +'options': 'BlockdevAmendOptions',
> > +'*force': 'bool' } }
> > +
> >  ##
> >  # @blockdev-open-tray:
> >  #
> > diff --git a/qapi/job.json b/qapi/job.json
> > index a121b615fb..362b634ec1 100644
> > --- a/qapi/job.json
> > +++ b/qapi/job.json
> > @@ -19,10 +19,12 @@
> >  #
> >  # @create: image creation job type, see "blockdev-create" (since 3.0)
> >  #
> > +# @amend: image options amend job type, see "x-blockdev-amend" (since 5.0)
> > +#
> >  # Since: 1.7
> >  ##
> >  { 'enum': 'JobType',
> > -  'data': ['commit', 'stream', 'mirror', 'backup', 'create'] }
> > +  'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] }
> >  
> >  ##
> >  # @JobStatus:


Best regards,
Maxim Levitsky




Re: [PATCH 10/13] block: add generic infrastructure for x-blockdev-amend qmp command

2020-01-21 Thread Markus Armbruster
Maxim Levitsky  writes:

> blockdev-amend will be used similiar to blockdev-create
> to allow on the fly changes of the structure of the format based block 
> devices.
>
> Current plan is to first support encryption keyslot management for luks
> based formats (raw and embedded in qcow2)
>
> Signed-off-by: Maxim Levitsky 
[...]
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 7ff5e5edaf..601f7dc9a4 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -4743,6 +4743,48 @@
>'data': { 'job-id': 'str',
>  'options': 'BlockdevCreateOptions' } }
>  
> +##
> +# @BlockdevAmendOptions:
> +#
> +# Options for amending an image format
> +#
> +# @driver   block driver that is suitable for the image
> +#
> +# Since: 5.0
> +##
> +{ 'union': 'BlockdevAmendOptions',
> +  'base': {
> +  'driver': 'BlockdevDriver' },
> +  'discriminator': 'driver',
> +  'data': {
> +  } }
> +
> +##
> +# @x-blockdev-amend:
> +#
> +# Starts a job to amend format specific options of an existing open block 
> device
> +# The job is automatically finalized, but a manual job-dismiss is required.
> +#
> +# @job-id:  Identifier for the newly created job.
> +#
> +# @node-name:   Name of the block node to work on
> +#
> +# @options: Options (driver specific)
> +#
> +# @force:   Allow unsafe operations, format specific
> +#   For luks that allows erase of the last active keyslot
> +#   (permanent loss of data),
> +#   and replacement of an active keyslot
> +#   (possible loss of data if IO error happens)

PATCH 2 appears to reject that.  What am I missing?

> +#
> +# Since: 5.0
> +##
> +{ 'command': 'x-blockdev-amend',
> +  'data': { 'job-id': 'str',
> +'node-name': 'str',
> +'options': 'BlockdevAmendOptions',
> +'*force': 'bool' } }
> +
>  ##
>  # @blockdev-open-tray:
>  #
> diff --git a/qapi/job.json b/qapi/job.json
> index a121b615fb..362b634ec1 100644
> --- a/qapi/job.json
> +++ b/qapi/job.json
> @@ -19,10 +19,12 @@
>  #
>  # @create: image creation job type, see "blockdev-create" (since 3.0)
>  #
> +# @amend: image options amend job type, see "x-blockdev-amend" (since 5.0)
> +#
>  # Since: 1.7
>  ##
>  { 'enum': 'JobType',
> -  'data': ['commit', 'stream', 'mirror', 'backup', 'create'] }
> +  'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] }
>  
>  ##
>  # @JobStatus: