Re: [PATCH] interface: Fix udev backend bridge device display

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/24/2013 09:36 PM, Doug Goldstein wrote:
> 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.
> ---
> Honestly this method sucks. But it makes the code path work and doesn't
> result in brokenness. I was really thinking of sscanf() but I don't really
> care to store the values. Suggestions?

This is of course still inexact, since 1) it is possible/acceptable for
someone to name their tap devices something else, and 2) other pieces of
software may also be creating transient devices that could be connected
to a bridge. In the end, this is just one of the symptoms of using
"current live status" to make an approximation of what is really
supposed to be "persistent configuration". I've always been a bit
lukewarm on the idea (as you know :-).

I don't really have any better idea for this (other than directly
reading the configuration off of disk, in which case you should be
writing a netcf backend rather than a libvirt interface driver backend),
and this apparently makes the situation better than it was before, so
ACK to this patch.

> ---
>  src/interface/interface_backend_udev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
> index bd83545..dca85b3 100644
> --- a/src/interface/interface_backend_udev.c
> +++ b/src/interface/interface_backend_udev.c
> @@ -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;
>  }
>  

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]