mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Shrink volume even with ALLOCATE flag
Calling fallocate on the new (smaller) capacity ensures that the whole file is allocated, but it does not reduce the file size. Also call ftruncate after fallocate. https://bugzilla.redhat.com/show_bug.cgi?id=1366446
This commit is contained in:
@@ -1338,12 +1338,12 @@ virStorageFileResize(const char *path,
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (ftruncate(fd, capacity) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to truncate file '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (ftruncate(fd, capacity) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to truncate file '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (VIR_CLOSE(fd) < 0) {
|
||||
|
||||
Reference in New Issue
Block a user