于 2013-5-29 23:10, Badari Pulavarty 写道: > On 05/29/2013 02:05 AM, Wenchao Xia wrote: >> 于 2013-5-28 17:00, Wenchao Xia 写道: >>> 于 2013-5-28 16:33, Asias He 写道: >>>> On Tue, May 28, 2013 at 10:01:14AM +0200, Paolo Bonzini wrote: >>>>> Il 28/05/2013 09:13, Wenchao Xia ha scritto: >>>>>>>> From: Nicholas Bellinger <n...@linux-iscsi.org> >>>>>>>> >>>>>>>> The WWPN specified in configfs is passed to "-device >>>>>>>> vhost-scsi-pci". >>>>>>>> The tgpt field of the SET_ENDPOINT ioctl is obsolete now, so it is >>>>>>>> not >>>>>>>> available from the QEMU command-line. Instead, I hardcode it to >>>>>>>> zero. >>>>>>>> >>>>>> Hi, Paolo >>>>>> Any document about how to config it correctly in configfs, before >>>>>> invoking qemu with the WWPN number? >>>>> >>>>> Unfortunately no, but vhost-scsi doesn't have many knobs (unlike >>>>> iSCSI for example) so it's quite simple. Here is an example: >>>>> >>>>> cd /sys/kernel/config/target >>>>> mkdir -p core/fileio_0/fileio >>>>> echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > >>>>> core/fileio_0/fileio/control >>>>> echo 1 > core/fileio_0/fileio/enable >>>>> mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 >>>>> cd vhost/naa.600140554cf3a18e/tpgt_0 >>>>> ln -sf ../../../../../core/fileio_0/fileio/ >>>>> lun/lun_0/virtual_scsi_port >>>>> echo naa.60014053226f0388 > nexus >>>>> >>>>> The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the >>>>> target WWN that you have to pass to "-device vhost-scsi-pci". >>>>> >>>>> Paolo >>>> >>>> For me, I always use targetcli utils instead of the sysfs interface. >>>> targetcli in F18 has vhost support now. >>>> >>> Thanks very much for above information, I'll try it for test. >>> >> I have done a basic test of vhost-scsi, following is the result I'd >> like to post, generally it seems fine: >> >> Result: >> fdisk/mkfs: fdisk can find it, mke2fs works fine. >> mount: can mount it. >> file I/O: dd 90M zero to a file in that disk succeed. > > > > I tried without nested kvm. > >> >> Issues: >> 1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error, >> dev fd0, sector 0", I guess it is caused by nested KVM that failed >> to kick host kernel? > > > I don't see this issue. Are you sure "fd0" is actually the scsi device ? > what is "fd0" ? > I am not sure, it just come out from dmesg when fdisk -l hung, and following line is "sdb" which is the vhost-scsi device, and fdisk printing stopped before "sdb" for a few seconds, so I think it's it. it happened once after my partition operation. My instinct opinion is it happens only in nested KVM when host missed a kick, since following I/O can succeed. Sadly I have no bare-metal at hand to test as a comparation.
>> 2) in fdisk -l, it shows 512 bytes larger than the parameter I >> specified in fd_dev_size parameter in configfs on host.(shows >> 104858112 bytes, see the invocation script below) >> > > I see the same. For some reason "fdisk -l" in the VM shows > 512-bytes more than the actual size for the file (on the host). > > Thanks, > Badari > -- Best Regards Wenchao Xia