}
+static int
+storageBackendDoCreateQemuImg(virStoragePoolObjPtr pool,
+ virStorageVolDefPtr vol,
+ virStorageVolDefPtr inputvol,
+ unsigned int flags,
+ const char *create_tool,
+ const char *secretPath)
+{
+ int ret;
+ virCommandPtr cmd;
+
+ cmd = virStorageBackendCreateQemuImgCmdFromVol(pool, vol, inputvol,
+ flags, create_tool,
+ secretPath);
+ if (!cmd)
+ return -1;
+
+ ret = virStorageBackendCreateExecCommand(pool, vol, cmd);
+
+ virCommandFree(cmd);
+
+ return ret;
+}
+
+
static int
storageBackendCreateQemuImg(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
{
int ret = -1;
char *create_tool;
- virCommandPtr cmd;
char *secretPath = NULL;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, -1);
if (storageBackendGenerateSecretData(pool, vol, &secretPath) < 0)
goto cleanup;
- cmd = virStorageBackendCreateQemuImgCmdFromVol(pool, vol, inputvol,
- flags, create_tool,
- secretPath);
- if (!cmd)
- goto cleanup;
-
- ret = virStorageBackendCreateExecCommand(pool, vol, cmd);
-
- virCommandFree(cmd);
+ ret = storageBackendDoCreateQemuImg(pool, vol, inputvol, flags,
+ create_tool, secretPath);
cleanup:
if (secretPath) {
unlink(secretPath);