Bug 1220213
| Summary: | vol-resize with --delta --shrink does not shrink the volume | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yisun |
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.2 | CC: | dyuan, jtomko, rbalakri, xuzhang, yanyang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.17-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:30:32 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
yisun
2015-05-11 02:57:17 UTC
I think even a positive value (if combined with --delta) should shrink the volume with the --shrink flag. Upstream patches: https://www.redhat.com/archives/libvir-list/2015-May/msg01041.html Jan, Currently a positive value (which is larger than current capacity) combined with --shrink will extend the volume. Is it the expected result ? # virsh vol-info yy default Name: yy Type: file Capacity: 1.00 GiB Allocation: 1.00 GiB # virsh vol-resize --pool default yy 2G --shrink Size of volume 'yy' successfully changed to 2G # virsh vol-info yy default Name: yy Type: file Capacity: 2.00 GiB Allocation: 1.00 GiB Regards Yang Yes, unfortunately. --shrink copies the behavior of VIR_STORAGE_VOL_RESIZE_SHRINK This flag is documented as 'allow shrinking the volume' not 'shrink the volume': http://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResizeFlags Only with the DELTA flag is it documented to mean 'shrink the volume': http://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResize but it was not implemented until my patch: https://www.redhat.com/archives/libvir-list/2015-May/msg01043.html Shrinking volumes with the --delta flag is merged upstream now:
(both "-200M' and "200M" will shrink the volume by 200M)
commit 8b316fe5da8e459349b1a3ee0037bc7988d6f8aa
Author: Ján Tomko <jtomko>
CommitDate: 2015-05-28 14:10:32 +0200
Fix shrinking volumes with the delta flag
This never worked.
In 0.9.10 when this API was introduced, it was intended that
the SHRINK flag combined with DELTA would shrink the volume by
the specified capacity (to avoid passing negative numbers).
See commit 055bbf4.
When the SHRINK flag was finally implemented for the first backend
in 1.2.13 (commit aa9aa6a), it was only implemented for the absolute
values and with the delta flag the volume is always extended,
regardless of the SHRINK flag.
Treat the SHRINK flag as a minus sign when used together with DELTA,
to allow shrinking volumes as was documented in the API since 0.9.10.
https://bugzilla.redhat.com/show_bug.cgi?id=1220213
git describe: v1.2.16-rc1-9-g8b316fe
Using a negative value implies --delta since:
commit 0a33bba1aeec04ccf6963b6942bac4586f04dda7
CommitDate: 2015-06-01 13:56:49 +0200
virsh: make negative values with vol-resize more convenient
When shrinking a volume by a certain size, instead of typing
vol-resize volume 1G --delta --shrink
we allow the convience of specifying a negative value:
vol-resize volume -1G --delta --shrink
getting the same results with one more character.
A negative value only makes sense as a delta. Imply the
--delta parameter if the value is negative.
Still require --shrink, because the operation is potentially
destructive.
git describe: v1.2.16-6-g0a33bba
verified on libvirt-1.2.17-1.el7.x86_64 1. prepare a pool with a volume with 5GiB capacity # virsh vol-info disk1.img pool Name: disk1.img Type: file Capacity: 5.00 GiB Allocation: 196.00 KiB 2. resize with negative value and --shrink # virsh vol-resize /home/test/disk1.img -1G --shrink Size of volume 'disk1.img' successfully changed by 1G # virsh vol-info disk1.img pool Name: disk1.img Type: file Capacity: 4.00 GiB <===== expected. Allocation: 0.00 B 3. resize with positive value with --delta --shrink # virsh vol-resize /home/test/disk1.img 1G --delta --shrink Size of volume 'disk1.img' successfully changed by 1G # virsh vol-info disk1.img pool Name: disk1.img Type: file Capacity: 3.00 GiB <=== expected Allocation: 0.00 B 4. resize with negative value with --delta --shrink # virsh vol-resize /home/test/disk1.img -1G --delta --shrink Size of volume 'disk1.img' successfully changed by 1G # virsh vol-info disk1.img pool Name: disk1.img Type: file Capacity: 2.00 GiB <===== expected Allocation: 0.00 B 5. resize with lager-than-current value with shrink # virsh vol-resize /home/test/disk1.img 5G --shrink Size of volume 'disk1.img' successfully changed to 5G # virsh vol-info disk1.img pool Name: disk1.img Type: file Capacity: 5.00 GiB <==== expected as comment 4 pointed out Allocation: 0.00 B Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |