Bug 825144

Summary: [virtio-win][viostor] fail to shrink the used data image size as we expected
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: virtio-winAssignee: Vadim Rozenfeld <vrozenfe>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, bcao, bsarathy, dawu, dyasny, fyang, juzhang, mdeng, michen, rhod, vrozenfe, wdai
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: 2012-07-17 14:14:11 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:
Attachments:
Description Flags
after the step 5, we can see the data image size was still 15G via "Disk Management" dialog. none

Description Sibiao Luo 2012-05-25 08:41:46 UTC
Description of problem:
attach a data image to the guest, and initalize and format this data disk in "Disk Management" dialog. and then, shrink the data image size, reboot the guest to find that fail to shrink the data image size as we expected. I will attach the screenshot of the windows guest info later.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
2.6.32-274.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64
guest info:
guest name: windows_7_sp1_x86
WHQL driver: virtio-win-1.5.1-1

How reproducible:
100%

Steps to Reproduce:
1.create a raw format image and check the size info.
# qemu-img create -f raw my_data_disk.raw 15G
Formatting 'my_data_disk.raw', fmt=raw size=16106127360
# qemu-img info my_data_disk.raw
image: my_data_disk.raw
file format: raw
virtual size: 15G (16106127360 bytes)
disk size: 0
2.start a windows guest with this data image.
3.initalize and format this data image in Disk Management dialog.
4.(qemu) block_resize data_drive 10G
5.reboot the guest and check the data image size.
6.check the iamge size info via qemu-img.

Actual results:
after the step 5, we can see the data image size was still 15G via "Disk Management" dialog.
but after the step 6, the image size wa shrink to 10G
# qemu-img info my_data_disk.raw
image: my_data_disk.raw
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 86M

Expected results:
the data image size was shrink to 10G correctly.

Additional info:
CLI: # /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu SandyBridge -enable-kvm -smp 2 -m 2G -usb -device usb-tablet,id=input0 -name windows_7_sp1_x86 -uuid `uuidgen` -drive file=windows_7_sp1_x86.qcow2,if=none,id=hd,format=qcow2,aio=native,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=hd,id=blk_image,scsi=off,bootindex=1 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -spice disable-ticketing,port=5931 -balloon none -device sga -chardev socket,id=serial0,path=/var/sluo,server,nowait -device isa-serial,chardev=serial0 -monitor unix:/tmp/monitor2,server,nowait -monitor stdio -drive file=/usr/share/virtio-win/virtio-win-1.5.1.iso,if=none,id=drive-ide0-0-3,werror=stop,rerror=stop,cache=none,format=raw,media=cdrom,readonly=on -device ide-drive,drive=drive-ide0-0-3,id=ide0-0-3,bus=ide.1,unit=1 -drive file=/usr/share/virtio-win/virtio-win-1.5.1.vfd,if=none,id=f1,format=raw,cache=none -global isa-fdc.driveA=f1 -drive file=my_data_disk.raw,if=none,id=data_drive,format=raw,aio=native,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=data_drive,id=blk_data

Comment 1 Sibiao Luo 2012-05-25 08:46:42 UTC
Created attachment 586803 [details]
after the step 5, we can see the data image size was still 15G via "Disk Management" dialog.

Comment 2 Vadim Rozenfeld 2012-05-31 21:29:31 UTC
What happens if you shrink the corresponding volume with Disk Management dialog tools, between steps 3 and 4?

Comment 3 Sibiao Luo 2012-06-01 01:59:31 UTC
(In reply to comment #2)
> What happens if you shrink the corresponding volume with Disk Management
> dialog tools, between steps 3 and 4?

Hi Vadim,

   If i shrink the corresponding volum with the Disk Managerment dialog tools, shrink the data_disk to 0 and restart the guest to take effect for example, QEMU prompts some error, and the guest hang at "Shutting down...".

(qemu) block_resize data_drive 0G
(qemu) block I/O error in device 'data_drive': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)

Comment 4 Sibiao Luo 2012-06-01 02:05:00 UTC
(In reply to comment #3)
> (In reply to comment #2)

> Hi Vadim,
> 
>    If i shrink the corresponding volum with the Disk Managerment dialog
> tools, shrink the data_disk to 0 and restart the guest to take effect for
> example, QEMU prompts some error, and the guest hang at "Shutting down...".
> 
> (qemu) block_resize data_drive 0G
> (qemu) block I/O error in device 'data_drive': Input/output error (5)
> 
> (qemu) info status 
> VM status: paused (io-error)

and fail to resume it via monitor.
(qemu) cont
(qemu) block I/O error in device 'data_drive': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)

Comment 5 Ronen Hod 2012-07-17 09:41:43 UTC
Probably the same issue as https://bugzilla.redhat.com/show_bug.cgi?id=825131#c2

Comment 6 Sibiao Luo 2012-07-17 10:41:57 UTC
(In reply to comment #2)
> 
(In reply to comment #5)
> Probably the same issue as
> https://bugzilla.redhat.com/show_bug.cgi?id=825131#c2

Hi Vadim and Ronen,

   Just as you said, I add one step re-sizing volume in Windows guest between steps 3 and 4, and check that everything works well, then block_resize in QEMU (but not bellow the volume size), it has no problem, the data image size can be online shrunk correctly. 

   Thanks for your kindly reminds.

Best wishes.
sluo