For LIO-configured loopback devices, and real SCSI SPC-4 compliant devices, use these configurations for sharing/presenting these host devices to VMs.

Quoting directly from bz1356582#c13: you can use

    <disk type='block' device='lun' sgio='unfiltered'>
      <driver name='qemu' type='raw'/>
      <source file='/dev/sdb'/>
      <target dev='sda' bus='scsi'/>
    </disk>
    <controller type='scsi' index='0' model='virtio-scsi'/>

The important part is device=’lun’ (as opposed to device=’disk’ which uses emulation).

For scsi-generic:

    <hostdev mode="subsystem" type="scsi" sgio="unfiltered">
      <source>
        <adapter name="scsi_host0"/>
        <address bus="0" target="0" unit="0"/>
      </source>
    </hostdev>
    <controller type='scsi' index='0' model='virtio-scsi'/>

scsi-block is accessible via virt-manager. In the “add new virtual hardware” dialog choose “SCSI” under “Bus type” and “LUN passthrough” under “Device type”. Under “Advanced options”, under “SGIO”, choose “unfiltered”.

Another possibility is for QEMU to connect directly to an iSCSI portal. For the simple case where there is no authentication involved:

    <hostdev mode='subsystem' type='scsi'>
      <source protocol='iscsi' name='iqn.2014-08.com.example:iscsi/1'>
        <host name='example.com' port='3260'/>
      </source>
    </hostdev>
    <controller type='scsi' index='0' model='virtio-scsi'/>

(the “/1” means it’s LUN 1 in that iSCSI target, the default being 0). QEMU command line equivalent:

-drive file=iscsi://example.com:3260/iqn.2014-08.com.example:iscsi/1,id=hd
-device scsi-block,drive=hd

(or scsi-generic too). This one is not available from virt-manager but it can also be a good choice if you don’t want to run as root.

You never need aio=native for passthrough devices.

If you have issues (e.g. for QEMU older than qemu-kvm-rhev 2.6.0 or upstream 2.7.0 you might be able to establish the reservations but the RESERVATION CONFLICT sense won’t be propagated correctly to the guest) try leaving out cache=none as well. IIRC it works around the bug.

Thank you Paolo Bonzini!