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
| ... | ... |
@@ -75,8 +75,18 @@ QEMU_CONF=/etc/libvirt/qemu.conf |
| 75 | 75 |
|
| 76 | 76 |
# Set default defaults here as some hypervisor drivers override these |
| 77 | 77 |
PUBLIC_INTERFACE_DEFAULT=br100 |
| 78 |
-GUEST_INTERFACE_DEFAULT=eth0 |
|
| 79 | 78 |
FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
| 79 |
+# set the GUEST_INTERFACE_DEFAULT to some interface on the box so that |
|
| 80 |
+# the default isn't completely crazy. This will match eth*, em*, or |
|
| 81 |
+# the new p* interfaces, then basically picks the first |
|
| 82 |
+# alphabetically. It's probably wrong, however it's less wrong than |
|
| 83 |
+# always using 'eth0' which doesn't exist on new Linux distros at all. |
|
| 84 |
+GUEST_INTERFACE_DEFAULT=$(ip link \ |
|
| 85 |
+ | grep 'state UP' \ |
|
| 86 |
+ | awk '{print $2}' \
|
|
| 87 |
+ | sed 's/://' \ |
|
| 88 |
+ | grep ^[ep] \ |
|
| 89 |
+ | head -1) |
|
| 80 | 90 |
|
| 81 | 91 |
# Get hypervisor configuration |
| 82 | 92 |
# ---------------------------- |