Github user mashengchen commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1427#discussion_r172462100
--- Diff: dcs/bin/scripts/dcsunbind.sh ---
@@ -51,6 +51,31 @@ function check_node {
done
}
+function check_self_node {
+ for myinterface in `/sbin/ip link show|cut -d: -f1- | cut -c1- | awk
-F': ' '/^[0-9]+:.*/ {print $2;}'`; do
+ ip_output=$(/sbin/ip addr show $myinterface | cut -d: -f1- | cut
-c1-)
+
+ myifport=`echo "$ip_output" | grep -w $gv_float_external_ip`
+ status=$?
+ if [ $status -eq 0 ]; then
+ tempinterface=`echo $gv_float_interface:$gv_port`
+ # check if another interface is bound to this virtual ip
address
+ echo "$myifport" | grep "$tempinterface" > /dev/null
+ if [ $? -eq 0 ]; then
+ unbindip=`echo "$myifport" | awk '{print $2}'`
+ unbindlb=`echo "$myifport"|awk '{print $NF}'`
+ echo "Virtual ip $gv_float_external_ip is in use on node
$HOSTNAME bound to interface $myinterface($unbindlb) - unbinding..."
+ sudo /sbin/ip addr del $unbindip dev $myinterface
+ status=$?
--- End diff --
this function is a little different from the one using PDSH, the ouput of
`$SQ_PDSH $MY_NODES /sbin/ip addr show` is different from `/sbin/ip link show`
, so the cut step after the " | " (pipe) is different.
---