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.
This commit is contained in:
John Ferlan 2017-10-06 10:08:36 -04:00
parent 0167e9c535
commit ae94084b76

View 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);
}
}