[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 06/10] qcow2: implement crypto amend options
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-block] [PATCH 06/10] qcow2: implement crypto amend options |
Date: |
Fri, 6 Sep 2019 15:06:34 +0100 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
On Fri, Aug 30, 2019 at 11:56:04PM +0300, Maxim Levitsky wrote:
> ---
> block/qcow2.c | 79 ++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 63 insertions(+), 16 deletions(-)
>
> @@ -4888,9 +4899,22 @@ static int qcow2_amend_options(BlockDriverState *bs,
> QemuOpts *opts,
> return -ENOTSUP;
> }
> } else if (g_str_has_prefix(desc->name, "encrypt.")) {
> - error_setg(errp,
> - "Changing the encryption parameters is not
> supported");
> - return -ENOTSUP;
> +
> + if (!s->crypto) {
> + error_setg(errp,
> + "Can't amend encryption options - encryption not
> supported");
> + return -ENOTSUP;
> +
> + }
Perhaps ' - encryption not present', and -EINVAL
> +
> + if (s->crypt_method_header != QCOW_CRYPT_LUKS) {
> + error_setg(errp,
> + "Only LUKS encryption options can be amended");
> + return -ENOTSUP;
> + }
> +
> + encryption_update = true;
> +
> } else if (!strcmp(desc->name, BLOCK_OPT_CLUSTER_SIZE)) {
> cluster_size = qemu_opt_get_size(opts, BLOCK_OPT_CLUSTER_SIZE,
> cluster_size);
> @@ -4927,7 +4951,7 @@ static int qcow2_amend_options(BlockDriverState *bs,
> QemuOpts *opts,
> "images");
> return -EINVAL;
> }
> - } else {
> + } else {
Accidental change
> /* if this point is reached, this probably means a new option was
> * added without having it covered here */
> abort();
> @@ -4940,7 +4964,8 @@ static int qcow2_amend_options(BlockDriverState *bs,
> QemuOpts *opts,
> .original_status_cb = status_cb,
> .original_cb_opaque = cb_opaque,
> .total_operations = (new_version < old_version)
> - + (s->refcount_bits != refcount_bits)
> + + (s->refcount_bits != refcount_bits) +
> + (encryption_update == true)
> };
>
> /* Upgrade first (some features may require compat=1.1) */
> @@ -4954,6 +4979,28 @@ static int qcow2_amend_options(BlockDriverState *bs,
> QemuOpts *opts,
> }
> }
>
> + if (encryption_update) {
> +
Redundant blank line
> + QCryptoBlockCreateOptions *cryptoopts;
> +
> + cryptoopts = qcow2_extract_crypto_create_opts(opts, "luks", errp);
> + if (!cryptoopts)
> + return -EINVAL;
> +
> + helper_cb_info.current_operation = QCOW2_UPDATING_ENCRYPTION;
> +
> + ret = qcrypto_block_amend_options(s->crypto,
> + qcow2_crypto_hdr_read_func,
> + qcow2_crypto_hdr_write_func,
> + bs,
> + cryptoopts,
> + force,
> + errp);
> + if (ret) {
Check ret < 0
> + return ret;
> + }
> + }
> +
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [Qemu-block] [PATCH 06/10] qcow2: implement crypto amend options,
Daniel P . Berrangé <=