qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] Using vhost scsi


From: Stefan Hajnoczi
Subject: Re: [Qemu-discuss] Using vhost scsi
Date: Tue, 26 Jul 2016 13:52:45 +0100
User-agent: Mutt/1.6.2 (2016-07-01)

> i figured out how to use virtio-blk but i can't find any reference on
> how to use vhost scsi

Back in 2012 I used the following host CD-ROM passthrough script for
testing.  Nowadays I would suggest looking into targetcli
(http://linux-iscsi.org/wiki/Targetcli) instead of poking configfs
directly.

I haven't touched vhost-scsi for years so I'm afraid I can't answer many
questions about it.

Note that QEMU supports virtio-scsi (where the SCSI target is emulated
by QEMU instead of by the host kernel SCSI target).  vhost-scsi isn't
widely used and does not support QEMU block layer features (migrating
storage, backups/snapshots, image formats like qcow2, etc).  Therefore
you may wish to look at virtio-scsi instead.  It is supported by
libvirt and virt-manager so configuration is well-documented.

mount -t configfs none /sys/kernel/config
modprobe target_core_mod
modprobe target_core_pscsi
modprobe tcm_vhost
cd /sys/kernel/config/target/
mkdir -p /sys/kernel/config/target/vhost/naa.60014059811d880b/tpgt_1/lun/lun_0
mkdir -p /sys/kernel/config/target/core/pscsi_0/sr0
echo -n 'scsi_host_id=1,scsi_channel_id=0,scsi_target_id=0,scsi_lun_id=0' 
>/sys/kernel/config/target/core/pscsi_0/sr0/control
echo -n '/dev/sr0' >/sys/kernel/config/target/core/pscsi_0/sr0/udev_path
echo -n 1 >/sys/kernel/config/target/core/pscsi_0/sr0/enable
echo -n naa.60014059811d880d 
>/sys/kernel/config/target/vhost/naa.60014059811d880b/tpgt_1/nexus
cd /sys/kernel/config/target/vhost/naa.60014059811d880b/tpgt_1/lun/lun_0
ln -s ../../../../../core/pscsi_0/sr0/ .
cd - >/dev/null
/home/stefanha/qemu/x86_64-softmmu/qemu-system-x86_64
    -enable-kvm -m 512 -nographic \
    -kernel arch/x86/boot/bzImage \
    -initrd virtio_scsi_guest_initramfs.gz \
    -append console=ttyS0 \
    -vhost-scsi id=vhost-scsi0,wwpn=naa.60014059811d880b,tpgt=1 \
    -device virtio-scsi-pci,vhost-scsi=vhost-scsi0,event_idx=off

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]