mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
storage: dir: .resizeVol callback for ploop volume
Changes the size of given ploop volume via ploop resize tool. Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
This commit is contained in:
parent
02d1e45654
commit
d957ba8deb
@ -850,6 +850,31 @@ virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virStoragePloopResize(virStorageVolDefPtr vol,
|
||||||
|
unsigned long long capacity)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
virCommandPtr cmd = NULL;
|
||||||
|
char *resize_tool = NULL;
|
||||||
|
|
||||||
|
resize_tool = virFindFileInPath("ploop");
|
||||||
|
if (!resize_tool) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("unable to find ploop, please install ploop tools"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
cmd = virCommandNewArgList(resize_tool, "resize", "-s", NULL);
|
||||||
|
virCommandAddArgFormat(cmd, "%lluM", VIR_DIV_UP(capacity, (1024 * 1024)));
|
||||||
|
|
||||||
|
virCommandAddArgFormat(cmd, "%s/DiskDescriptor.xml", vol->target.path);
|
||||||
|
|
||||||
|
ret = virCommandRun(cmd, NULL);
|
||||||
|
virCommandFree(cmd);
|
||||||
|
VIR_FREE(resize_tool);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
QEMU_IMG_BACKING_FORMAT_NONE = 0,
|
QEMU_IMG_BACKING_FORMAT_NONE = 0,
|
||||||
QEMU_IMG_BACKING_FORMAT_FLAG,
|
QEMU_IMG_BACKING_FORMAT_FLAG,
|
||||||
|
@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn,
|
|||||||
virStorageVolDefPtr inputvol,
|
virStorageVolDefPtr inputvol,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
int virStoragePloopResize(virStorageVolDefPtr vol,
|
||||||
|
unsigned long long capacity);
|
||||||
|
|
||||||
virStorageBackendBuildVolFrom
|
virStorageBackendBuildVolFrom
|
||||||
virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
|
virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
|
||||||
|
@ -1379,6 +1379,8 @@ virStorageBackendFileSystemVolResize(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
if (vol->target.format == VIR_STORAGE_FILE_RAW) {
|
if (vol->target.format == VIR_STORAGE_FILE_RAW) {
|
||||||
return virStorageFileResize(vol->target.path, capacity,
|
return virStorageFileResize(vol->target.path, capacity,
|
||||||
vol->target.allocation, pre_allocate);
|
vol->target.allocation, pre_allocate);
|
||||||
|
} else if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
||||||
|
return virStoragePloopResize(vol, capacity);
|
||||||
} else {
|
} else {
|
||||||
if (pre_allocate) {
|
if (pre_allocate) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user