Github user svarnau commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1427#discussion_r168625988
--- 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 --
It seems unnecessary to duplicate entire function just to change whether
commands run locally or remotely. That can be done with a variable, so that we
don't have two copies of this code to maintain.
---