Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1056379 - fail to do thinly-provisioned testing with windows guest using scsi-hd/scsi-block interface under PC machine type
Summary: fail to do thinly-provisioned testing with windows guest using scsi-hd/scsi-b...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Paolo Bonzini
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1159735
TreeView+ depends on / blocked
 
Reported: 2014-01-22 05:03 UTC by Sibiao Luo
Modified: 2015-02-25 11:16 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1159735 (view as bug list)
Environment:
Last Closed: 2014-12-24 02:41:03 UTC


Attachments (Terms of Use)

Description Sibiao Luo 2014-01-22 05:03:09 UTC
Description of problem:
Windows only supports automatic discard (like "-o discard" in Linux), but it fail to fail to do thinly-provisioned testing with win8-32bit guest using scsi-hd interface, it cann't discard the space after remove the data in guest.
BTW, if use the scsi-block interface which have no such issue.

Version-Release number of selected component (if applicable):
host info:
3.10.0-76.el7.x86_64
qemu-kvm-1.5.3-38.el7.x86_64
seabios-1.7.2.2-10.el7.x86_64
seabios-bin-1.7.2.2-10.el7.x86_64
guest info:
win8.0-32bit
virtio-win-prewhql-0.1-74

How reproducible:
3/3

Steps to Reproduce:
1.modprobe a scsi_debug disk.
# modprobe scsi_debug lbpu=1 lbpws=1
# lsscsi
[0:0:0:0]    disk    ATA      ST3500413AS      HP64  /dev/sda 
[2:0:0:0]    cd/dvd  hp       DVD-RAM GH80N    RF01  /dev/sr0 
[19:0:0:0]   disk    Linux    scsi_debug       0004  /dev/sdb 
# qemu-img info /dev/sdb
image: /dev/sdb
file format: raw
virtual size: 8.0M (8388608 bytes)
disk size: 0

2.assign it to windows guest and install virtio-win driver in guest.
e.g:...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-hd,drive=drive-data-disk,id=data-disk,bus=scsi1.0

C:\> fsutil behavior query DisableDeleteNotify
DisableDeleteNotify = 0

3.install virtio-win driver, and cat the map.
# cat /sys/bus/pseudo/drivers/scsi_debug/map

4.initialize the disk and make file system (NTFS format) to the disk in the guest.

5.On the host side.
# cat /sys/bus/pseudo/drivers/scsi_debug/map

6.copy a file into the disk to take up the space in guest.

7.on host side.
# cat /sys/bus/pseudo/drivers/scsi_debug/map

8.remove the file in guest.

9.on host side.
# cat /sys/bus/pseudo/drivers/scsi_debug/map

Actual results:
after step 2, boot up guest successfully.
after step 3, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
       <--------output nothing
after step 5, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-183,192,14335
after step 7, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-192,200-3287,14335         <------------------------+
after step 9,                                             |
# cat /sys/bus/pseudo/drivers/scsi_debug/map              |
0,128-192,200-3287,14335         <------------------------+

Expected results:
after step 9, it should discard the holes successfully after remove the file in step 8.

Additional info:
# /usr/libexec/qemu-kvm -M pc -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=org.qemu.guest_agent.0,bus=virtio-serial0.0,id=port1,nr=1 -drive file=/home/win8.0-32.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -device scsi-hd,drive=drive-system-disk,id=system-disk,bus=scsi0.0,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=00:01:02:B6:40:21,bus=pci.0,addr=0x5 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio -drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-hd,drive=drive-data-disk,id=data-disk,bus=scsi1.0

Comment 1 Sibiao Luo 2014-01-22 05:06:35 UTC
Tried the scsi-block with the same testing.

e.g:...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi1.0

Result:
after step 3, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
       <--------output nothing
after step 5, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-487,3512-8143,9088-9095,9600-9615,10367
after step 7, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-407,480-487,2160-8143,9064-9071,9088-9095,9600-9935,10367
after step 9,
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-487,2160-9071,9088-9095,9600-10359,10367

Best Regards,
sluo

Comment 2 Sibiao Luo 2014-01-22 06:40:08 UTC
Tried the win2012R2 also hit the similar issue. the cat map values are the same if use scsi-block interface, while take more space holes if use scsi-hd interface.

host info:
3.10.0-76.el7.x86_64
qemu-kvm-1.5.3-38.el7.x86_64
seabios-1.7.2.2-10.el7.x86_64
seabios-bin-1.7.2.2-10.el7.x86_64
guest info:
win2012R2-64bit
virtio-win-prewhql-0.1-74

#### scsi-hd:
e.g:...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-hd,drive=drive-data-disk,id=data-disk,bus=scsi1.0

after step 3, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
       <--------output nothing
after step 5, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,4840,4856,4864-11039,14335
after step 7, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,2960-2967,4840,4856,4864-14127,14335
after step 9,
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,2432-2439,2944-2947,2952-2956,2960-2967,4840,4848,4856-14127,14335

#### scsi-block:
e.g:...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi1.0

after step 3, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
       <--------output nothing
after step 5, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-407,480-487,3512-8143,9088-9095,9600-9615,10367
after step 7, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-487,2160-9071,9088-9095,9600-10359,10367
after step 9,
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-487,2160-9071,9088-9095,9600-10359,10367

Comment 3 Paolo Bonzini 2014-01-22 14:28:02 UTC
Probably the same as bug 1037503 -- can you retest with qemu-kvm-1.5.3-41.el7?

Comment 4 Sibiao Luo 2014-01-23 06:07:46 UTC
(In reply to Paolo Bonzini from comment #3)
> Probably the same as bug 1037503 -- can you retest with
> qemu-kvm-1.5.3-41.el7?
No, hit the same issue with the qemu-kvm-1.5.3-41.el7 version. here i just paste the scsi-hd test results for your reference.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-76.el7.x86_64
qemu-kvm-1.5.3-41.el7.x86_64

## scsi-hd:
e.g:...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-hd,drive=drive-data-disk,id=data-disk,bus=scsi1.0

after step 3, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
       <--------output nothing
after step 5, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,2432-2439,2944-2959,4840-11039,14335
after step 7, 
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,2432-2439,2944-2967,4840-14127,14335
after step 9,
# cat /sys/bus/pseudo/drivers/scsi_debug/map
0,128-478,480-967,2432-2439,2944-2967,4840-14127,14335

Best Regards,
sluo

Comment 5 Paolo Bonzini 2014-01-23 13:06:08 UTC
I found this in the MS documentation:

> Windows Optimize Drives Utility
> 
> End users or system administrators can use the Optimize Drives utility to
> reclaim space either by creating a manual request or by optimizing the 
> schedule configuration. If the disk drive is a thin provisioning LUN, the 
> media type of the disk drive appears as “Thin Provisioning Drive”.

To access the utility:

1) Right click on computer, "Manage".

2) Click on storage, right click on "disk management", "Properties".

3) Tools tab, then "Optimize".

I don't yet have access to Windows 8 or Server 2012, will look at this as soon as possible.

Comment 10 Paolo Bonzini 2014-11-04 18:00:46 UTC
Sibiao, can you check in the Optimize Drives utility whether the media type of the disk drive appears as “Thin Provisioning Drive”?

Comment 11 Sibiao Luo 2014-11-05 03:19:53 UTC
(In reply to Paolo Bonzini from comment #10)
> Sibiao, can you check in the Optimize Drives utility whether the media type
> of the disk drive appears as “Thin Provisioning Drive”?
Sure, I just did the disk defragementation to my thin provisioning data disk.

Best Regards,
sluo

Comment 14 Sibiao Luo 2014-12-24 02:41:03 UTC
According to bug 1159735#c3, it works for me now.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-219.el7.x86_64
qemu-kvm-1.5.3-84.el7.x86_64
guest info:
win2012R2

Before click "Optimize":
# stat /home/win2012r2-test.qcow2 | grep Blocks
  Size: 2169765888	Blocks: 4236688    IO Block: 4096   regular file
# du -h /home/win2012r2-test.qcow2
2.1G	/home/win2012r2-test.qcow2

After click "Optimize":
# stat /home/win2012r2-test.qcow2 | grep Blocks
  Size: 2204434432	Blocks: 1494048    IO Block: 4096   regular file
# du -h /home/win2012r2-test.qcow2
734M	/home/win2012r2-test.qcow2

Best Regards,
sluo


Note You need to log in before you can comment on or make changes to this bug.