From 7c259cea84b474b76b811f63a4f5274214d96fb8 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 13:18:28 -0600 Subject: [PATCH 1/3] Use eth0 to determine host ip address --- stack.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stack.sh b/stack.sh index 841cbb4..dea7501 100755 --- a/stack.sh +++ b/stack.sh @@ -169,9 +169,13 @@ LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm} # cases unless you are working on multi-zone mode. SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler} -# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable +# Use the eth0 IP unless an explicit is set by ``HOST_IP`` environment variable if [ ! -n "$HOST_IP" ]; then - HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` + HOST_IP=`LC_ALL=C /sbin/ifconfig eth0 | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` + if [ "$HOST_IP" = "" ]; + echo "Could not determine host ip address. Please specify HOST_IP in your localrc." + exit 1 + fi fi # Service startup timeout From a3475e53c1eba531e8ff718c33788abfb7c58b77 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 13:24:00 -0600 Subject: [PATCH 2/3] fix typo --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index dea7501..9bebe84 100755 --- a/stack.sh +++ b/stack.sh @@ -172,7 +172,7 @@ SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler} # Use the eth0 IP unless an explicit is set by ``HOST_IP`` environment variable if [ ! -n "$HOST_IP" ]; then HOST_IP=`LC_ALL=C /sbin/ifconfig eth0 | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` - if [ "$HOST_IP" = "" ]; + if [ "$HOST_IP" = "" ]; then echo "Could not determine host ip address. Please specify HOST_IP in your localrc." exit 1 fi From 857035dc6728383579528aa1b203717279d75eaf Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 14:02:13 -0600 Subject: [PATCH 3/3] improve comment --- stack.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index 9bebe84..8d1ec8a 100755 --- a/stack.sh +++ b/stack.sh @@ -173,7 +173,10 @@ SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler} if [ ! -n "$HOST_IP" ]; then HOST_IP=`LC_ALL=C /sbin/ifconfig eth0 | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` if [ "$HOST_IP" = "" ]; then - echo "Could not determine host ip address. Please specify HOST_IP in your localrc." + echo "Could not determine host ip address." + echo "If this is not your first run of stack.sh, it is " + echo "possible that nova moved your eth0 ip address to the FLAT_NETWORK_BRIDGE." + echo "Please specify your HOST_IP in your localrc." exit 1 fi fi