[libvirt] [PATCH v2 3/4] interface_backend_udev: Implement link speed & state

John Ferlan jferlan at redhat.com
Wed Jun 11 01:13:45 UTC 2014



On 06/05/2014 11:39 AM, Michal Privoznik wrote:
> In the previous commit the helper function was prepared, so now
> we can wire it up and benefit from it. The Makefile change is
> required because we're including virnedev,h which includes
> virnetlink.h which tries to include netlink/msg.h. However this
> file is not under /usr/include directly but is dependent on libnl
> used.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/Makefile.am                        | 2 +-
>  src/interface/interface_backend_udev.c | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 01af164..a6b8d0b 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1399,7 +1399,7 @@ endif ! WITH_DRIVER_MODULES
>  libvirt_driver_interface_la_CFLAGS = \
>  		-I$(top_srcdir)/src/access \
>  		-I$(top_srcdir)/src/conf \
> -		$(AM_CFLAGS)
> +		$(AM_CFLAGS) $(LIBNL_CFLAGS)
>  libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS)
>  libvirt_driver_interface_la_LIBADD =
>  if WITH_NETCF
> diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
> index c5353ea..f4de0e4 100644
> --- a/src/interface/interface_backend_udev.c
> +++ b/src/interface/interface_backend_udev.c
> @@ -34,6 +34,7 @@
>  #include "viralloc.h"
>  #include "virstring.h"
>  #include "viraccessapicheck.h"
> +#include "virnetdev.h"
>  
>  #define VIR_FROM_THIS VIR_FROM_INTERFACE
>  
> @@ -1059,6 +1060,10 @@ udevGetIfaceDef(struct udev *udev, const char *name)
>                     udev_device_get_sysattr_value(dev, "address")) < 0)
>          goto error;
>  
> +    if (virNetDevGetLinkInfo(ifacedef->name, &ifacedef->lnk.state,
> +                             &ifacedef->lnk.speed) < 0)
> +        goto error;
> +

NIT: Every other fetch has a comment :-)

ACK

John


>      /* MTU */
>      mtu_str = udev_device_get_sysattr_value(dev, "mtu");
>      if (virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
> 




More information about the libvir-list mailing list