[libvirt] [PATCH 1/5] storage: Alter args to storageBackendResizeQemuImg

John Ferlan jferlan at redhat.com
Fri Oct 6 18:13:28 UTC 2017


Rather than passing just the path, pass the virStorageVolDefPtr as we're
going to need it shortly.

Also fix the order of code and stack variables in the calling function
virStorageBackendVolResizeLocal.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index a10e4590f3..50db358dc4 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -2287,7 +2287,7 @@ virStorageBackendVolRefreshLocal(virConnectPtr conn,
 
 
 static int
-storageBackendResizeQemuImg(const char *path,
+storageBackendResizeQemuImg(virStorageVolDefPtr vol,
                             unsigned long long capacity)
 {
     int ret = -1;
@@ -2306,7 +2306,7 @@ storageBackendResizeQemuImg(const char *path,
     capacity = VIR_ROUND_UP(capacity, 512);
 
     cmd = virCommandNew(img_tool);
-    virCommandAddArgList(cmd, "resize", path, NULL);
+    virCommandAddArgList(cmd, "resize", vol->target.path, NULL);
     virCommandAddArgFormat(cmd, "%llu", capacity);
 
     ret = virCommandRun(cmd, NULL);
@@ -2328,11 +2328,11 @@ virStorageBackendVolResizeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
                                 unsigned long long capacity,
                                 unsigned int flags)
 {
+    bool pre_allocate = flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE;
+
     virCheckFlags(VIR_STORAGE_VOL_RESIZE_ALLOCATE |
                   VIR_STORAGE_VOL_RESIZE_SHRINK, -1);
 
-    bool pre_allocate = flags & VIR_STORAGE_VOL_RESIZE_ALLOCATE;
-
     if (vol->target.format == VIR_STORAGE_FILE_RAW) {
         return virStorageFileResize(vol->target.path, capacity, pre_allocate);
     } else if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
@@ -2345,7 +2345,7 @@ virStorageBackendVolResizeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
             return -1;
         }
 
-        return storageBackendResizeQemuImg(vol->target.path, capacity);
+        return storageBackendResizeQemuImg(vol, capacity);
     }
 }
 
-- 
2.13.6




More information about the libvir-list mailing list