提交 4b9055c9 编写于 作者: J John Ferlan

storage_util: Move @type into _virStorageBackendQemuImgInfo

We're about to split up the code a bit more, so we'll need this
to be in the local struct.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 b5c8c547
...@@ -794,6 +794,7 @@ storagePloopResize(virStorageVolDefPtr vol, ...@@ -794,6 +794,7 @@ storagePloopResize(virStorageVolDefPtr vol,
*/ */
struct _virStorageBackendQemuImgInfo { struct _virStorageBackendQemuImgInfo {
int format; int format;
const char *type;
const char *path; const char *path;
unsigned long long size_arg; unsigned long long size_arg;
unsigned long long allocation; unsigned long long allocation;
...@@ -1125,9 +1126,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1125,9 +1126,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
const char *secretPath) const char *secretPath)
{ {
virCommandPtr cmd = NULL; virCommandPtr cmd = NULL;
const char *type;
struct _virStorageBackendQemuImgInfo info = { struct _virStorageBackendQemuImgInfo info = {
.format = vol->target.format, .format = vol->target.format,
.type = NULL,
.path = vol->target.path, .path = vol->target.path,
.allocation = vol->target.allocation, .allocation = vol->target.allocation,
.encryption = !!vol->target.encryption, .encryption = !!vol->target.encryption,
...@@ -1149,7 +1150,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1149,7 +1150,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
if (info.format == VIR_STORAGE_FILE_ISO) if (info.format == VIR_STORAGE_FILE_ISO)
info.format = VIR_STORAGE_FILE_RAW; info.format = VIR_STORAGE_FILE_RAW;
if (!(type = virStorageFileFormatTypeToString(info.format))) { if (!(info.type = virStorageFileFormatTypeToString(info.format))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown storage vol type %d"), _("unknown storage vol type %d"),
info.format); info.format);
...@@ -1178,7 +1179,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1178,7 +1179,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
return NULL; return NULL;
} }
if (vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) { if (vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
type = "luks"; info.type = "luks";
} else { } else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Only luks encryption is supported for raw files")); _("Only luks encryption is supported for raw files"));
...@@ -1195,7 +1196,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1195,7 +1196,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
return NULL; return NULL;
if (info.encryption && if (info.encryption &&
storageBackendCreateQemuImgCheckEncryption(info.format, type, vol) < 0) storageBackendCreateQemuImgCheckEncryption(info.format, info.type, vol) < 0)
return NULL; return NULL;
/* Size in KB */ /* Size in KB */
...@@ -1209,9 +1210,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, ...@@ -1209,9 +1210,9 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
if (info.inputPath) if (info.inputPath)
virCommandAddArgList(cmd, "convert", "-f", info.inputFormatStr, virCommandAddArgList(cmd, "convert", "-f", info.inputFormatStr,
"-O", type, NULL); "-O", info.type, NULL);
else else
virCommandAddArgList(cmd, "create", "-f", type, NULL); virCommandAddArgList(cmd, "create", "-f", info.type, NULL);
if (info.backingPath) if (info.backingPath)
virCommandAddArgList(cmd, "-b", info.backingPath, NULL); virCommandAddArgList(cmd, "-b", info.backingPath, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册