Skip to content

Commit fdb920c

Browse files
committed
a more proper default nic selection criteria
look at all interfaces that ip link shows as being up, then filter them for ^e or ^p devices. Should hold even after the bridges get built. Change-Id: If6b1e623f9d146c2430dc8a4a007997290b90846
1 parent 7b63c5e commit fdb920c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/nova

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ FLAT_NETWORK_BRIDGE_DEFAULT=br100
8181
# the new p* interfaces, then basically picks the first
8282
# alphabetically. It's probably wrong, however it's less wrong than
8383
# always using 'eth0' which doesn't exist on new Linux distros at all.
84-
GUEST_INTERFACE_DEFAULT=$(route -n | awk '{print $8}' | grep ^[ep] | sort | head -1)
84+
GUEST_INTERFACE_DEFAULT=$(ip link \
85+
| grep 'state UP' \
86+
| awk '{print $2}' \
87+
| sed 's/://' \
88+
| grep ^[ep] \
89+
| head -1)
8590

8691
# Get hypervisor configuration
8792
# ----------------------------

0 commit comments

Comments
 (0)