ADD the ability to manually assign IP addresses to the brick heads when not using...
authorAndy Witter <awitter@georgialibraries.org>
Tue, 25 Feb 2014 08:56:58 +0000 (03:56 -0500)
committerAndy Witter <awitter@georgialibraries.org>
Tue, 25 Feb 2014 08:56:58 +0000 (03:56 -0500)
GenaSYS.sh [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index b57a00a..e55e5cb
@@ -26,7 +26,7 @@
    SYNOPSIS_="$NAME_"
    REQUIRES_="standard GNU commands, apt, dpkg"
     VERSION_="1.31"
-       DATE_="2010-09-23; last update: 2014-02-19"
+       DATE_="2010-09-23; last update: 2014-02-24"
      AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
         URL_="http://evergreen-ils.org"
    CATEGORY_="devel"
@@ -462,6 +462,35 @@ while true; do
 done
 }
 
+Ask_Use_Manual_Brick_Addresses () { ### Prompt to use manually assigned address for bricks
+echo;echo
+TitleBar "Brick IP Addresses"
+while true; do
+       echo
+       echo -e "By default GenaSYS will generate the IP addresses for the bricks in this cluster."
+       echo "If you choose [n] here you will be prompted to enter the IP address for each brick in the cluster."
+       echo "   **Note that seperate drone servers are not supported if you enter IPs for the bricks manually."
+       echo -e "Do you want GenaSYS to generate the IP addresses for the bricks?"
+       echo -en $COL_BR_CYAN
+       read -n 1 -p "[y/n] :" MANUAL_BRICKS
+       echo -e $COL_RESET
+
+       case $MANUAL_BRICKS in
+               [Yy]* ) echo ; break;;
+                [Nn]* ) echo ; break;;
+                * ) echo " Please answer yes or no.";;
+        esac
+done
+}
+
+Get_Brick_IP_Addresses () { ### Get IP addresses for the bricks.
+for BRICK in $(seq $BRICKCOUNT)
+do
+        read -p "Enter the IP for brick0${BRICK}-head: " MANUAL_BRICK_IP_0${BRICK}
+       eval echo "Using IP address \$MANUAL_BRICK_IP_0${BRICK} for brick0${BRICK}-head."
+       echo
+done
+}
 
 EG_Reporter () { ### Prompt for host that shares reporter output over NFS
 echo;echo;echo;echo
@@ -1060,7 +1089,7 @@ then
                fi
        else
                echo
-               echo "The cluster will be configured without separate drones"
+               echo -e "The cluster will be configured" ${COL_BR_CYAN}without${COL_RESET} "separate drones"
                DRONELESS="1"
         fi
 
@@ -1075,6 +1104,20 @@ then
 fi
 Write_Config_File BRICKCOUNT
 
+if [ "$DRONELESS" = "1" ]
+then
+       if [ -z $MANUAL_BRICKS ] || [ "$USE_CONFIG_FILE" == "0" ]
+       then
+               Ask_Use_Manual_Brick_Addresses
+       fi
+fi
+Write_Config_File MANUAL_BRICKS
+
+if [ "$MANUAL_BRICKS" = "n" ] || [ "$USE_CONFIG_FILE" == "0" ]
+then
+       Get_Brick_IP_Addresses
+fi
+
 if [ -z $CHOSEN_REPORTS_NFS_HOSTNAME ] || [ "$USE_CONFIG_FILE" == "0" ] 
 then
        EG_Reporter
@@ -1680,7 +1723,12 @@ for BRICK in $(seq $BRICKCOUNT)
         echo "Brick${BRICK} hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK})" >> "$NETCFGFILE"
         typeset BRICKHOSTNAME${BRICK}_HEAD="$(eval echo \$BRICKHOSTNAME${BRICK}-head)"
         echo "Brick${BRICK} Head hostname set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD)" >> "$NETCFGFILE"
-        typeset BRICKHOSTNAME${BRICK}_HEAD_IP="$PRIVATENET.${BRICK}0"
+       if [ "$MANUAL_BRICKS" = "n" ]
+       then
+               typeset BRICKHOSTNAME${BRICK}_HEAD_IP=$(eval echo "\$MANUAL_BRICK_IP_0${BRICK}")
+       else
+               typeset BRICKHOSTNAME${BRICK}_HEAD_IP="$PRIVATENET.${BRICK}0"
+       fi
         echo "Brick${BRICK} Head IP Address set to: $(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)" >> "$NETCFGFILE"
        [ "${BRICK}" = "1" ] && BRICK01_HEAD_IP="$(eval echo \$BRICKHOSTNAME${BRICK}_HEAD_IP)"
         eval echo -e "\\\treal=\$BRICKHOSTNAME${BRICK}_HEAD_IP:80 masq" >> "$LVSCONFIGFILE"