Browse code

Use eth0 to determine host ip address

Anthony Young authored on 2011/11/08 04:18:28
Showing 1 changed files
... ...
@@ -169,9 +169,13 @@ LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
169 169
 # cases unless you are working on multi-zone mode.
170 170
 SCHEDULER=${SCHEDULER:-nova.scheduler.simple.SimpleScheduler}
171 171
 
172
-# Use the first IP unless an explicit is set by ``HOST_IP`` environment variable
172
+# Use the eth0 IP unless an explicit is set by ``HOST_IP`` environment variable
173 173
 if [ ! -n "$HOST_IP" ]; then
174
-    HOST_IP=`LC_ALL=C /sbin/ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
174
+    HOST_IP=`LC_ALL=C /sbin/ifconfig eth0 | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
175
+    if [ "$HOST_IP" = "" ];
176
+        echo "Could not determine host ip address.  Please specify HOST_IP in your localrc."
177
+        exit 1
178
+    fi
175 179
 fi
176 180
 
177 181
 # Service startup timeout