[libvirt] [PATCH] udev: should not list bridge devices

Laine Stump laine at laine.org
Tue May 21 14:09:33 UTC 2013


On 05/21/2013 09:28 AM, Guannan Ren wrote:
> When using udev backend, virsh iface-list outputs bridge devices
> like:
>  Name                 State      MAC Address
>  --------------------------------------------
>  em1                  active     e8:39:35:58:d5:94
>  lo                   active     00:00:00:00:00:00
>  virbr0               active     fe:54:00:a5:f6:42
>
> The patch filters out bridge devices.
>
> ---
>  src/interface/interface_backend_udev.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
> index 1fd7d46..92648e8 100644
> --- a/src/interface/interface_backend_udev.c
> +++ b/src/interface/interface_backend_udev.c
> @@ -78,6 +78,9 @@ udevGetDevices(struct udev *udev, virUdevStatus status)
>      /* Ignore devices that are part of a bridge */
>      udev_enumerate_add_nomatch_sysattr(enumerate, "brport/state", NULL);
>  
> +    /* Ignore bridge devices */
> +    udev_enumerate_add_nomatch_sysattr(enumerate, "bridge/bridge_id", NULL);
> +

NACK. It should list bridge devices. What shouldn't be listed is
*transient* interfaces (such as the bridge devices created by libvirt).

This is a problem inherent in the design of the udev driver. It's
examining the current state of the network system, while the original
intent of libvirt's interface driver was really to examine/modify the
persistent system config. I pointed this out to Doug at the time he
added the udev driver, and he acknowledged the problem but couldn't
think of a simple way to eliminate it, and it didn't seem serious enough
to delay adding in the driver.




More information about the libvir-list mailing list