Re: [PATCH 2/3] virnetdev: Message in virNetDevSendEthtoolIoctl rather than caller.

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

 



On Tue, Nov 03, 2015 at 07:18:10PM -0500, John Ferlan wrote:
> Since virNetDevSetupControl can generate a virReportSystemError, rather
> than message in the caller for any errors. Do all the messaging in the
> virNetDevSendEthtoolIoctl.
> 
> This change partially reverts commit id '6f2a0198' by moving the error
> message in the virNetDev[G]FeatureAvailable to where the ioctl fails.
> However, the ioctl will report any error rather than filtering some.
> 

I think we should not pollute the logs for some error codes and just
VIR_DEBUG the error, even in privileged mode.

On the other hand, the proposed revert unnecessarily reintroduces
the use of AF_LOCAL, but that's because the orignal commit
does two things at once.

Jan

> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/util/virnetdev.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> index 12faf51..d47859e 100644
> --- a/src/util/virnetdev.c
> +++ b/src/util/virnetdev.c
> @@ -3157,7 +3157,8 @@ virNetDevSendEthtoolIoctl(const char *ifname, void *cmd)
>      if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
>          return ret;
>      ifr.ifr_data = cmd;
> -    ret = ioctl(fd, SIOCETHTOOL, &ifr);
> +    if ((ret = ioctl(fd, SIOCETHTOOL, &ifr)) < 0)
> +        virReportSystemError(errno, "%s", _("ethtool ioctl error"));
>  
>      VIR_FORCE_CLOSE(fd);
>      return ret;
> @@ -3176,12 +3177,13 @@ virNetDevSendEthtoolIoctl(const char *ifname, void *cmd)
>  static int
>  virNetDevFeatureAvailable(const char *ifname, struct ethtool_value *cmd)
>  {
> +    int ret = -1;
> +
>      cmd = (void*)cmd;
> -    if (virNetDevSendEthtoolIoctl(ifname, cmd) < 0) {
> -        virReportSystemError(errno, _("Cannot get device %s flags"), ifname);
> -        return -1;
> -    }
> -    return cmd->data > 0 ? 1 : 0;
> +    if (!virNetDevSendEthtoolIoctl(ifname, cmd))
> +        ret = cmd->data > 0 ? 1 : 0;
> +    return ret;
> +
>  }
>  
>  
> @@ -3198,12 +3200,12 @@ virNetDevFeatureAvailable(const char *ifname, struct ethtool_value *cmd)
>  static int
>  virNetDevGFeatureAvailable(const char *ifname, struct ethtool_gfeatures *cmd)
>  {
> +    int ret = -1;
> +
>      cmd = (void*)cmd;
> -    if (virNetDevSendEthtoolIoctl(ifname, cmd) < 0) {
> -        virReportSystemError(errno, _("Cannot get device %s generic features"), ifname);
> -        return -1;
> -    }
> -    return FEATURE_BIT_IS_SET(cmd->features, TX_UDP_TNL, active);
> +    if (!virNetDevSendEthtoolIoctl(ifname, cmd))
> +        ret = FEATURE_BIT_IS_SET(cmd->features, TX_UDP_TNL, active);
> +    return ret;
>  }
>  # endif
>  
> -- 
> 2.1.0
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
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]