Bug 1159735
| Summary: | fail to do thinly-provisioned testing with windows guest using scsi-hd/scsi-block interface under PC machine type | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Sibiao Luo <sluo> |
| Component: | qemu-kvm-rhev | Assignee: | Paolo Bonzini <pbonzini> |
| Status: | CLOSED NOTABUG | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | urgent | Docs Contact: | |
| Priority: | high | ||
| Version: | 7.1 | CC: | chayang, djasa, hhuang, juzhang, knoel, michen, pbonzini, qzhang, rbalakri, sluo, virt-bugs, 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: | 1056379 | Environment: | |
| Last Closed: | 2014-12-12 13:24:16 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: | |||
| Bug Depends On: | 1056379 | ||
| Bug Blocks: | |||
Hi Paolo, Would you have a look this bz? According to sluo's option, this bz blocks qe run thin provision functional testing by using window guests. Best Regards, Junyi This works for me (I only tried scsi-hd for now). Steps:
1) create a new Windows 2012R2 virtual machine (e.g. win2012r2-64.qcow2) with virtio-scsi storage.
2) create a new qcow2 file using win2012r2-64.qcow2 as the backing file; make it a bit larger, for example:
$ qemu-img info ~/win2012r2-test.qcow2
image: /home/pbonzini/win2012r2-test.qcow2
file format: qcow2
virtual size: 30G (32212254720 bytes)
disk size: 8.1G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
corrupt: false
$ qemu-img create -f qcow2 -obacking_file=win2012-64r2.qcow2,backing_fmt=qcow2 win2012r2-test.qcow2 35G
2) start the virtual machine:
$ /usr/libexec/qemu-kvm --enable-kvm -m 1024 -device virtio-scsi-pci \
-drive if=none,id=hd,file=$HOME/win2012r2-test.qcow2,discard=unmap \
-device scsi-disk,drive=hd -usb -usbdevice tablet
3) pick Computer Management from the Start screen ("Apps by name"). Go to Disk Management and format a new partition in the unallocated space. Choose 1500 MB as the size and (important!) *disable* "Perform a quick format". Leave everything to the default and proceed until the disk is formatted.
4) on the host:
$ du -h ~/win2012r2-test.qcow2
2,0G /home/pbonzini/win2012r2-test.qcow2
5) from "This PC" select "New Volume (E:)", Drive Tools (in the title bar), Optimize. You should see a new window with.
Drive Media type Last run Current status
OS_Install (C:) Thin provisioned drive Never run OK
New Volume (E:) Thin provisioned drive Never run OK
6) Click "Optimize" and wait a minute or so. Current status will go through "Analyzing allocations...", "Enumerating slabs: xx%", "xx% slab-consolidated", "xx% trimmed", "OK (100% space efficiency)".
7) on the host:
$ du -h ~/win2012r2-test.qcow2
595M /home/pbonzini/win2012r2-test.qcow2
(In reply to Paolo Bonzini from comment #3) > This works for me (I only tried scsi-hd for now). Steps: > > 1) create a new Windows 2012R2 virtual machine (e.g. win2012r2-64.qcow2) > with virtio-scsi storage. > > 2) create a new qcow2 file using win2012r2-64.qcow2 as the backing file; > make it a bit larger, for example: > > $ qemu-img info ~/win2012r2-test.qcow2 > image: /home/pbonzini/win2012r2-test.qcow2 > file format: qcow2 > virtual size: 30G (32212254720 bytes) > disk size: 8.1G > cluster_size: 65536 > Format specific information: > compat: 1.1 > lazy refcounts: false > corrupt: false > > $ qemu-img create -f qcow2 > -obacking_file=win2012-64r2.qcow2,backing_fmt=qcow2 win2012r2-test.qcow2 35G > > 2) start the virtual machine: > > $ /usr/libexec/qemu-kvm --enable-kvm -m 1024 -device virtio-scsi-pci \ > -drive if=none,id=hd,file=$HOME/win2012r2-test.qcow2,discard=unmap \ > -device scsi-disk,drive=hd -usb -usbdevice tablet > > 3) pick Computer Management from the Start screen ("Apps by name"). Go to > Disk Management and format a new partition in the unallocated space. Choose > 1500 MB as the size and (important!) *disable* "Perform a quick format". > Leave everything to the default and proceed until the disk is formatted. > > 4) on the host: > > $ du -h ~/win2012r2-test.qcow2 > 2,0G /home/pbonzini/win2012r2-test.qcow2 > > 5) from "This PC" select "New Volume (E:)", Drive Tools (in the title bar), > Optimize. You should see a new window with. > > Drive Media type Last run Current status > OS_Install (C:) Thin provisioned drive Never run OK > New Volume (E:) Thin provisioned drive Never run OK > > 6) Click "Optimize" and wait a minute or so. Current status will go through > "Analyzing allocations...", "Enumerating slabs: xx%", "xx% > slab-consolidated", "xx% trimmed", "OK (100% space efficiency)". > > 7) on the host: > > $ du -h ~/win2012r2-test.qcow2 > 595M /home/pbonzini/win2012r2-test.qcow2 Thanks for Paolo Bonzini's kindly instruction, I also tried it with your steps which can discard the free space from 2.3G to 460M. Before click "Optimize". # stat /home/win2012R2-snapshot.qcow2 | grep Blocks Size: 2210070528 Blocks: 4315792 IO Block: 4096 regular file # du -h /home/win2012R2-snapshot.qcow2 2.1G /home/win2012R2-snapshot.qcow2 After click "Optimize". # stat /home/win2012R2-snapshot.qcow2 | grep Blocks Size: 2246049792 Blocks: 629392 IO Block: 4096 regular file # du -h /home/win2012R2-snapshot.qcow2 308M /home/win2012R2-snapshot.qcow2 But i did not see the 'Thin provisioned drive' 'Media type', it was 'Hard disk drive' 'Media type' for me. BTW, does it must to use the snapshot for windows to try the discard=on/unmap function? How about using the disk/image directly (like comment #1) ? Best Regards, sluo You could use the disk or disk image directly, but using the snapshot makes it much easier to understand what is going on. (In reply to Paolo Bonzini from comment #5) > You could use the disk or disk image directly, but using the snapshot makes > it much easier to understand what is going on. OK, thanks for your kindly reminds, i will update it to our TCMS. *** Bug 1253722 has been marked as a duplicate of this bug. *** |
host info: # uname -r && rpm -q qemu-kvm-rhev 3.10.0-191.el7.x86_64 qemu-kvm-rhev-2.1.2-5.el7.x86_64 e.g:...-drive file=my-data-disk.qcow2,if=none,id=drive-data-disk,format=qcow2,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 copy a file into the disk to take up the space in guest host ]# stat my-data-disk.qcow2 | grep Blocks Size: 100401152 Blocks: 195992 IO Block: 4096 regular file after remove the file in guest. host ]# stat my-data-disk.qcow2 | grep Blocks Size: 126287872 Blocks: 246552 IO Block: 4096 regular file after use the the 'Windows Optimize Drives Utility'("disk management"--->"Properties"--->"tool"--->"disk defragementation"). host ]# stat my-data-disk.qcow2 | grep Blocks Size: 137691136 Blocks: 268824 IO Block: 4096 regular file