RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1002813 - block_resize returns undefined error
Summary: block_resize returns undefined error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-30 04:58 UTC by Hao Liu
Modified: 2016-04-26 14:15 UTC (History)
15 users (show)

Fixed In Version: libvirt-0.10.2-36.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-14 04:17:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1374 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2014-10-14 08:11:54 UTC

Description Hao Liu 2013-08-30 04:58:15 UTC
Description of problem:
blockresize using some size suffixes returns undefined error.


Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 6.5 Beta
libvirt-0.10.2-23.el6.x86_64
kernel-2.6.32-414.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.398.el6.x86_64

How reproducible:
always

1. prepare a guest foo with a disk hda.

2. run blockresize with a suffix like KB, MB, B, BYTE.

# virsh blockresize foo hda --size 10KB
error: Failed to resize block device 'hda'
error: internal error unable to execute QEMU command 'block_resize': An undefined error has ocurred

Expected result:
error: Unable to parse integer
error: invalid argument: unknown suffix 'KB'

or

error: Failed to resize block device 'hda'
error: internal error unable to execute QEMU command 'block_resize': this feature or command is not currently supported

when shrink is not supported

and

Block device 'hda' is resized

when resize successed.

Comment 2 Jiri Denemark 2013-09-02 10:12:48 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.

Comment 3 Kevin Wolf 2013-09-06 11:22:42 UTC
(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.

Comment 4 Daniel Berrangé 2013-09-06 11:28:25 UTC
(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.

Comment 6 zhengqin 2013-09-16 03:08:36 UTC
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.

Comment 7 zhengqin 2013-09-16 07:07:37 UTC
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"

Comment 11 John Ferlan 2014-05-08 17:16:07 UTC
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...

Comment 12 John Ferlan 2014-05-08 17:18:47 UTC
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

Comment 15 Yang Yang 2014-05-20 06:48:28 UTC
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.

Comment 17 errata-xmlrpc 2014-10-14 04:17:01 UTC
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


Note You need to log in before you can comment on or make changes to this bug.