- Upstream patches from Jan
23726-x86-intel-flexmigration.patch 23706-fix-20892.patch 23723-x86-CMOS-lock.patch 23676-x86_64-image-map-bounds.patch 23724-x86-smpboot-x2apic.patch - hotplug.losetup.patch correct dev:inode detection, stat returns major:minor without leading zeros, while losetup -a includes trailing zeros - fate#310635: xen npiv multipath support update block-npiv* scripts for testing OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=133
This commit is contained in:
committed by
Git OBS Bridge
parent
873847f0da
commit
98d3290ab8
103
block-npiv
103
block-npiv
@@ -12,7 +12,10 @@ dir=$(dirname "$0")
|
||||
case "$command" in
|
||||
add)
|
||||
# Params is one big arg, with fields separated by hyphens:
|
||||
# FABRIC-VPWWPN-VPWWNN-TGTWWPN-LUN#
|
||||
# single path:
|
||||
# FABRIC-VPWWPN-VPWWNN-TGTWWPN-LUN#
|
||||
# multipath:
|
||||
# {FABRIC1,FABRIC2}-{VPWWPN1,VPWWPN2,VPWWPN3}-VPWWNN-TGTWWPN-LUN#
|
||||
# arg 2 - Fabric Name
|
||||
# arg 3 - VPORT's WWPN
|
||||
# arg 4 - VPORT's WWNN
|
||||
@@ -29,38 +32,56 @@ case "$command" in
|
||||
if test $TGTWWPN = $NPIVARGS ; then exit 1; fi
|
||||
VPORTWWNN=${NPIVARGS##*-*-}; NPIVARGS=${NPIVARGS%-*}
|
||||
if test $VPORTWWNN = $NPIVARGS ; then exit 1; fi
|
||||
VPORTWWPN=${NPIVARGS##*-}; NPIVARGS=${NPIVARGS%-*}
|
||||
if test $VPORTWWPN = $NPIVARGS ; then exit 1; fi
|
||||
FABRICNM=$NPIVARGS
|
||||
VPORTWWPNS=${NPIVARGS##*-}; NPIVARGS=${NPIVARGS%-*}
|
||||
if test $VPORTWWPNS = $NPIVARGS ; then exit 1; fi
|
||||
FABRICNMS=$NPIVARGS
|
||||
|
||||
# Ensure we compare everything using lower-case hex characters
|
||||
TGTWWPN=`echo $TGTWWPN | tr A-Z a-z`
|
||||
VPORTWWPN=`echo $VPORTWWPN | tr A-Z a-z`
|
||||
VPORTWWNN=`echo $VPORTWWNN | tr A-Z a-z`
|
||||
FABRICNM=`echo $FABRICNM | tr A-Z a-z`
|
||||
VPORTWWPNS=`echo $VPORTWWPNS | tr A-Z a-z |sed 's/[{,}]/ /g'`
|
||||
VPORTWWNN=`echo $VPORTWWNN | tr A-Z a-z`
|
||||
FABRICNMS=`echo $FABRICNMS | tr A-Z a-z |sed 's/[{,}]/ /g'`
|
||||
|
||||
|
||||
claim_lock "npiv"
|
||||
|
||||
find_vhost $VPORTWWPN
|
||||
if test -z "$vhost" ; then
|
||||
create_vport $FABRICNM $VPORTWWPN $VPORTWWNN
|
||||
if [ $? -ne 0 ] ; then exit 2; fi
|
||||
sleep 8
|
||||
find_vhost $VPORTWWPN
|
||||
if test -z "$vhost" ; then exit 3; fi
|
||||
fi
|
||||
find_sdev $vhost $TGTWWPN $LUN
|
||||
if test -z "$dev"; then
|
||||
echo "- - -" > /sys/class/scsi_host/$vhost/scan
|
||||
sleep 2
|
||||
find_sdev $vhost $TGTWWPN $LUN
|
||||
fi
|
||||
|
||||
paths=0
|
||||
for FABRICNM in $FABRICNMS; do
|
||||
for VPORTWWPN in $VPORTWWPNS; do
|
||||
find_vhost $VPORTWWPN $FABRICNM
|
||||
if test -z "$vhost" ; then
|
||||
create_vport $FABRICNM $VPORTWWPN $VPORTWWNN
|
||||
if [ $? -ne 0 ] ; then exit 2; fi
|
||||
sleep 8
|
||||
find_vhost $VPORTWWPN $FABRICNM
|
||||
if test -z "$vhost" ; then exit 3; fi
|
||||
fi
|
||||
find_sdev $vhost $TGTWWPN $LUN
|
||||
if test -z "$dev"; then
|
||||
echo "- - -" > /sys/class/scsi_host/$vhost/scan
|
||||
sleep 2
|
||||
find_sdev $vhost $TGTWWPN $LUN
|
||||
fi
|
||||
if test -z "$dev"; then
|
||||
exit 4
|
||||
fi
|
||||
paths=$(($paths+1))
|
||||
done
|
||||
done
|
||||
release_lock "npiv"
|
||||
|
||||
if test ! -z "$dev"; then
|
||||
xenstore-write $XENBUS_PATH/node /dev/$dev
|
||||
write_dev /dev/$dev
|
||||
if test $paths -gt 1; then
|
||||
xenstore-write $XENBUS_PATH/multipath 1
|
||||
/etc/init.d/multipathd start
|
||||
if test $? -ne 0 ; then exit 4; fi
|
||||
dm=`multipath -l /dev/$dev | grep dm | cut -f2 -d' '`
|
||||
else
|
||||
xenstore-write $XENBUS_PATH/multipath 0
|
||||
dm=$dev
|
||||
fi
|
||||
|
||||
if test ! -z "$dm"; then
|
||||
xenstore-write $XENBUS_PATH/node /dev/$dm
|
||||
write_dev /dev/$dm
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -69,14 +90,32 @@ case "$command" in
|
||||
|
||||
remove)
|
||||
node=`xenstore-read $XENBUS_PATH/node` || true
|
||||
#node=$2
|
||||
dev=$node; dev=${dev#/dev/}
|
||||
multipath=`xenstore-read $XENBUS_PATH/multipath` || true
|
||||
# this is really screwy. the first delete of a lun will
|
||||
# terminate the entire vport (all luns)
|
||||
find_vhost_from_dev $dev
|
||||
if test -z "$vhost" ; then exit 5; fi
|
||||
flush_nodes_on_vhost $vhost
|
||||
delete_vhost $vhost
|
||||
if test $multipath = 1; then
|
||||
par=`xenstore-read $XENBUS_PATH/params` || true
|
||||
NPIVARGS=$par;
|
||||
FABRICNMS=${NPIVARGS%%-*}; NPIVARGS=${NPIVARGS#*-}
|
||||
VPORTWWPNS=${NPIVARGS%%-*}
|
||||
VPORTWWPNS=`echo $VPORTWWPNS | tr A-Z a-z |sed 's/[{,}]/ /g'`
|
||||
FABRICNMS=`echo $FABRICNMS | tr A-Z a-z |sed 's/[{,}]/ /g'`
|
||||
for FABRICNM in $FABRICNMS; do
|
||||
for VPORTWWPN in $VPORTWWPNS; do
|
||||
find_vhost $VPORTWWPN $FABRICNM
|
||||
if test -z "$vhost" ; then exit 5; fi
|
||||
flush_nodes_on_vhost $vhost
|
||||
delete_vhost $vhost
|
||||
done
|
||||
done
|
||||
else
|
||||
dev=$node; dev=${dev#/dev/}
|
||||
find_vhost_from_dev $dev
|
||||
if test -z "$vhost" ; then exit 5; fi
|
||||
flush_nodes_on_vhost $vhost
|
||||
delete_vhost $vhost
|
||||
fi
|
||||
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user