Bug 770328

Summary: Failed to resize raw format image on iscsi disk
Product: Red Hat Enterprise Linux 6 Reporter: Qunfang Zhang <qzhang>
Component: qemu-kvmAssignee: Ademar Reis <areis>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: agrover, bgoncalv, chayang, dyuan, jen, juzhang, michen, mkenneth, pbonzini, qzhang, rbalakri, rpacheco, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-13 14:51:13 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:    
Bug Blocks: 803608    
Attachments:
Description Flags
screenshot -1
none
screenshot -2 none

Description Qunfang Zhang 2011-12-26 03:08:19 UTC
Description of problem:
When enlarge disk with "block_resize" qemu command, it failed for raw format image on an iscsi disk. Has discussed this with some develop guys in virt-devel, create this issue to track this issue. Assign to Paolo directly as he required in the mail.

Version-Release number of selected component (if applicable):
2.6.32-220.el6.x86_64
qemu-kvm-0.12.1.2-2.213.el6.x86_64

How reproducible:
Always

Steps to Reproduce:

1. On host:
# iscsiadm -m discovery -t sendtargets -p 10.66.11.239
10.66.11.239:3260,1 intel_migration
# iscsiadm --mode node --targetname intel_migration  --portal 10.66.11.239:3260,1 --login
#fdisk -l
(Shows there's a new disk  /dev/sdb1 with 80GB)
#pvcreate /dev/sdb1
#vgcreate vgtest-qzhang  /dev/sdb1
#lvcreate -n lvtest-2k8r2 -L 25G vtest-qzhang
#lvcreate -n lv-ide-raw -L 1G vgtest-qzhang
#lvcreate -n lv-ide-qcow2 -L 1G vgtest-qzhang
#lvcreate -n lv-virtio-raw -L 1G vgtest-qzhang
#lvcreate -n lv-virtio-qcow2 -L 1G vgtest-qzhang

#qemu-img create -f qcow2 /dev/vgtest-qzhang/lvtest-2k8r2 25G
#qemu-img create -f raw /dev/vgtest-qzhang/lv-ide-raw 1G
#qemu-img create -f qcow2 /dev/vgtest-qzhang/lv-ide-qcow2 1G
#qemu-img create -f raw /dev/vgtest-qzhang/lv-virtio-raw 1G
#qemu-img create -f qcow2 /dev/vgtest-qzhang/lv-virtio-qcow2 1G

2. Boot a win2k8-r2 guest pre-installed and attach a secondary disk using the 1G iscsi lvm I just created.
I test 4 scenarios: ide-raw, ide-qcow2, virtio-raw, virtio-qcow2.
Boot the guest with the 4 iscsi disk one by one.
Take the ide-raw for example:
#/usr/libexec/qemu-kvm ......-drive file=/dev/vgtest-qzhang/lv-ide-raw,if=none,id=drive-ide0-0-1,werror=stop,rerror=stop,cache=none,format=raw -device ide-drive,drive=drive-ide0-0-1,id=ide0-0-1,bus=ide.1,unit=0

3. After boot the 2k8 guest, checked in the device manager. There's a system disk and a 1G data disk.

4. (qemu)info block
drive-ide0-0-0: removable=0 file=/dev/vgtest-qzhang/lvtest-2k8r2 ro=0 drv=qcow2 encrypted=0
drive-fdc0-0-0: removable=1 locked=0 tray-open=0 file=/opt/virtio-win-1.4.0.vfd ro=1 drv=raw encrypted=0
drive-ide0-0-1: removable=0 file=/dev/vgtest-qzhang/lv-ide-raw ro=0 drv=raw encrypted=0

5. Enlarge the lv-ide-raw disk:
On host: #lvextend -L +1G /dev/vgtest-qzhang/lv-ide-raw 
    Extending logical volume lv-ide-raw to 2.00 GiB
    Logical volume lv-ide-raw successfully resized 
(qemu)block_resize drive-ide0-0-1 2G
An undefined error has ocurred

6. Test ide-qcow2, virtio-raw, virtio-qcow2 separately.
Results:
(1)ide.raw (iscsi):
enlarge/shrink: An undefined error has occurred

ide.raw(retest with a local file):
enlarge/decrease: Need to shutdown guest then boot again, the disk changes to the new size.

(2)ide.qcow2(iscsi):
enlarge:
Need to shutdown guest and boot again, then the disk changes to the new size.
shrink:
An undefined error has occurred (It is expected, qcow2 don't support shrink)

(3)virtio.raw:
iscsi: Enlarge/shrink: An undefined error has occurred

local file: Can enlarge/shrink successfully and no need to reboot guest.

(4)virtio.qcow2:
Enlarge:
Succeed and no need reboot.
Shrink:
An undefined error has occurred. (It is expected, qcow2 don't support shrink)
  
Actual results:
Raw format image on iscsi disk failed to resize with "block_resize" command.

Expected results:
Resize raw format image on iscsi disk should work.

Additional info:

Comment 4 RHEL Program Management 2012-07-10 06:27:26 UTC
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.

Comment 5 RHEL Program Management 2012-07-11 02:02:07 UTC
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 6 Paolo Bonzini 2012-07-17 07:46:50 UTC
This is because the iSCSI target does not report changes to the capacity of the disk.  I'm not sure that this can be fixed, so let's reassign the bug for triaging.

Comment 7 RHEL Program Management 2012-09-07 05:23:43 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 8 Eric Blake 2013-07-12 19:24:00 UTC
*** Bug 803608 has been marked as a duplicate of this bug. ***

Comment 11 Qunfang Zhang 2015-10-13 06:57:04 UTC
Created attachment 1082273 [details]
screenshot -1

Comment 12 Qunfang Zhang 2015-10-13 07:01:00 UTC
And sometimes, can not create a volume on the "new created" 1G disk. Please check the following screenshot-2.

Comment 13 Qunfang Zhang 2015-10-13 07:01:31 UTC
Created attachment 1082274 [details]
screenshot -2

Comment 15 Andy Grover 2015-10-13 16:37:52 UTC
I don't think this is an iscsi target issue because we're only using iscsi to export the entire 80G LUN to the guest. From tgt's perspective nothing is getting resized.

I'm not a qemu expert but using 'qemu-img create' on block devices (the LVs) instead of files seems unconventional. You don't need qemu-img to create a raw image in the LV because the LV already is a block device you can give to the guest. The most straightforward way would be to create a 1G LV like you're doing, and then to resize later, use lvresize, and then the guest would see a 2G volume and then could extend any fs or partition in the volume from the original size.

Rassigning back to qemu.