Skip to content

Commit 296234b

Browse files
Merge pull request #172 from cloudbuilders/eth0_ip
Use eth0 to determine host ip address
2 parents b7c3a5e + 857035d commit 296234b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

stack.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,16 @@ LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
172172
# cases unless you are working on multi-zone mode.
173173
SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler}
174174

175-
# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
175+
# Use the eth0 IP unless an explicit is set by ``HOST_IP`` environment variable
176176
if [ ! -n "$HOST_IP" ]; then
177-
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
177+
HOST_IP=`LC_ALL=C /sbin/ifconfig eth0 | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
178+
if [ "$HOST_IP" = "" ]; then
179+
echo "Could not determine host ip address."
180+
echo "If this is not your first run of stack.sh, it is "
181+
echo "possible that nova moved your eth0 ip address to the FLAT_NETWORK_BRIDGE."
182+
echo "Please specify your HOST_IP in your localrc."
183+
exit 1
184+
fi
178185
fi
179186

180187
# Service startup timeout

0 commit comments

Comments
 (0)