This reverts commit 67ccf91bf29488783bd1fda46b362450f71a2078.
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.
---
src/storage/storage_backend_disk.c | 44 ++++++++++++--------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index aa3b72f..a7a7d0e 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -617,43 +617,28 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
static int
virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
- virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+ virStoragePoolObjPtr pool,
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,
- virStorageVolDefPtr vol,
- unsigned int flags)
-{
int res = -1;
char *partFormat = NULL;
unsigned long long startOffset = 0, endOffset = 0;
- virCommandPtr cmd = NULL;
-
- virCheckFlags(0, -1);
-
- cmd = virCommandNewArgList(PARTED,
- pool->def->source.devices[0].path,
- "mkpart",
- "--script",
- NULL);
+ virCommandPtr cmd = virCommandNewArgList(PARTED,
+ pool->def->source.devices[0].path,
+ "mkpart",
+ "--script",
+ 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;
+ }
+ if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0) {
+ goto cleanup;
+ }
virCommandAddArg(cmd, partFormat);
if (virStorageBackendDiskPartBoundries(pool, &startOffset,
@@ -783,6 +768,5 @@ virStorageBackend virStorageBackendDisk = {
.createVol = virStorageBackendDiskCreateVol,
.deleteVol = virStorageBackendDiskDeleteVol,
- .buildVol = virStorageBackendDiskBuildVol,
.buildVolFrom = virStorageBackendDiskBuildVolFrom,
};
--
1.8.3.2