OS-3135: landscape-sysinfo exceptions processing plugins; missing SIOCETHTOOL ioctl support

Details

Issue Type:Bug
Priority:4 - Normal
Status:Open
Created at:2014-06-25T15:42:42.000Z
Updated at:2019-08-28T17:28:48.703Z

People

Created by:Former user
Reported by:Former user

Labels

lxbrand

Description

There are a set of commands in /etc/update-motd.d which are run when a user logs in. The 50-landscape-sysinfo plugin is a symlink to /usr/share/landscape/landscape-sysinfo.wrapper. When this runs we get an indication that there are errors in /var/log/landscape/sysinfo.log. Looking at this log we see errors like this:

2014-06-25 09:35:09,725 ERROR    Network plugin raised an exception.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/landscape/sysinfo/sysinfo.py", line 99, in run
    result = plugin.run()
  File "/usr/lib/python2.7/dist-packages/landscape/sysinfo/network.py", line 32, in run
    for info in self._get_device_info():
  File "/usr/lib/python2.7/dist-packages/landscape/lib/network.py", line 161, in get_active_device_info
    speed, duplex = get_network_interface_speed(sock, interface)
  File "/usr/lib/python2.7/dist-packages/landscape/lib/network.py", line 242, in get_network_interface_speed
    raise e
IOError: [Errno 22] Invalid argument

Comments

Comment by Former user
Created at 2014-06-25T22:02:34.000Z
Updated at 2017-12-14T17:24:03.216Z

The python code for the above exception basically looks like this:

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_IP)
speed, duplex = get_network_interface_speed(sock, interface)

    speed = -1
    try:
        fcntl.ioctl(sock, SIOCETHTOOL, packed)  # Status ioctl() call
        res = status_cmd.tostring()
        speed, duplex = struct.unpack('12xHB28x', res)
    except IOError as e:
        if e.errno == errno.EPERM:
            logging.warn("Could not determine network interface speed, "
                         "operation not permitted.")
        elif e.errno != errno.EOPNOTSUPP:
            raise e
        speed = -1
        duplex = False

See this http://stackoverflow.com/questions/2872058/get-link-speed-programmatically and this http://www.linuxjournal.com/node/6908/print for more info about this ioctl.


Comment by Former user
Created at 2015-04-28T15:59:37.000Z

It would be easy to punt on this by returning EOPNOTSUPP for now.