]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Alter args to storageBackendResizeQemuImg
authorJohn Ferlan <jferlan@redhat.com>
Fri, 6 Oct 2017 14:08:36 +0000 (10:08 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 27 Oct 2017 09:31:19 +0000 (05:31 -0400)
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.

src/storage/storage_util.c

index 5252e429fd603b3f51a8055129d3e93b99941335..4371963a53d56cb88f20b48a7455bf6f9446314f 100644 (file)
@@ -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);
     }
 }