Bug 1523065
Summary: | "qemu-img resize" should fail to decrease the size of logical partition/lvm/iSCSI image with raw format | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | yilzhang |
Component: | qemu-kvm-rhev | Assignee: | Hanna Czenczek <hreitz> |
Status: | CLOSED ERRATA | QA Contact: | Tingting Mao <timao> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.5 | CC: | juzhang, knoel, kwolf, michen, mrezanin, ngu, pingl, qzhang, timao, virt-maint |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | qemu-kvm-rhev-2.12.0-3.el7 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-11-01 11:04:00 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
yilzhang
2017-12-07 06:46:52 UTC
This is platform unrelated, kernel and qemu-kvm used when doing testing: PPC: Host kernel: 4.14.0-11.el7a.ppc64le qemu-kvm-rhev: qemu-kvm-rhev-2.10.0-11.el7 x86: Host kernel: 3.10.0-799.el7.x86_64 qemu-kvm-rhev: qemu-kvm-rhev-2.10.0-10.el7 Hi, This is actually intended, judging from the code. Both the iscsi and the block device truncation code explicitly only throw an error when you try to enlarge the volume and do nothing if the volume size you want is less than what it currently is. The commit which added truncation for iscsi (cb1b83e740384b4e0d950f3d7c81c02b8ce86c2e) actually says why this is the case: Truncation here does not work through qemu. Instead, you have to manually resize the volume on the iscsi target and then call block_resize in a qemu instance (through QMP!) with the appropiate size so that qemu knows about the change. The same applies to block device files (see 55b949c84761ade81ca93b2596ea45b09ad6d60a). I won't close this bug now, though, because I think that the offline qemu-img resize command should indeed print a message for such protocol drivers that do not really implement truncation, and which instead just cause qemu to refresh the image's current length. Max Sent an upstream patch: http://lists.nongnu.org/archive/html/qemu-block/2018-04/msg00441.html Fix included in qemu-kvm-rhev-2.12.0-3.el7 Verified the issue with below packages and steps. Package version: kernel-3.10.0-896.el7 qemu-kvm-rhev-2.12.0-3.el7 Steps: 1.Resize the size of raw image of LVM 1.1 Check the info of the image # qemu-img info /dev/vgtest/lvtest image: /dev/vgtest/lvtest file format: raw virtual size: 4.0G (4294967296 bytes) disk size: 0 1.2 Decrease the size # qemu-img resize -f raw --shrink /dev/vgtest/lvtest -2G -----> failed qemu-img: Image was not resized; resizing may not be supported for this image 1.3 Check the image size # qemu-img info /dev/vgtest/lvtest image: /dev/vgtest/lvtest file format: raw virtual size: 4.0G (4294967296 bytes) ----> the size not changed disk size: 0 2.Resize the size of raw image of ISCSI 2.1 Check the info of the image # qemu-img info iscsi://10.66.11.19/iqn.2018-05.com.example.t1/0 image: json:{"driver": "raw", "file": {"lun": "0", "portal": "10.66.11.19", "driver": "iscsi", "transport": "tcp", "target": "iqn.2018-05.com.example.t1"}} file format: raw virtual size: 80G (85899345920 bytes) disk size: unavailable 2.2 Decrease the size # qemu-img resize --shrink -f raw iscsi://10.66.11.19/iqn.2018-05.com.example.t1/0 -5G -----> failed qemu-img: Image was not resized; resizing may not be supported for this image 2.3 Check the size # qemu-img info iscsi://10.66.11.19/iqn.2018-05.com.example.t1/0 image: json:{"driver": "raw", "file": {"lun": "0", "portal": "10.66.11.19", "driver": "iscsi", "transport": "tcp", "target": "iqn.2018-05.com.example.t1"}} file format: raw virtual size: 80G (85899345920 bytes) -----> the size not changed disk size: unavailable 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://access.redhat.com/errata/RHBA-2018:3443 |