From: Stefan Hajnoczi Subject: Re: [PATCH] kvm tools: Add initial virtio-scsi support Date: Tue, 14 Aug 2012 07:45:22 +0100 Message-ID: <20120814064522.GA8702@stefanha-thinkpad.localdomain> References: <1344473464-17267-1-git-send-email-asias.hejun@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Pekka Enberg , Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org, "Nicholas A. Bellinger" , Paolo Bonzini To: Asias He Return-path: Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:37599 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754895Ab2HNIuH (ORCPT ); Tue, 14 Aug 2012 04:50:07 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Aug 2012 09:50:05 +0100 Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7E8nvNx23199888 for ; Tue, 14 Aug 2012 08:49:57 GMT Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7E8o2GB001053 for ; Tue, 14 Aug 2012 02:50:03 -0600 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 14, 2012 at 09:52:55AM +0800, Asias He wrote: > On Mon, Aug 13, 2012 at 3:24 PM, Pekka Enberg wrote: > > On Thu, Aug 9, 2012 at 3:51 AM, Asias He wrote: > >> This patch brings virito-scsi support to kvm tool. > >> > >> With the introduce of tcm_vhost (vhost-scsi) > >> > >> tcm_vhost: Initial merge for vhost level target fabric driver > >> > >> we can implement virito-scsi by simply having vhost-scsi to handle the > >> SCSI command. > >> > >> Howto use: > >> 1) Setup the tcm_vhost target through /sys/kernel/config > >> > >> [Stefan Hajnoczi, Thanks for the script to setup tcm_vhost] > >> > >> ** Setup wwpn and tpgt > >> $ wwpn="naa.0" > >> $ tpgt=/sys/kernel/config/target/vhost/$wwpn/tpgt_0 > >> $ nexus=$tpgt/nexus > >> $ mkdir -p $tpgt > >> $ echo -n $wwpn > $nexus > >> > >> ** Setup lun using /dev/ram > >> $ n=0 > >> $ lun=$tpgt/lun/lun_${n} > >> $ data=/sys/kernel/config/target/core/iblock_0/data_${n} > >> $ ram=/dev/ram${n} > >> $ mkdir -p $lun > >> $ mkdir -p $data > >> $ echo -n udev_path=${ram} > $data/control > >> $ echo -n 1 > $data/enable > >> $ ln -s $data $lun > >> > >> 2) Run kvm tool with the new disk option '-d scsi:$wwpn:$tpgt', e.g > >> $ lkvm run -k /boot/bzImage -d ~/img/sid.img -d scsi:naa.0:0 > >> > >> Signed-off-by: Asias He > >> Cc: Nicholas A. Bellinger > >> Cc: Stefan Hajnoczi > >> Cc: Paolo Bonzini > > > > I've included some comments below but overall, looks good to me. Sasha? > > > >> --- > >> diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h > >> index 7ae17f8..54e4047 100644 > >> --- a/tools/kvm/include/kvm/disk-image.h > >> +++ b/tools/kvm/include/kvm/disk-image.h > >> @@ -41,6 +41,8 @@ struct disk_image_operations { > >> > >> struct disk_image_params { > >> const char *filename; > >> + const char *wwpn; > >> + const char *tpgt; > > > > Maybe it's just me but "wwpn" and "tpgt" really could use a comment > > explaining what they are... > > OK. They are terminology from linux target. > > wwpn == world wide port number > tpgt == target port group tag Target Portal Group Tag TPGT is iSCSI-specific terminology but other transports like SAS or FCP have similar concepts of naming target ports. I think this terminology is used by the LIO target regardless of the fabric. The SCSI Architecture Model standard says the target port name is the "name (see 3.1.70) of a SCSI target port that is world wide unique within the SCSI transport protocol of the SCSI domain of that SCSI target port".