Bug 840458

Summary: RFE - Virtio-scsi should support block_resize
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: kernelAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, areis, bsarathy, dyasny, juzhang, michen, mkenneth, pbonzini, qzhang, shuang, sluo, virt-maint, wdai
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-2.6.32-328.el6 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 808660 Environment:
Last Closed: 2013-02-21 06:40:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 808660    
Bug Blocks: 833566    

Description Paolo Bonzini 2012-07-16 12:30:42 UTC
+++ This bug was initially created as a clone of Bug #808660 +++

Description of problem:

block_resize is a useful command and virtio-blk supports this command. So, We QE think virtio-scsi also should support block_resize.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

--- Additional comment from pm-rhel on 2012-07-10 04:14:31 EDT ---

This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

--- Additional comment from pm-rhel on 2012-07-10 22:04:53 EDT ---

This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 2 Jarod Wilson 2012-10-10 19:43:58 UTC
Patch(es) available on kernel-2.6.32-328.el6

Comment 5 Sibiao Luo 2012-10-11 08:31:19 UTC
I verify this issue on qemu-kvm-0.12.1.2-2.320.el6.x86_64 host.

host info:
# uname -r && rpm -q qemu-kvm
2.6.32-325.el6.x86_64
qemu-kvm-0.12.1.2-2.320.el6.x86_64

Steps:
1. create a RAW data image.
# qemu-img create -f raw my-data-disk.raw 5G
2. start guest with this image as data image.
<qemu-kvm-command-line>...-drive file=/home/my-data-disk.raw,if=none,id=data-disk,format=raw,cache=none,aio=native,media=disk,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=data-disk,id=sluo
3. enlarge the data disk to 10G.
(qemu) block_resize data-disk 10G
(QMP) {"execute": "qmp_capabilities"}
(QMP) { "execute": "block_resize", "arguments": { "device": "data-disk", "size": 10737418240 }}
4. check it in guest.
# echo 1 > /sys/block/sda/device/rescan
# fdisk -l | grep /dev/sda
Disk /dev/sda: 10.7 GB, 10737418240 bytes
5. shrink the data disk to 1G.
(qemu) block_resize data-disk 1G
(QMP) {"execute": "qmp_capabilities"}
(QMP) { "execute": "block_resize", "arguments": { "device": "data-disk", "size": 10737418240 }}
6. check it in guest.
# echo 1 > /sys/block/sda/device/rescan
# fdisk -l | grep /dev/sda

Results:
after the step 4,
# fdisk -l | grep /dev/sda
Disk /dev/sda: 10.7 GB, 10737418240 bytes
after the step 6,
# fdisk -l | grep /dev/sda
Disk /dev/sda: 1073 MB, 1073741824 bytes

Base on above, virtio-blk supports block_resize command, this issue has been fixed correctly. 

-----------------------------------------------------------------------

BTW,
(1).local file + virtio-scsi-pci + block_resize + 'echo 1 > /sys/block/sda/device/rescan' ---> 100% automatically discover for the guest, no need to reboot the guest.
(2).local file + virtio-blk-pci + block_resize ---> 100% automatically discover for the guest, no need to reboot the guest.

If didnot do 'echo 1 > /sys/block/sda/device/rescan' after block_resize, the guest cann't automatically discover the changes of disk at the most. 
But in my test, the guest will hang and cann't resume again form monitor, the QEMU will prompt that 'block I/O error in device 'data-disk': Input/output error (5)', the VM status: paused (io-error) from QEMU monitor.

Anyway, guest should not hang, i will open a new bug for tracking this issue. Please correct me if any mistake.

Best Regards.
sluo

Comment 6 Sibiao Luo 2012-10-11 08:35:18 UTC
(In reply to comment #5)
> I verify this issue on qemu-kvm-0.12.1.2-2.320.el6.x86_64 host.
> 
> host info:
> # uname -r && rpm -q qemu-kvm
> 2.6.32-325.el6.x86_64
> qemu-kvm-0.12.1.2-2.320.el6.x86_64
> 
Sorry, I will test this issue on the kernel-2.6.32-328.el6.

Comment 7 Sibiao Luo 2012-10-11 08:42:57 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > I verify this issue on qemu-kvm-0.12.1.2-2.320.el6.x86_64 host.
> > 
> > host info:
> > # uname -r && rpm -q qemu-kvm
> > 2.6.32-325.el6.x86_64
> > qemu-kvm-0.12.1.2-2.320.el6.x86_64
> > 
> Sorry, I will test this issue on the kernel-2.6.32-328.el6.

(In reply to comment #5)
> I verify this issue on qemu-kvm-0.12.1.2-2.320.el6.x86_64 host.
> 
> host info:
> # uname -r && rpm -q qemu-kvm
> 2.6.32-325.el6.x86_64
> qemu-kvm-0.12.1.2-2.320.el6.x86_64
> 
> Base on above, virtio-blk supports block_resize command, this issue has been
> fixed correctly. 

Please ignore my conclusion, this bug depends On: bug 808660. so, we should verify these bugs after both these bugs are fixed.

Best Regards.
sluo

Comment 8 Qunfang Zhang 2012-11-24 06:52:07 UTC
Verified pass according to: 
https://bugzilla.redhat.com/show_bug.cgi?id=808660#c7

Comment 10 errata-xmlrpc 2013-02-21 06:40:15 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/RHSA-2013-0496.html