From 110071775344610bbb132a473949fba2fd09512d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 28 May 2014 17:30:10 -0400 Subject: [PATCH] be a little more clever about interface default the interface default of eth0 has become more wrong since we've got a generation of Linux distros that don't use eth* as their interface naming. Instead of that do a slightly more clever, but probably still wrong thing, of picking an interface that exists and is a physical interface. This is still overridable, however won't cause really cryptic failures in nova-compute because it's trying to use an interface that doesn't exist *really* late in the network creation. Change-Id: I93016ff5a25678de76254418155c839a269486a0 --- lib/nova | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/nova b/lib/nova index c51d584728..722eabb402 100644 --- a/lib/nova +++ b/lib/nova @@ -75,8 +75,13 @@ QEMU_CONF=/etc/libvirt/qemu.conf # Set default defaults here as some hypervisor drivers override these PUBLIC_INTERFACE_DEFAULT=br100 -GUEST_INTERFACE_DEFAULT=eth0 FLAT_NETWORK_BRIDGE_DEFAULT=br100 +# set the GUEST_INTERFACE_DEFAULT to some interface on the box so that +# the default isn't completely crazy. This will match eth*, em*, or +# the new p* interfaces, then basically picks the first +# alphabetically. It's probably wrong, however it's less wrong than +# always using 'eth0' which doesn't exist on new Linux distros at all. +GUEST_INTERFACE_DEFAULT=$(route -n | awk '{print $8}' | grep ^[ep] | sort | head -1) # Get hypervisor configuration # ----------------------------