Allowing a NULL @secretPath for virStorageBackendCreateQemuImgCmdFromVol
would result in a generated command line with a dangling "file=" output.
So let's make sure the @secretPath exists before processing.
This means we should pass a dummy path from the storage test.
Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
if (info.format == VIR_STORAGE_FILE_RAW && vol->target.encryption &&
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
+ if (!info.secretPath) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("path to secret data file is required"));
+ goto error;
+ }
if (virAsprintf(&info.secretAlias, "%s_encrypt0", vol->name) < 0)
goto error;
if (storageBackendCreateQemuImgSecretObject(cmd, info.secretPath,
cmd = virStorageBackendCreateQemuImgCmdFromVol(obj, vol,
inputvol, flags,
create_tool,
- NULL);
+ "/path/to/secretFile");
if (!cmd) {
if (shouldFail) {
virResetLastError();