[CentOS-virt] Red Hat VirtIO SCSI pass-through controller

Wed Mar 15 20:16:54 UTC 2017
Gena Makhomed <gmm at csdoc.com>

On 14.03.2017 20:05, Gena Makhomed wrote:

> When I use "VirtIO SCSI controller" in virt-manager,
> and when I install Windows Server 2012 R2 -
> I can use only viostor driver and can't use vioscsi driver,
> Windows Server 2012 R2 can't load vioscsi driver (?)
> from virtio-win.iso and did not see virtual hard disks
> with vioscsi driver. Only viostor driver work normally.
>
> How I can use "Red Hat VirtIO SCSI pass-through controller"
> for Windows Server 2012 R2 virtual machine, what I need
> to configure in xml-config?
>
> current /etc/libvirt/qemu/windows.xml config:
>
>    <controller type='scsi' index='0' model='virtio-scsi'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
> function='0x0'/>
>     </controller>
>
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='raw' cache='none' io='native'
> discard='unmap'/>
>       <source file='/volume/kvm-windows-system'/>
>       <target dev='vda' bus='virtio'/>
>       <boot order='1'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
> function='0x0'/>
>     </disk>

I found solution.

bus='virtio' - this is The paravirtualized block device (virtio-blk)
fou using "Red Hat VirtIO SCSI pass-through controller" vioscsi driver
I need to use only SCSI virtual disks (bus='scsi'), not VirtIO ones.

Correct config fragment:

     <controller type='scsi' index='0' model='virtio-scsi'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' 
function='0x0'/>
     </controller>

     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none' io='native' 
discard='unmap'/>
       <source file='/volume/kvm-windows-server-system'/>
       <target dev='sda' bus='scsi'/>
       <boot order='1'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>

     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none' io='native' 
discard='unmap'/>
       <source file='/volume/kvm-windows-server-data'/>
       <target dev='sdb' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </disk>

Now all works fine, I install Windows Server 2012 R2 with vioscsi driver

And now Windows Server 2012 R2 see disks as "thin provisioned drives".
(SCSI UNMAP feature works only with vioscsi driver, not with viostor).

No more need to use sdelete.exe -z to reclaim unused VM disk space. :-)

More details:

https://technet.microsoft.com/en-us/library/hh831391(v=ws.11).aspx
Thin Provisioning and Trim Storage Overview

https://kallesplayground.wordpress.com/2014/04/26/storage-reclamation-part-2-windows/comment-page-1/
Storage reclamation – part 2 – Windows

-- 
Best regards,
  Gena