From 7c259cea84b474b76b811f63a4f5274214d96fb8 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 13:18:28 -0600 Subject: [PATCH] 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