| Summary: | block_resize returns undefined error | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Hao Liu <hliu> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.5 | CC: | berrange, bsarathy, dyuan, hliu, jdenemar, juzhang, lsu, mkenneth, mzhan, qzhang, rbalakri, sluo, virt-maint, yanyang, zsong |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.10.2-36.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-10-14 04:17:01 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: | |
|
Description
Hao Liu
2013-08-30 04:58:15 UTC
(In reply to Hao Liu from comment #0) > # virsh blockresize foo hda --size 10KB "10KB" is correctly parsed by virsh and transformed into 10000. > error: Failed to resize block device 'hda' > error: internal error unable to execute QEMU command 'block_resize': An > undefined error has ocurred The "An undefined error has ocurred" comes from QEMU. I'm moving this bug to qemu-kvm for further investigation. (In reply to Jiri Denemark from comment #2) > (In reply to Hao Liu from comment #0) > > # virsh blockresize foo hda --size 10KB > > "10KB" is correctly parsed by virsh and transformed into 10000. Should be 10240. qemu rejects the request because it's not aligned to a sector boundary. We could improve the error message, but this wouldn't change the root cause. (In reply to Kevin Wolf from comment #3) > (In reply to Jiri Denemark from comment #2) > > (In reply to Hao Liu from comment #0) > > > # virsh blockresize foo hda --size 10KB > > > > "10KB" is correctly parsed by virsh and transformed into 10000. > > Should be 10240. qemu rejects the request because it's not aligned to a > sector > boundary. We could improve the error message, but this wouldn't change the > root > cause. Whenever QEMU has granularity constraints, libvirt ought to be rounding up the user value to nearest acceptable boundary for QEMU. We do this in many other places, so just need to figure out where todo it for this case. This package qemu-kvm-rhev should be installed on RHEV, and could not installed on RHEL. After confirm with hliu, this should be a RHEV issue. Note: This issue only occurs on IDE disk with storage format "qcow2" or "qed", it does not occur for IDE disk with default storage format "raw" This is how I tested these changes using an existing 'f18' guest and a 'default' storage pool... $ virsh vol-create-as --pool default bz1002813-qcow-5k.img 5k --format qcow2 Vol bz1002813-qcow-5k.img created $ virsh vol-list default Name Path ------------------------------------------------------------------------------ bz1002813-qcow-5k.img /home/vm-images/bz1002813-qcow-5k.img $ virsh vol-info --pool default bz1002813-qcow-5k.img Name: bz1002813-qcow-5k.img Type: file Capacity: 5.00 KiB Allocation: 196.00 KiB $ virsh edit f18 (and add the following xml): <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/home/vm-images/bz1002813-qcow-5k.img'/> <target dev='vdb' bus='virtio'/> </disk> $ virsh start f18 Domain f18 started $ virsh domblkinfo f18 vdb Capacity: 5120 Allocation: 200704 Physical: 200704 $ virsh blockresize f18 vdb --size=10kb Block device 'vdb' is resized $ virsh domblkinfo f18 vdb Capacity: 10240 Allocation: 200704 Physical: 200704 $ qemu-img info /home/vm-images/bz1002813-qcow-5k.img image: /home/vm-images/bz1002813-qcow-5k.img file format: qcow2 virtual size: 10K (10240 bytes) disk size: 196K cluster_size: 65536 $ virsh blockresize f18 vdb --size=15kib Block device 'vdb' is resized $ virsh domblkinfo f18 vdb Capacity: 15360 Allocation: 200704 Physical: 200704 $ qemu-img info /home/vm-images/bz1002813-qcow-5k.img image: /home/vm-images/bz1002813-qcow-5k.img file format: qcow2 virtual size: 15K (15360 bytes) disk size: 196K cluster_size: 65536 $ virsh blockresize f18 vdb --size=20k Block device 'vdb' is resized $ virsh domblkinfo f18 vdb Capacity: 20480 Allocation: 200704 Physical: 200704 $ qemu-img info /home/vm-images/bz1002813-qcow-5k.img image: /home/vm-images/bz1002813-qcow-5k.img file format: qcow2 virtual size: 20K (20480 bytes) disk size: 196K cluster_size: 65536 $ I think this last one shows the rounding that's going on... whoops - missed a cut-n-paste : $ virsh blockresize f18 vdb --size=50kb Block device 'vdb' is resized $ virsh domblkinfo f18 vdb Capacity: 50176 Allocation: 200704 Physical: 200704 $ qemu-img info /home/vm-images/bz1002813-qcow-5k.img image: /home/vm-images/bz1002813-qcow-5k.img file format: qcow2 virtual size: 49K (50176 bytes) disk size: 196K cluster_size: 65536 Verified this bug on libvirt-0.10.2-36.el6.x86_64
Firstly, test the bug with qcow2 format disk
# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 2.0G (2147483648 bytes)
disk size: 136K
cluster_size: 65536
# virsh domblkinfo qcow3 vda
Capacity: 2147483648
Allocation: 139264
Physical: 139264
[root@yangyangtest ~]# virsh dumpxml qcow3 | grep disk -a6
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/test1'>
<seclabel relabel='no'/>
</source>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
1.1 # virsh blockresize qcow3 vda --size=4194304k
Block device 'vda' is resized
# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 4.0G (4294967296 bytes)
disk size: 140K
cluster_size: 65536
# virsh domblkinfo qcow3 vda
Capacity: 4294967296
Allocation: 143360
Physical: 143360
1.2. [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=5242880kib
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 5368709120
Allocation: 143360
Physical: 143360
1.3. # virsh blockresize qcow3 vda --size=6291456kb
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 6291456000
Allocation: 143360
Physical: 143360
2.1. [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=6656m
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 6.5G (6979321856 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 6979321856
Allocation: 143360
Physical: 143360
2.2 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=7168mib
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 7.0G (7516192768 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 7516192768
Allocation: 143360
Physical: 143360
2.3 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=7690mb
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 7.2G (7690000384 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 7690000384
Allocation: 143360
Physical: 143360
3.1 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=8G
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 8589934592
Allocation: 143360
Physical: 143360
3.2 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=9GB
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 8.4G (9000000000 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 9000000000
Allocation: 143360
Physical: 143360
3.3 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=9GiB
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test1
image: /var/lib/libvirt/images/test1
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 140K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 9663676416
Allocation: 143360
Physical: 143360
4. shrink block
# virsh blockresize qcow3 vda --size=1024000000B
error: Failed to resize block device 'vda'
error: internal error unable to execute QEMU command 'block_resize': this feature or command is not currently supported
Secondly, test the bug with qed format disk
# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 1.0G (1073741824 bytes)
disk size: 260K
cluster_size: 65536
# virsh domblkinfo qcow3 vda
Capacity: 1073741824
Allocation: 266240
Physical: 266240
[root@yangyangtest ~]# virsh dumpxml qcow3 | grep disk -a6
<disk type='file' device='disk'>
<driver name='qemu' type='qed' cache='none'/>
<source file='/var/lib/libvirt/images/test2'>
<seclabel relabel='no'/>
</source>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
5.1 # virsh blockresize qcow3 vda --size=2097152K
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 2.0G (2147483648 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 2147483648
Allocation: 266240
Physical: 266240
5.2 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=2621440Kib
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 2.5G (2684354560 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 2684354560
Allocation: 266240
Physical: 266240
5.3 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=3145728KB
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 2.9G (3145728000 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 3145728000
Allocation: 266240
Physical: 266240
6.1 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=4096M
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 4.0G (4294967296 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 4294967296
Allocation: 266240
Physical: 266240
6.2 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=4608MIB
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 4.5G (4831838208 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 4831838208
Allocation: 266240
Physical: 266240
6.3 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=5120MB
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 4.8G (5120000000 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 5120000000
Allocation: 266240
Physical: 266240
7.1[root@yangyangtest ~]# virsh blockresize qcow3 vda --size=6g
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 6.0G (6442450944 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 6442450944
Allocation: 266240
Physical: 266240
7.2 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=7gib
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 7.0G (7516192768 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 7516192768
Allocation: 266240
Physical: 266240
7.3 [root@yangyangtest ~]# virsh blockresize qcow3 vda --size=8gb
Block device 'vda' is resized
[root@yangyangtest ~]# qemu-img info /var/lib/libvirt/images/test2
image: /var/lib/libvirt/images/test2
file format: qed
virtual size: 7.5G (8000000000 bytes)
disk size: 260K
cluster_size: 65536
[root@yangyangtest ~]# virsh domblkinfo qcow3 vda
Capacity: 8000000000
Allocation: 266240
Physical: 266240
8. shrink block
[root@yangyangtest ~]# virsh blockresize qcow3 vda --size=1gb
error: Failed to resize block device 'vda'
error: internal error unable to execute QEMU command 'block_resize': this feature or command is not currently supported
Since resize block successfully without undefined error, I'd like to change the status to verified.
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. http://rhn.redhat.com/errata/RHBA-2014-1374.html |