Bug 1021540

Summary: fail to do block_resize for passthrough iSCSI LUN via scsi-block interface
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED CANTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.5CC: acathrow, bsarathy, chayang, juzhang, michen, mkenneth, pbonzini, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1021544 (view as bug list) Environment:
Last Closed: 2013-10-24 23:08:50 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:
Bug Depends On:    
Bug Blocks: 1021544    

Description Sibiao Luo 2013-10-21 13:27:47 UTC
Description of problem:
we can do block_resize to local file image via vritio-blk or virtio-scsi interface, but we fail to do block_resize for passthrough iSCSI LUN via scsi-block interface. QEMU should give disable message if not support block_resize with passthrough iSCSI LUN or make it works well.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-424.el6.x86_64
qemu-kvm-0.12.1.2-2.414.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a iSCSI LUN.
# qemu-img info /dev/disk/by-path/ip-10.66.90.100\:3260-iscsi-iqn.2001-05.com.equallogic\:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0 
image: /dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0
file format: raw
virtual size: 100G (107379425280 bytes)
disk size: 0
2.boot guest with SCSI LUN passthrough via scsi-block interface.
e.g:...-drive file=/dev/disk/by-path/ip-10.66.90.100\:3260-iscsi-iqn.2001-05.com.equallogic\:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0,if=none,id=drive-data-disk,format=raw,aio=native -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi0 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi0.0
3.do block_resize with passthrough LUN.
{ "execute": "block_resize", "arguments": { "device": "drive-data-disk", "size":50000000000}}
{"return": {}}
guest] # fdisk -l /dev/sda
Disk /dev/sda: 107.4 GB, 107379425280 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

{ "execute": "block_resize", "arguments": { "device": "drive-data-disk", "size":100000000000}}
{"return": {}}
guest] guest] # fdisk -l /dev/sda
Disk /dev/sda: 107.4 GB, 107379425280 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

{"execute": "block_resize", "arguments": { "device": "drive-data-disk", "size":50000000000000}}
{"error": {"class": "UndefinedError", "desc": "An undefined error has ocurred", "data": {}}}

Actual results:
After step 3, excute block_resize to shink or enlarge successfully but fail to detect any changes in guest, no any message output in guest kernel log.
And it will get 'An undefined error has ocurred' error message if enlarge the block size larger than iSCSI LUN.

Expected results:
QEMU should give disable message if not support block_resize with passthrough iSCSI LUN or make it works well.

Additional info:

Comment 1 Paolo Bonzini 2013-10-24 23:08:50 UTC
This is expected behavior.  Because the capacity is retrieved directly from the disk, block_resize cannot change it (there is no "resize" SCSI command to send to the disk).  "Do not shrink" is safe but "do not enlarge" is unsafe, so QEMU is simply checking that you are not asking for more space than allowed.