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

Re: [Xen-devel] [PATCH v4 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Mon, 20 Apr 2015 19:56:30 +0200
  • Delivery-date: Mon, 20 Apr 2015 17:56:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On Fri, Apr 17, Olaf Hering wrote:

> Just to make them public, not meant for merging:
> The scripts used during development to create a bunch of SCSI devices in
> dom0 using the Linux target framework. targetcli3 and rtslib3 is used.
> 
> A patch is required for python-rtslib:
> http://article.gmane.org/gmane.linux.scsi.target.devel/8146

Because libvirt understands just h:c:t:l it is required to configure
also an alias with the appropriate numbers. Otherwise xen-scsiback will
not find its "p-dev".


diff --git a/tools/misc/target-create-xen-scsiback.sh 
b/tools/misc/target-create-xen-scsiback.sh
index fc49c2e..e168a3e 100644
--- a/tools/misc/target-create-xen-scsiback.sh
+++ b/tools/misc/target-create-xen-scsiback.sh
@@ -65,6 +65,19 @@ do
                by_id="`echo ${vpd_uuid} | sed 
's@-@@g;s@^\(.\{25\}\)\(.*\)@scsi-36001405\1@'`"
                ln -sfvbn "/dev/disk/by-id/${by_id}" "${f_link}"
 
+               f_major=$((`stat --dereference --format=0x%t "${f_link}"`))
+               f_minor=$((`stat --dereference --format=0x%T "${f_link}"`))
+               if test -z "${f_major}" || test -z "${f_minor}"
+               then
+                       exit 1
+               fi
+               f_alias=`ls -d 
/sys/dev/block/${f_major}:${f_minor}/device/scsi_device/*:*:*:*`
+               if test -z "${f_alias}"
+               then
+                       exit 1
+               fi
+               f_alias=${f_alias##*/}
+
                blockdev --rereadpt "${f_link}"
                udevadm settle --timeout=4
                echo 1,12,S | sfdisk "${f_link}"
@@ -87,6 +100,7 @@ do
 
                targetcli /backstores/pscsi create "dev=${f_link}" 
"${pscsi_name}"
                targetcli /xen-pvscsi/${pvscsi_wwn}/tpg1/luns create 
"/backstores/pscsi/${pscsi_name}" $lun
+               targetcli /xen-pvscsi/${pvscsi_wwn}/tpg1  set parameter 
alias=${f_alias%:*}
 
                lun=$(( $lun + 1 ))
        done

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.