Add FromVol at the end. This function will create the qemu-img
command line from volume definitions and check them.
---
src/storage/storage_backend.c | 21 ++++++++++++---------
src/storage/storage_backend.h | 14 +++++++-------
tests/storagevolxml2argvtest.c | 5 +++--
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 9322571..fdda0dc 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -858,14 +858,17 @@ virStorageBackendCreateQemuImgOpts(char **opts,
return -1;
}
+/* Create a qemu-img virCommand from the supplied binary path,
+ * volume definitions and imgformat
+ */
virCommandPtr
-virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
- virStoragePoolObjPtr pool,
- virStorageVolDefPtr vol,
- virStorageVolDefPtr inputvol,
- unsigned int flags,
- const char *create_tool,
- int imgformat)
+virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
+ virStoragePoolObjPtr pool,
+ virStorageVolDefPtr vol,
+ virStorageVolDefPtr inputvol,
+ unsigned int flags,
+ const char *create_tool,
+ int imgformat)
{
virCommandPtr cmd = NULL;
bool do_encryption = (vol->target.encryption != NULL);
@@ -1094,8 +1097,8 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
if (imgformat < 0)
goto cleanup;
- cmd = virStorageBackendCreateQemuImgCmd(conn, pool, vol, inputvol, flags,
- create_tool, imgformat);
+ cmd = virStorageBackendCreateQemuImgCmdFromVol(conn, pool, vol, inputvol,
+ flags, create_tool, imgformat);
if (!cmd)
goto cleanup;
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index fd2451c..bb1e8d8 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -192,13 +192,13 @@ char *virStorageBackendStablePath(virStoragePoolObjPtr pool,
bool loop);
virCommandPtr
-virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
- virStoragePoolObjPtr pool,
- virStorageVolDefPtr vol,
- virStorageVolDefPtr inputvol,
- unsigned int flags,
- const char *create_tool,
- int imgformat);
+virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
+ virStoragePoolObjPtr pool,
+ virStorageVolDefPtr vol,
+ virStorageVolDefPtr inputvol,
+ unsigned int flags,
+ const char *create_tool,
+ int imgformat);
/* ------- virStorageFile backends ------------ */
typedef struct _virStorageFileBackend virStorageFileBackend;
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 696659c..f5f86c8 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -98,8 +98,9 @@ testCompareXMLToArgvFiles(bool shouldFail,
testSetVolumeType(vol, pool);
testSetVolumeType(inputvol, inputpool);
- cmd = virStorageBackendCreateQemuImgCmd(conn, &poolobj, vol, inputvol,
- flags, create_tool, imgformat);
+ cmd = virStorageBackendCreateQemuImgCmdFromVol(conn, &poolobj, vol,
+ inputvol, flags,
+ create_tool, imgformat);
if (!cmd) {
if (shouldFail) {
virResetLastError();
--
2.0.5