mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Alter storageBackendCreateQemuImgSecretObject args
Since all that was really needed was a couple of fields and building the object can be more generic, let's alter the args a bit. This will be useful shortly for adding the secret object for a volume resize operation on a luks volume that will need a secret object.
This commit is contained in:
parent
07731f9917
commit
03984ae543
@ -1120,17 +1120,14 @@ storageBackendCreateQemuImgSetOptions(virCommandPtr cmd,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
storageBackendCreateQemuImgSecretObject(virCommandPtr cmd,
|
storageBackendCreateQemuImgSecretObject(virCommandPtr cmd,
|
||||||
virStorageVolDefPtr vol,
|
const char *secretPath,
|
||||||
struct _virStorageBackendQemuImgInfo *info)
|
const char *secretAlias)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
char *commandStr = NULL;
|
char *commandStr = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&info->secretAlias, "%s_luks0", vol->name) < 0)
|
virBufferAsprintf(&buf, "secret,id=%s,file=", secretAlias);
|
||||||
return -1;
|
virQEMUBuildBufferEscapeComma(&buf, secretPath);
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "secret,id=%s,file=", info->secretAlias);
|
|
||||||
virQEMUBuildBufferEscapeComma(&buf, info->secretPath);
|
|
||||||
|
|
||||||
if (virBufferCheckError(&buf) < 0) {
|
if (virBufferCheckError(&buf) < 0) {
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
@ -1261,7 +1258,10 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
|
|||||||
if (info.format == VIR_STORAGE_FILE_RAW &&
|
if (info.format == VIR_STORAGE_FILE_RAW &&
|
||||||
vol->target.encryption != NULL &&
|
vol->target.encryption != NULL &&
|
||||||
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
|
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
|
||||||
if (storageBackendCreateQemuImgSecretObject(cmd, vol, &info) < 0)
|
if (virAsprintf(&info.secretAlias, "%s_luks0", vol->name) < 0)
|
||||||
|
goto error;
|
||||||
|
if (storageBackendCreateQemuImgSecretObject(cmd, info.secretPath,
|
||||||
|
info.secretAlias) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
enc = &vol->target.encryption->encinfo;
|
enc = &vol->target.encryption->encinfo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user