diff --git a/util/update-etc-hosts.sh b/util/update-etc-hosts.sh index 88db7a4..5f7a311 100644 --- a/util/update-etc-hosts.sh +++ b/util/update-etc-hosts.sh @@ -32,7 +32,7 @@ dir_path=$(dirname $0) node_type=`bash $(dirname $0)/detect-nodetype.sh` echo "Local host type is: $node_type" -local_ip_address=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` +local_ip_address=`ifconfig $1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` echo "Local host IP is: $local_ip_address" local_host_name=`hostname` @@ -41,25 +41,25 @@ sleep 3 if [ "$node_type" == "controller" ] || [ "$node_type" = "controller_networknode" ] then - if [ $# -eq 1 ] + if [ $# -eq 2 ] then echo "Adding controller node info to /etc/hosts" - change-ip-in-etc-hosts $1 $local_ip_address + change-ip-in-etc-hosts $2 $local_ip_address else - echo "Correct syntax: $0 " + echo "Correct syntax: $0 " exit 1; fi elif [ "$node_type" == "compute" ] || [ "$node_type" == "networknode" ] then - if [ $# -eq 2 ] + if [ $# -eq 3 ] then echo "Updating local node IP address to /etc/hosts" change-ip-in-etc-hosts $local_host_name $local_ip_address echo "Updating controller IP address to /etc/hosts" - change-ip-in-etc-hosts $1 $2 + change-ip-in-etc-hosts $2 $3 else - echo "Correct syntax: $0 " + echo "Correct syntax: $0 " exit 1; fi else diff --git a/util/update-ip.sh b/util/update-ip.sh index 86d27b0..3d79acd 100644 --- a/util/update-ip.sh +++ b/util/update-ip.sh @@ -4,35 +4,35 @@ node_type=`bash $(dirname $0)/detect-nodetype.sh` echo "Node Type detected as: $node_type" sleep 3 -if [ $# -lt 1 ] +if [ $# -lt 2 ] then - echo "Correct Syntax: $0 " + echo "Correct Syntax: $0 " echo "Second parameter required only for Network and Compute Node" exit 1; fi function update-nova-config-ip() { - mgmg_interface_ip=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` + mgmg_interface_ip=`ifconfig $1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` echo "Local Node IP: $mgmg_interface_ip" sleep 2 crudini --set /etc/nova/nova.conf DEFAULT my_ip $mgmg_interface_ip crudini --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address $mgmg_interface_ip - if [ "$1" == "controller" ] + if [ "$2" == "controller" ] then crudini --set /etc/nova/nova.conf DEFAULT vncserver_listen $mgmg_interface_ip sleep 2 service nova-novncproxy restart else - if [ -z "$2" ] + if [ -z "$3" ] then - echo "Correct syntax for Compute Node: $0 " + echo "Correct syntax for Compute Node: $0 compute " exit 1; else crudini --set /etc/nova/nova.conf DEFAULT vncserver_listen 0.0.0.0 - crudini --set /etc/nova/nova.conf DEFAULT novncproxy_base_url http://$2:6080/vnc_auto.html + crudini --set /etc/nova/nova.conf DEFAULT novncproxy_base_url http://$3:6080/vnc_auto.html sleep 2 service nova-compute restart fi @@ -43,22 +43,22 @@ function update-nova-config-ip() { case $node_type in controller) - bash $(dirname $0)/update-etc-hosts.sh $1 - update-nova-config-ip controller + bash $(dirname $0)/update-etc-hosts.sh $1 $2 + update-nova-config-ip $1 controller bash $(dirname $0)/manage-services.sh all restart ;; compute) - bash $(dirname $0)/update-etc-hosts.sh $1 $2 - update-nova-config-ip compute $2 + bash $(dirname $0)/update-etc-hosts.sh $1 $2 $3 + update-nova-config-ip $1 compute $3 bash $(dirname $0)/manage-services.sh all restart ;; networknode) - bash $(dirname $0)/update-etc-hosts.sh $1 $2 + bash $(dirname $0)/update-etc-hosts.sh $1 $2 $3 bash $(dirname $0)/manage-services.sh all restart ;; controller_networknode) - bash $(dirname $0)/update-etc-hosts.sh $1 - update-nova-config-ip controller + bash $(dirname $0)/update-etc-hosts.sh $1 $2 + update-nova-config-ip $1 controller bash $(dirname $0)/manage-services.sh all restart ;; *)