Isilon: Remove or Add a Node from/to Multiple Network Pools

It’s a pain to change networks in bulk in an Isilon cluster, particularly if it’s a complex environment. Adding a new node that will be serving multiple network pools in the same subnet is particularly time consuming. Similarly, tracking down all the interfaces and pools a node is in in order to remove it for maintenance or other purposes can be messy.

This script takes the node’s number as the first input and add or remove as the second. It checks if the interface is active before performing any operations on it.

 
#!/bin/bash
node=$1
operation=$2

#check if node number is valid
if [ "$(isi_nodes -n$node %{name})" != "clustername-$node" ]; then
 echo "Not a valid node"
 exit
fi

#check if operation is either add or remove
if [ "$operation" != add -a "$operation" != remove ]; then
 echo "Not a valid operation: $operation"
 exit
fi


#function to check if the interface's connection is active. 
check_ifaces_active(){
 isi_for_array -n$node "ifconfig $iface" | awk '/active/ {print 1}'
}

#function to perform the operation on the interface for a set of pools
operate_interfaces() {
 echo $isi_iface
 isi networks modify pool --$operation-ifaces=$node:$isi_iface subnet2:pool4-synciq
 sleep 5
 isi networks modify pool --$operation-ifaces=$node:$isi_iface subnet2:pool0
 sleep 5
 isi networks modify pool --$operation-ifaces=$node:$isi_iface subnet2:pool2
 sleep 5
}

check both 10GbE interfaces
for iface in bxe0 bxe1; do
 if [ "$(check_ifaces_active)" = "1" ]; then
  if [ $iface = bxe0 ]; then
   isi_iface=10gige-1 #Isilon uses different interface naming schemes for different things...
  elif [ $iface = bxe1 ]; then
   isi_iface=10gige-2
  else
   print "Something went wrong"
   exit
  fi
  operate_interfaces
  isi_for_array -n$node "ifconfig $iface"
 fi
done
Advertisements