]> xenbits.xensource.com Git - libvirt.git/commitdiff
interface: Fix udev backend bridge device display
authorDoug Goldstein <cardoe@cardoe.com>
Mon, 25 Feb 2013 02:31:03 +0000 (20:31 -0600)
committerDoug Goldstein <cardoe@cardoe.com>
Mon, 25 Feb 2013 16:06:29 +0000 (10:06 -0600)
The bridge device was showing the vnet devices created for the domains
as connected to the bridge. libvirt should only show host devices when
trying to get the interface definition rather than the domain devices as
well.

src/interface/interface_backend_udev.c

index bd83545ad3eaa49fc83687a1e6875ead38650fb3..dca85b3f54a623f94ad396d408b7d7e17acdeb04 100644 (file)
@@ -24,7 +24,9 @@
 #include <libudev.h>
 
 #include "virerror.h"
+#include "c-ctype.h"
 #include "datatypes.h"
+#include "domain_conf.h"
 #include "interface_driver.h"
 #include "interface_conf.h"
 #include "viralloc.h"
@@ -527,6 +529,16 @@ udevIfaceBridgeScanDirFilter(const struct dirent *entry)
     if (STREQ(entry->d_name, ".") || STREQ(entry->d_name, ".."))
         return 0;
 
+    /* Omit the domain interfaces from the list of bridge attached
+     * devices. All we can do is check for the device name matching
+     * vnet%d. Improvements to this check are welcome.
+     */
+    if (strlen(entry->d_name) >= 5) {
+        if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_PREFIX) &&
+            c_isdigit(entry->d_name[4]))
+            return 0;
+    }
+
     return 1;
 }