You need to sign in or sign up before continuing.
提交 7236a473 编写于 作者: J Ján Tomko

Revert "storage: disk: Separate creating of the volume from building"

This reverts commit 67ccf91b.
We only generate the volume key after we've built it, but the storage
driver expects it to be filled after createVol finishes.
Squash the volume building back with creating to fulfill this
expectation.
上级 42bbde2d
...@@ -617,43 +617,28 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, ...@@ -617,43 +617,28 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
static int static int
virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
virStorageVolDefPtr vol)
{
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("storage pool does not support encrypted volumes"));
return -1;
}
vol->type = VIR_STORAGE_VOL_BLOCK;
return 0;
}
static int
virStorageBackendDiskBuildVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool, virStoragePoolObjPtr pool,
virStorageVolDefPtr vol, virStorageVolDefPtr vol)
unsigned int flags)
{ {
int res = -1; int res = -1;
char *partFormat = NULL; char *partFormat = NULL;
unsigned long long startOffset = 0, endOffset = 0; unsigned long long startOffset = 0, endOffset = 0;
virCommandPtr cmd = NULL; virCommandPtr cmd = virCommandNewArgList(PARTED,
virCheckFlags(0, -1);
cmd = virCommandNewArgList(PARTED,
pool->def->source.devices[0].path, pool->def->source.devices[0].path,
"mkpart", "mkpart",
"--script", "--script",
NULL); NULL);
if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0) if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("storage pool does not support encrypted "
"volumes"));
goto cleanup; goto cleanup;
}
if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0) {
goto cleanup;
}
virCommandAddArg(cmd, partFormat); virCommandAddArg(cmd, partFormat);
if (virStorageBackendDiskPartBoundries(pool, &startOffset, if (virStorageBackendDiskPartBoundries(pool, &startOffset,
...@@ -783,6 +768,5 @@ virStorageBackend virStorageBackendDisk = { ...@@ -783,6 +768,5 @@ virStorageBackend virStorageBackendDisk = {
.createVol = virStorageBackendDiskCreateVol, .createVol = virStorageBackendDiskCreateVol,
.deleteVol = virStorageBackendDiskDeleteVol, .deleteVol = virStorageBackendDiskDeleteVol,
.buildVol = virStorageBackendDiskBuildVol,
.buildVolFrom = virStorageBackendDiskBuildVolFrom, .buildVolFrom = virStorageBackendDiskBuildVolFrom,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册