All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xen.org
Subject: Re: [PATCH v4 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework
Date: Mon, 20 Apr 2015 19:56:30 +0200	[thread overview]
Message-ID: <20150420175630.GA11431@aepfle.de> (raw)
In-Reply-To: <1429259460-30491-6-git-send-email-olaf@aepfle.de>

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

      reply	other threads:[~2015-04-20 17:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17  8:30 [PATCH v4 0/5] libbxl: add support for pvscsi, iteration 4 Olaf Hering
2015-04-17  8:30 ` [PATCH v4 1/5] vscsiif.h: fix WWN notation for p-dev property Olaf Hering
2015-04-21 13:55   ` Konrad Rzeszutek Wilk
2015-04-21 14:35     ` Olaf Hering
2015-04-21 15:31       ` Konrad Rzeszutek Wilk
2015-04-21 16:04         ` Olaf Hering
2015-04-17  8:30 ` [PATCH v4 2/5] docs: add vscsi to xenstore-paths.markdown Olaf Hering
2015-04-17  8:37   ` Olaf Hering
2015-04-17  8:30 ` [PATCH v4 3/5] libxl: add support for vscsi Olaf Hering
2015-04-21 14:05   ` Konrad Rzeszutek Wilk
2015-04-22  8:08     ` Olaf Hering
2015-04-23 13:10       ` Konrad Rzeszutek Wilk
2015-05-05  9:58       ` Wei Liu
2015-05-06  6:58         ` Olaf Hering
2015-05-06  7:40           ` Wei Liu
2015-05-05 13:55   ` Wei Liu
2015-05-06  8:06     ` Olaf Hering
2015-04-17  8:30 ` [PATCH v4 4/5] vscsiif.h: add some notes about xenstore layout Olaf Hering
2015-05-05 13:59   ` Wei Liu
2015-05-06  7:06     ` Olaf Hering
2015-04-17  8:31 ` [PATCH v4 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework Olaf Hering
2015-04-20 17:56   ` Olaf Hering [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150420175630.GA11431@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.