Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1136752

Summary: virtio-blk dataplane support for block_resize and hot unplug
Product: Red Hat Enterprise Linux 7 Reporter: Stefan Hajnoczi <stefanha>
Component: qemu-kvm-rhevAssignee: Stefan Hajnoczi <stefanha>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: huding, juzhang, michen, mrezanin, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.1.0-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:54:28 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 Stefan Hajnoczi 2014-09-03 08:45:45 UTC
Current qemu-kvm-rhev does not support block_resize or hot unplug of dataplane virtio-blk-pci devices.

The patches to add support for these commands have been merged upstream now.  Backport them to RHEV.

Comment 1 Stefan Hajnoczi 2014-09-03 08:50:04 UTC
Steps to verify:

1. Launch guest with a data.img disk that we will test:
$ qemu-system-x86_64 -enable-kvm -m 1024 -cpu host \
      -object iothread,id=iothread0 \
      -drive if=none,id=drive0,cache=none,format=raw,\
             aio=native,file=boot.img \
      -device virtio-blk-pci,drive=drive0,id=virtio-blk-pci0,\
              iothread=iothread0 \
      -drive if=none,id=drive1,cache=none,format=raw,\
             aio=native,file=data.img \
      -device virtio-blk-pci,drive=drive1,id=virtio-blk-pci1,\
              iothread=iothread0

2. Resize data.img:
(qemu) block_resize drive1 2G

3. Verify that the size has changed inside the guest:
(guest)# blockdev --getsz /dev/vdb

4. Hot unplug data.img:
(qemu) drive_del drive1
(qemu) device_del virtio-blk-pci1

5. Verify that the virtio-blk-pci device has disappeared:
(guest)# ls -l /dev/vdb
ls: cannot access /dev/vdb: No such file or directory

Comment 3 Stefan Hajnoczi 2014-09-03 09:20:54 UTC
Patches backported and posted to rhvirt-patches.

Comment 4 Stefan Hajnoczi 2014-09-11 14:18:47 UTC
*** Bug 1139572 has been marked as a duplicate of this bug. ***

Comment 5 Miroslav Rezanina 2014-09-17 07:38:01 UTC
Fix included in qemu-kvm-rhev-2.1.0-4.el7

Comment 7 Sibiao Luo 2014-09-22 06:23:24 UTC
- Reproduce this issue on qemu-kvm-rhev-2.1.0-3.el7.x86_64
host info:
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-152.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64

(qemu) block_resize drive-data-disk1 20G
Device 'drive-data-disk1' is in use

{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-data-disk1"}}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}

(qemu) Device 'drive-data-disk1' is busy: block device is in use by data plane

#########################################################################

- Verify this issue on qemu-kvm-rhev-2.1.0-4.el7.x86_64 with the steps as comment #1.
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-152.el7.x86_64
qemu-kvm-rhev-2.1.0-4.el7.x86_64

Steps:
0. Create a 10G raw data disk.
# qemu-img info my-data-disk.raw
image: my-data-disk.raw
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 0

1. Launch guest with a my-data-disk.raw disk that we will test:
e.g:...-object iothread,id=iothread0 -drive file=/home/my-data-disk.raw,if=none,id=drive-data-disk1,cache=none,format=raw,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-data-disk1,bus=pci.0,addr=0x7,id=data-disk1,iothread=iothread0

2. Resize my-data-disk.raw:
(qemu) block_resize drive-data-disk1 15G

3. Verify that the size has changed inside the guest and host host:
(guest)# blockdev --getsz /dev/vda
31457280        <--------change from 20971520 to 31457280.

# qemu-img info /home/my-data-disk.raw
image: /home/my-data-disk.raw
file format: raw
virtual size: 15G (16106127360 bytes) <--------change from 10G to 15G.
disk size: 0

4. Hot unplug my-data-disk.raw:
HMP:
(qemu) drive_del drive-data-disk1
(qemu) device_del data-disk1
QMP:
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"data-disk1"}}
{"return": {}}

5. Verify that the virtio-blk-pci device has disappeared:
(guest)# ls -lh /dev/vda
ls: cannot access /dev/vda: No such file or directory

Best Regards,
sluo

Comment 9 errata-xmlrpc 2015-03-05 09:54:28 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.

https://rhn.redhat.com/errata/RHSA-2015-0624.html