Backport of patch to handle virtio interfaces correctly.
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 20 Apr 2010 02:28:16 +0000 (12:28 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 20 Apr 2010 02:28:16 +0000 (12:28 +1000)
(ethtool does not work on these)

config/events.d/10.interface

index 88ab2e9947a251e31af4f7fd459955883a792120..8cbe2225abdd0fdf1870742aa8b310e954c0807b 100755 (executable)
@@ -193,14 +193,15 @@ case "$1" in
                # we dont know how to test ib links
                ;;
            *)
-               [ -z "$IFACE" ] || {
-                   /usr/sbin/ethtool $IFACE | grep -q 'Link detected: yes' || {
+               [ -z "$IFACE" ] {
+                   [ "$(basename $(readlink /sys/class/net/$IFACE/device/driver))" = virtio_net ] ||
+                   ethtool $IFACE | grep -q 'Link detected: yes' || {
                        # On some systems, this is not successful when a
                        # cable is plugged but the interface has not been
                        # brought up previously. Bring the interface up and
                        # try again...
-                       /sbin/ip link set $IFACE up
-                       /usr/sbin/ethtool $IFACE | grep -q 'Link detected: yes' || {
+                       ip link set $IFACE up
+                       ethtool $IFACE | grep -q 'Link detected: yes' || {
                            echo "ERROR: No link on the public network interface $IFACE"
                            exit 1
                        }