提交 af0e6580 编写于 作者: J John Ferlan

storage: Rename encryption info variable for clarity

Change from @enc to @encinfo leaving @enc for the vol->target.encryption
in the storageBackendCreateQemuImgSetOptions code path.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
ACKed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 23e9aa72
...@@ -817,7 +817,7 @@ struct _virStorageBackendQemuImgInfo { ...@@ -817,7 +817,7 @@ struct _virStorageBackendQemuImgInfo {
static int static int
storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc, storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr encinfo,
char **opts, char **opts,
struct _virStorageBackendQemuImgInfo info) struct _virStorageBackendQemuImgInfo info)
{ {
...@@ -827,8 +827,8 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc, ...@@ -827,8 +827,8 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc,
virBufferAsprintf(&buf, "backing_fmt=%s,", virBufferAsprintf(&buf, "backing_fmt=%s,",
virStorageFileFormatTypeToString(info.backingFormat)); virStorageFileFormatTypeToString(info.backingFormat));
if (info.format == VIR_STORAGE_FILE_RAW && enc) { if (info.format == VIR_STORAGE_FILE_RAW && encinfo) {
virQEMUBuildQemuImgKeySecretOpts(&buf, enc, info.secretAlias); virQEMUBuildQemuImgKeySecretOpts(&buf, encinfo, info.secretAlias);
} else { } else {
if (info.encryption) if (info.encryption)
virBufferAddLit(&buf, "encryption=on,"); virBufferAddLit(&buf, "encryption=on,");
...@@ -1037,7 +1037,7 @@ storageBackendCreateQemuImgSetBacking(virStoragePoolObjPtr pool, ...@@ -1037,7 +1037,7 @@ storageBackendCreateQemuImgSetBacking(virStoragePoolObjPtr pool,
static int static int
storageBackendCreateQemuImgSetOptions(virCommandPtr cmd, storageBackendCreateQemuImgSetOptions(virCommandPtr cmd,
virStorageEncryptionInfoDefPtr enc, virStorageEncryptionInfoDefPtr encinfo,
struct _virStorageBackendQemuImgInfo info) struct _virStorageBackendQemuImgInfo info)
{ {
char *opts = NULL; char *opts = NULL;
...@@ -1045,7 +1045,7 @@ storageBackendCreateQemuImgSetOptions(virCommandPtr cmd, ...@@ -1045,7 +1045,7 @@ storageBackendCreateQemuImgSetOptions(virCommandPtr cmd,
if (info.format == VIR_STORAGE_FILE_QCOW2 && !info.compat) if (info.format == VIR_STORAGE_FILE_QCOW2 && !info.compat)
info.compat = "0.10"; info.compat = "0.10";
if (storageBackendCreateQemuImgOpts(enc, &opts, info) < 0) if (storageBackendCreateQemuImgOpts(encinfo, &opts, info) < 0)
return -1; return -1;
if (opts) if (opts)
virCommandAddArgList(cmd, "-o", opts, NULL); virCommandAddArgList(cmd, "-o", opts, NULL);
...@@ -1209,7 +1209,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1209,7 +1209,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
.secretPath = secretPath, .secretPath = secretPath,
.secretAlias = NULL, .secretAlias = NULL,
}; };
virStorageEncryptionInfoDefPtr enc = NULL; virStorageEncryptionPtr enc = vol->target.encryption;
virStorageEncryptionInfoDefPtr encinfo = NULL;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL); virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
...@@ -1231,8 +1232,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1231,8 +1232,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
if (info.backingPath) if (info.backingPath)
virCommandAddArgList(cmd, "-b", info.backingPath, NULL); virCommandAddArgList(cmd, "-b", info.backingPath, NULL);
if (info.format == VIR_STORAGE_FILE_RAW && vol->target.encryption && if (info.format == VIR_STORAGE_FILE_RAW && enc &&
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) { enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
if (!info.secretPath) { if (!info.secretPath) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("path to secret data file is required")); _("path to secret data file is required"));
...@@ -1243,10 +1244,10 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1243,10 +1244,10 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
if (storageBackendCreateQemuImgSecretObject(cmd, info.secretPath, if (storageBackendCreateQemuImgSecretObject(cmd, info.secretPath,
info.secretAlias) < 0) info.secretAlias) < 0)
goto error; goto error;
enc = &vol->target.encryption->encinfo; encinfo = &enc->encinfo;
} }
if (storageBackendCreateQemuImgSetOptions(cmd, enc, info) < 0) if (storageBackendCreateQemuImgSetOptions(cmd, encinfo, info) < 0)
goto error; goto error;
VIR_FREE(info.secretAlias); VIR_FREE(info.secretAlias);
......
...@@ -315,7 +315,7 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str) ...@@ -315,7 +315,7 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str)
/** /**
* virQEMUBuildQemuImgKeySecretOpts: * virQEMUBuildQemuImgKeySecretOpts:
* @buf: buffer to build the string into * @buf: buffer to build the string into
* @enc: pointer to encryption info * @encinfo: pointer to encryption info
* @alias: alias to use * @alias: alias to use
* *
* Generate the string for id=$alias and any encryption options for * Generate the string for id=$alias and any encryption options for
...@@ -334,37 +334,37 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str) ...@@ -334,37 +334,37 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str)
*/ */
void void
virQEMUBuildQemuImgKeySecretOpts(virBufferPtr buf, virQEMUBuildQemuImgKeySecretOpts(virBufferPtr buf,
virStorageEncryptionInfoDefPtr enc, virStorageEncryptionInfoDefPtr encinfo,
const char *alias) const char *alias)
{ {
virBufferAsprintf(buf, "key-secret=%s,", alias); virBufferAsprintf(buf, "key-secret=%s,", alias);
if (!enc->cipher_name) if (!encinfo->cipher_name)
return; return;
virBufferAddLit(buf, "cipher-alg="); virBufferAddLit(buf, "cipher-alg=");
virQEMUBuildBufferEscapeComma(buf, enc->cipher_name); virQEMUBuildBufferEscapeComma(buf, encinfo->cipher_name);
virBufferAsprintf(buf, "-%u,", enc->cipher_size); virBufferAsprintf(buf, "-%u,", encinfo->cipher_size);
if (enc->cipher_mode) { if (encinfo->cipher_mode) {
virBufferAddLit(buf, "cipher-mode="); virBufferAddLit(buf, "cipher-mode=");
virQEMUBuildBufferEscapeComma(buf, enc->cipher_mode); virQEMUBuildBufferEscapeComma(buf, encinfo->cipher_mode);
virBufferAddLit(buf, ","); virBufferAddLit(buf, ",");
} }
if (enc->cipher_hash) { if (encinfo->cipher_hash) {
virBufferAddLit(buf, "hash-alg="); virBufferAddLit(buf, "hash-alg=");
virQEMUBuildBufferEscapeComma(buf, enc->cipher_hash); virQEMUBuildBufferEscapeComma(buf, encinfo->cipher_hash);
virBufferAddLit(buf, ","); virBufferAddLit(buf, ",");
} }
if (!enc->ivgen_name) if (!encinfo->ivgen_name)
return; return;
virBufferAddLit(buf, "ivgen-alg="); virBufferAddLit(buf, "ivgen-alg=");
virQEMUBuildBufferEscapeComma(buf, enc->ivgen_name); virQEMUBuildBufferEscapeComma(buf, encinfo->ivgen_name);
virBufferAddLit(buf, ","); virBufferAddLit(buf, ",");
if (enc->ivgen_hash) { if (encinfo->ivgen_hash) {
virBufferAddLit(buf, "ivgen-hash-alg="); virBufferAddLit(buf, "ivgen-hash-alg=");
virQEMUBuildBufferEscapeComma(buf, enc->ivgen_hash); virQEMUBuildBufferEscapeComma(buf, encinfo->ivgen_hash);
virBufferAddLit(buf, ","); virBufferAddLit(buf, ",");
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册