From ae94084b766995da26ddb9d359036f36b70b66c7 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Fri, 6 Oct 2017 10:08:36 -0400 Subject: [PATCH] storage: Alter args to storageBackendResizeQemuImg 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 5252e429fd..4371963a53 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); } } -- GitLab