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 1468447 - Executing HMP block_resize command via QMP ‘human-monitor-command’ gets unexpected result
Summary: Executing HMP block_resize command via QMP ‘human-monitor-command’ gets unex...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.4-Alt
Hardware: ppc64le
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Dr. David Alan Gilbert
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-07 07:08 UTC by yilzhang
Modified: 2017-07-12 01:57 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-10 19:16:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yilzhang 2017-07-07 07:08:57 UTC
Description of problem:
Boot up a guest with one qcow2 disk image(acts as one data disk), then using QMP ‘human-monitor-command’ to execute  HMP block_resize, which attempts to resize the block disk to a smaller size(e.g. 1G-->512M).
This is expected to fail, but QMP returns “success” and the block disk’s size is not correct after changing.


Version-Release number of selected component (if applicable):
Host:  kernel: 4.11.0-10.el7a.ppc64le
       qemu-kvm-2.9.0-16.el7a.ppc64le
Guest: 4.11.0-10.el7a.ppc64le

How reproducible: 100%


Steps to Reproduce:
1. boot guest with QMP enabled, Qemu cli:
/usr/libexec/qemu-kvm \
-name yilzhang_vm \
-serial unix:/tmp/myserial.log,server,nowait \
-smp 8,sockets=2,cores=4,threads=1 -m 8192 \
-qmp tcp:0:9999,server,nowait \
-monitor stdio \
-nodefaults -enable-kvm \
\
-device virtio-scsi-pci,bus=pci.0,addr=0x3,id=scsi0 \
-drive file=/home/yilzhang/rhel7.4-alt-20170626.4.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop \
-device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 \
\
-drive file=/dev/sdb3,if=none,cache=none,id=data-disk1,format=qcow2 \
-device virtio-blk-pci,drive=data-disk1,bus=pci.0,id=blk-disk1 \
\
-netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup \
-device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=52:54:00:c3:e7:84,bus=pci.0,addr=0x4,ioeventfd=off \
2. from any box with telnet client run #telnet $HostIP 4444
   {"execute": "qmp_capabilities"}
3. execute block_resize command with QMP "human-monitor-command" to shrink a block disk with qcow2 format
 {"execute":"human-monitor-command","arguments":{"command-line":"block_resize  data-disk1 536870912" }}



Actual results:
1. step3 QMP success:
{"execute":"human-monitor-command","arguments":{"command-line":"block_resize  data-disk1 536870912" }}
{"return": ""}
2. the block disk's size is changed to 512T which is not correct:
{"execute": "query-block"}
{"return": [{"io-status": "ok", "device": "drive-system-disk", .......  ......}, {"io-status": "ok", "device": "data-disk1", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 562949953421312, "filename": "/dev/sdb3", "cluster-size": 65536, "format": "qcow2", "actual-size": 0, "format-specific": {"type": "qcow2"

[guest]#   fdisk -l  /dev/vda
Disk /dev/vda: 562950.0 GB, 562949953421312 bytes, 1099511627776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[guest]#  lsblk -p| grep vda
/dev/vda                    252:0    0  512T  0 disk 



Expected results:
1. step3 QMP should prompt error, like:
{"error": {"class": "GenericError", "desc": "Failed to resize image: Operation not supported"}}
2. the block disk's size is NOT changed


Additional info:
If I use QMP block_resize to shrink the block image's size, QMP will prompt error message (this is expected since qcow2 image doesn't support shrink):

{ "execute": "block_resize", "arguments": { "device": "data-disk1", "size": 536870912 }}
{"error": {"class": "GenericError", "desc": "Failed to resize image: Operation not supported"}}

Comment 2 Karen Noel 2017-07-07 11:20:34 UTC
Does this reproduce on x86 or Power 8? Thanks.

Comment 3 Ademar Reis 2017-07-07 13:53:49 UTC
We don't support HMP in RHEL, so I suggest closing it as WONTFIX. David Gilbert is the upstream maintainer of HMP, so I'm reassigning it to him just in case it's a low hanging fruit worth fixing upstream.

Comment 7 Dr. David Alan Gilbert 2017-07-10 19:16:24 UTC
Sizes there are assumed to be in MiB; unless you add a prefix (I tried all the way back to 1.5.3 it hasn't changed).

You should find:
block_resize  data-disk1 536870912b
or
block_resize data-disks1 512

does what you expect.

HMP is for Humans, humans generally think of disks in MiB or larger by default, so that's fine.


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