mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 09:05:16 +00:00
storage_util: Move secretPath generation
Move generation of secretPath to storageBackendGenerateSecretData and simplify a bit since we know vol->target.encryption is set plus we have a local @enc. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
3d1db851ca
commit
9118e23f6d
@ -1310,7 +1310,9 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
storageBackendGenerateSecretData(virStorageVolDefPtr vol)
|
storageBackendGenerateSecretData(virStoragePoolObjPtr pool,
|
||||||
|
virStorageVolDefPtr vol,
|
||||||
|
char **secretPath)
|
||||||
{
|
{
|
||||||
virStorageEncryptionPtr enc = vol->target.encryption;
|
virStorageEncryptionPtr enc = vol->target.encryption;
|
||||||
|
|
||||||
@ -1325,6 +1327,12 @@ storageBackendGenerateSecretData(virStorageVolDefPtr vol)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vol->target.format == VIR_STORAGE_FILE_RAW &&
|
||||||
|
enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
|
||||||
|
if (!(*secretPath = storageBackendCreateQemuImgSecretPath(pool, vol)))
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,17 +1358,9 @@ storageBackendCreateQemuImg(virStoragePoolObjPtr pool,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storageBackendGenerateSecretData(vol) < 0)
|
if (storageBackendGenerateSecretData(pool, vol, &secretPath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vol->target.format == VIR_STORAGE_FILE_RAW &&
|
|
||||||
vol->target.encryption &&
|
|
||||||
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
|
|
||||||
if (!(secretPath =
|
|
||||||
storageBackendCreateQemuImgSecretPath(pool, vol)))
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = virStorageBackendCreateQemuImgCmdFromVol(pool, vol, inputvol,
|
cmd = virStorageBackendCreateQemuImgCmdFromVol(pool, vol, inputvol,
|
||||||
flags, create_tool,
|
flags, create_tool,
|
||||||
secretPath);
|
secretPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user