mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
block/amend: add 'force' option
'force' option will be used for some unsafe amend operations. This includes things like erasing last keyslot in luks based formats (which destroys the data, unless the master key is backed up by external means), but that _might_ be desired result. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200608094030.670121-4-mlevitsk@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
557d2bdcca
commit
a3579bfa0a
7 changed files with 19 additions and 5 deletions
|
@ -79,6 +79,7 @@ enum {
|
|||
OPTION_DISABLE = 273,
|
||||
OPTION_MERGE = 274,
|
||||
OPTION_BITMAPS = 275,
|
||||
OPTION_FORCE = 276,
|
||||
};
|
||||
|
||||
typedef enum OutputFormat {
|
||||
|
@ -4090,6 +4091,7 @@ static int img_amend(int argc, char **argv)
|
|||
BlockBackend *blk = NULL;
|
||||
BlockDriverState *bs = NULL;
|
||||
bool image_opts = false;
|
||||
bool force = false;
|
||||
|
||||
cache = BDRV_DEFAULT_CACHE;
|
||||
for (;;) {
|
||||
|
@ -4097,6 +4099,7 @@ static int img_amend(int argc, char **argv)
|
|||
{"help", no_argument, 0, 'h'},
|
||||
{"object", required_argument, 0, OPTION_OBJECT},
|
||||
{"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
|
||||
{"force", no_argument, 0, OPTION_FORCE},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
c = getopt_long(argc, argv, ":ho:f:t:pq",
|
||||
|
@ -4144,6 +4147,9 @@ static int img_amend(int argc, char **argv)
|
|||
case OPTION_IMAGE_OPTS:
|
||||
image_opts = true;
|
||||
break;
|
||||
case OPTION_FORCE:
|
||||
force = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4221,7 +4227,7 @@ static int img_amend(int argc, char **argv)
|
|||
|
||||
/* In case the driver does not call amend_status_cb() */
|
||||
qemu_progress_print(0.f, 0);
|
||||
ret = bdrv_amend_options(bs, opts, &amend_status_cb, NULL, &err);
|
||||
ret = bdrv_amend_options(bs, opts, &amend_status_cb, NULL, force, &err);
|
||||
qemu_progress_print(100.f, 0);
|
||||
if (ret < 0) {
|
||||
error_report_err(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue