[libvirt] [PATCH 05/12] storage_util: Generate the qcow secret earlier
Peter Krempa
pkrempa at redhat.com
Tue May 15 14:12:42 UTC 2018
On Tue, May 08, 2018 at 08:47:58 -0400, John Ferlan wrote:
> Rather than having storageBackendCreateQemuImgCheckEncryption
> perform the virStorageGenerateQcowEncryption, let's just do that
> earlier during storageBackendCreateQemuImg so that the check
> helper is just a check helper rather doing something different
> based on whether the format is qcow[2] or raw based encryption.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/storage/storage_util.c | 31 +++++++++++++++++++++++++++----
> 1 file changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
> index 37a649d17b..64d4d1d7d2 100644
> --- a/src/storage/storage_util.c
> +++ b/src/storage/storage_util.c
> @@ -901,10 +901,10 @@ storageBackendCreateQemuImgCheckEncryption(int format,
> _("too many secrets for qcow encryption"));
> return -1;
> }
> - if (enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT ||
> - enc->nsecrets == 0) {
> - if (virStorageGenerateQcowEncryption(vol) < 0)
> - return -1;
> + if (enc->nsecrets == 0) {
> + virReportError(VIR_ERR_XML_ERROR, "%s",
> + _("no secret provided for qcow encryption"));
> + return -1;
> }
> } else if (format == VIR_STORAGE_FILE_RAW) {
> if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
> @@ -1309,6 +1309,26 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool,
storageBackendCreateQemuImgCheckEncryption is called from three
externally accessible call chains paths:
1) via multiple apis and then storageBackendCreateQemuImg
This one is fixed below.
2) via testCompareXMLToArgvFiles->virStorageBackendCreateQemuImgCmdFromVol
This may not be necessary to be fixed.
3) via virStorageBackendVolResizeLocal->storageBackendResizeQemuImg
This one looks like a regression.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180515/a4b96a02/attachment-0001.sig>
More information about the libvir-list
mailing list