tape device pass-through with virtio-scsi
Environment : RHEL 6.5 with libvirt-0.10.2-29.el6_5.11.x86_64
I want to pass-through a fiberchannel connected tape library device (with 2 tape devices) to a guest, with virtio-scsi driver.
[root]: lsscsi -g
[0:2:0:0] disk IBM ServeRAID M5014 2.13 /dev/sda /dev/sg0
[0:2:1:0] disk IBM ServeRAID M5014 2.13 /dev/sdb /dev/sg1
[5:0:0:0] tape IBM ULT3580-HH6 D2DB /dev/st1 /dev/sg3
[6:0:0:0] tape IBM ULT3580-HH6 D2DB /dev/st0 /dev/sg2
[6:0:0:1] mediumx IBM 3573-TL B.90 /dev/sch0 /dev/sg5
What do I add exactly to the guests xml ?
Or as an alternative, how to configure with virsh ? I find some examples for disks, but not for tapes.
Thanks
Responses
Hi Roselinda
Preface: I have only been messing around with KVM SCSI Passthru for a few days (I am trying cluster KVM Guests with GFS2 on separate hypervisors). So... I am currently at the point where I could make it work, but I don't really know how (yet) ;-)
What I have worked on applies to Fiber Channel LUNs. However, I think it should work for you as well.
I have included ALL my disk devices in the output so you can see how they differ.
# awk '/disk/,/\/disk/' KVMguest01.xml
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/DVGLLVUSGTST81.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/mapper/CAPELLA_0029'/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/mapper/CAPELLA_002a'/>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
I think this would work.
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev=' '/dev/st0'/>
<target dev='st0' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev=' '/dev/st1'/>
<target dev='st1' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/sch0'/>
<target dev='sch0' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>
Unfortunately I do not know how to use virsh edit either to accomplish this configuration. This is probably a horrible method in terms of a supported/enterprise model - but, it's what I used ;-)
- shutdown the Guest
- make a backup of the XML config
- update the XML file
- restart libvirtd
- start the Guest (and troubleshoot the warnings until you get it right)
I don't know if type "disk" will work for certain. From my limited experience using type "block" device="lun" was the key. I believe as long as you can map the Host devices to your Guest using the same identifiers (i.e. st0, st1 and sch0) - I would think it should work as I am assuming that the devices ultimately are just disk targets (like old SCSI devices ;-)
How Determine
slot??? acordind to
[root]: lsscsi -g
[0:2:0:0] disk IBM ServeRAID M5014 2.13 /dev/sda /dev/sg0
[0:2:1:0] disk IBM ServeRAID M5014 2.13 /dev/sdb /dev/sg1
[5:0:0:0] tape IBM ULT3580-HH6 D2DB /dev/st1 /dev/sg3
[6:0:0:0] tape IBM ULT3580-HH6 D2DB /dev/st0 /dev/sg2
[6:0:0:1] mediumx IBM 3573-TL B.90 /dev/sch0 /dev/sg5
I believe the slots that are identified in the xml file indicate the guest mapping (not the host).
Host (from Guest.xml)
[root@pdgllpusgtst91 qemu]# awk '/disk/,/\/disk/' DVGLLVUSGTST81.xml
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/DVGLLVUSGTST81.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/mapper/CAPELLA_0029'/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<disk type='block' device='lun' sgio='unfiltered'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/mapper/CAPELLA_002a'/>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>
Guest
[root@dvgllvusgtst81 ~]# lspci | grep storage
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:08.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:0a.0 SCSI storage controller: Red Hat, Inc Virtio block device
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
