Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

[PATCH] RA: iSCSITarget: reintroduce "tid" resource parameter

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


florian.haas at linbit

Jul 8, 2009, 11:03 AM

Post #1 of 1 (286 views)
Permalink
[PATCH] RA: iSCSITarget: reintroduce "tid" resource parameter

# HG changeset patch
# User Florian Haas <florian.haas[at]linbit.com>
# Date 1247076171 -7200
# Node ID 475f05cf30edb2e6e63b5a0ac9932a8e7962c0d4
# Parent c366ac7a84e30b9de340d9f1145bd683af623111
RA: iSCSITarget: reintroduce "tid" resource parameter.

Much as I liked the idea of referring to targets just by target IQN,
using "dynamic" target IDs unfortunately breaks failover for tgt, at
least with some iSCSI initiators. The details are explained here:

http://lists.wpkg.org/pipermail/stgt/2009-July/003067.html

Consequently, I'm reintroducing the tid parameter for iSCSITarget. It
is required only on tgt, and optional on IET.

iSCSILogicalUnit is unchanged. It still figures out the correct tid
from the configured target_iqn.

I really hope this is my last resource parameter change, for the time
being. :(

Cheers,
Florian

diff -r c366ac7a84e3 -r 475f05cf30ed resources/OCF/iSCSITarget
--- a/resources/OCF/iSCSITarget Wed Jul 08 20:02:51 2009 +0200
+++ b/resources/OCF/iSCSITarget Wed Jul 08 20:02:51 2009 +0200
@@ -76,6 +76,14 @@
<content type="string" />
</parameter>

+<parameter name="tid" required="0" unique="1">
+<longdesc lang="en">
+The iSCSI target ID. Required for tgt.
+</longdesc>
+<shortdesc lang="en">iSCSI target ID</shortdesc>
+<content type="integer" />
+</parameter>
+
<parameter name="allowed_initiators" required="0" unique="0">
<longdesc lang="en">
Allowed initiators. A space-separated list of initiators allowed to
@@ -179,11 +187,15 @@
iet)
local lasttid
local tid
- # Figure out the last used target ID, add 1 to get the new
- # target ID.
- lasttid=`sed -ne "s/tid:\([[:digit:]]\+\) name:.*/\1/p" < /proc/net/iet/volume | sort -n | tail -n1`
- [ -z "${lasttid}" ] && lasttid=0
- tid=$((++lasttid))
+ if [ "${OCF_RESKEY_tid}" ]; then
+ tid="${OCF_RESKEY_tid}"
+ else
+ # Figure out the last used target ID, add 1 to get the new
+ # target ID.
+ lasttid=`sed -ne "s/tid:\([[:digit:]]\+\) name:.*/\1/p" < /proc/net/iet/volume | sort -n | tail -n1`
+ [ -z "${lasttid}" ] && lasttid=0
+ tid=$((++lasttid))
+ fi
# Create the target.
do_cmd ietadm --op new \
--tid=${tid} \
@@ -215,14 +227,8 @@
return $OCF_SUCCESS
;;
tgt)
- local lasttid
local tid
- # Figure out the last used target ID, add 1 to get the new
- # target ID.
- lasttid=`tgtadm --lld iscsi --op show --mode target \
- | sed -ne "s/^Target \([[:digit:]]\+\): .*/\1/p" | sort -n | tail -n1`
- [ -z "${lasttid}" ] && lasttid=0
- tid=$((++lasttid))
+ tid="${OCF_RESKEY_tid}"
# Create the target.
do_cmd tgtadm --lld iscsi --op new --mode target \
--tid=${tid} \
@@ -308,13 +314,7 @@
return $OCF_SUCCESS
;;
tgt)
- # Figure out the target ID
- tid=`tgtadm --lld iscsi --op show --mode target \
- | sed -ne "s/^Target \([[:digit:]]\+\): ${OCF_RESKEY_iqn}/\1/p"`
- if [ -z "$tid" ]; then
- ocf_log err "Failed to retrieve target ID for IQN ${OCF_RESKEY_iqn}"
- return $OCF_ERR_GENERIC
- fi
+ tid="${OCF_RESKEY_tid}"
# Close existing connections. There is no other way to
# do this in tgt than to parse the output of "tgtadm --op
# show".
@@ -372,7 +372,16 @@

iSCSITarget_validate() {
# Do we have all required variables?
- for var in implementation iqn; do
+ local required_vars
+ case $OCF_RESKEY_implementation in
+ iet)
+ required_vars="implementation iqn"
+ ;;
+ tgt)
+ required_vars="implementation iqn tid"
+ ;;
+ esac
+ for var in ${required_vars}; do
param="OCF_RESKEY_${var}"
if [ -z "${!param}" ]; then
ocf_log error "Missing resource parameter \"$var\"!"
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev[at]lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.