4b4fa7f68d
21317-xend-blkif-util-tap2.patch suse-disable-tap2-default.patch - Match upstreams cpu pools switch from domctl to sysctl - Upstream replacements for two of our custom patches (to ease applying further backports) - Fixed dump-exec-state.patch (could previously hang the system, as could - with lower probability - the un-patched implementation) - bnc#593536 - xen hypervisor takes very long to initialize Dom0 on 128 CPUs and 256Gb 21272-x86-dom0-alloc-performance.patch 21266-vmx-disabled-check.patch 21271-x86-cache-flush-global.patch - bnc#558815 - using multiple npiv luns with same wwpn/wwnn broken - bnc#601104 - Xen /etc/xen/scripts/block-npiv script fails when accessing multiple disks using NPIV block-npiv - bnc#595124 - VT-d can not be enabled on 32PAE Xen on Nehalem-EX platform 21234-x86-bad-srat-clear-pxm2node.patch bnc#585371 - kdump fails to load with xen: locate_hole failed 21235-crashkernel-advanced.patch - bnc#588918 - Attaching a U-disk to domain's failed by "xm usb-attach" init.xend OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=44
83 lines
2.3 KiB
Bash
83 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
# Usage: block-npiv [add npiv | remove dev]
|
|
|
|
dir=$(dirname "$0")
|
|
. "$dir/block-npiv-common.sh"
|
|
. "$dir/block-common.sh"
|
|
|
|
#set -x
|
|
#command=$1
|
|
|
|
case "$command" in
|
|
add)
|
|
# Params is one big arg, with fields separated by hyphens:
|
|
# FABRIC-VPWWPN-VPWWNN-TGTWWPN-LUN#
|
|
# arg 2 - Fabric Name
|
|
# arg 3 - VPORT's WWPN
|
|
# arg 4 - VPORT's WWNN
|
|
# arg 5 - Target's WWPN
|
|
# arg 6 - LUN # on Target
|
|
# no wwn contains a leading 0x - it is a 16 character hex value
|
|
# You may want to optionally pick a specific adapter ?
|
|
par=`xenstore-read $XENBUS_PATH/params` || true
|
|
#par=$2
|
|
NPIVARGS=$par;
|
|
LUN=${NPIVARGS##*-*-*-*-}; NPIVARGS=${NPIVARGS%-*}
|
|
if test $LUN = $NPIVARGS ; then exit 1; fi
|
|
TGTWWPN=${NPIVARGS##*-*-*-}; NPIVARGS=${NPIVARGS%-*}
|
|
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
|
|
|
|
# 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`
|
|
|
|
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
|
|
|
|
release_lock "npiv"
|
|
|
|
if test ! -z "$dev"; then
|
|
xenstore-write $XENBUS_PATH/node /dev/$dev
|
|
write_dev /dev/$dev
|
|
exit 0
|
|
fi
|
|
|
|
exit 4
|
|
;;
|
|
|
|
remove)
|
|
node=`xenstore-read $XENBUS_PATH/node` || true
|
|
#node=$2
|
|
dev=$node; dev=${dev#/dev/}
|
|
# 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
|
|
exit 0
|
|
;;
|
|
esac
|