How to use the ethtool.get_ringparam function in ethtool

To help you get started, we’ve selected a few ethtool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uyuni-project / uyuni / client / debian / packages-already-in-debian / python-ethtool / pethtool.py View on Github external
def set_ringparam(interface, args):
        try:
                ring = ethtool.get_ringparam(interface)
        except IOError:
                printtab("ring parameters NOT supported on %s!" % interface)
                return

        changed = False
        args = [a.lower() for a in args]
        for arg, value in [ ( args[i], args[i + 1] ) for i in range(0, len(args), 2) ]:
                if not ethtool_ringparam_map.has_key(arg):
                        continue
                try:
                        value = int(value)
                except:
                        continue
                real_arg = ethtool_ringparam_map[arg]
                if ring[real_arg] != value:
                        ring[real_arg] = value
github uyuni-project / uyuni / client / debian / packages-already-in-debian / python-ethtool / pethtool.py View on Github external
def show_ring(interface, args = None):
        printtab("Ring parameters for %s:" % interface)
        try:
                ring = ethtool.get_ringparam(interface)
        except IOError:
                printtab("  NOT supported!")
                return

        printed = []
        for tunable in ethtool_ringparam_msgs:
                if len(tunable) == 1:
                        printtab("%s:" % tunable[0])
                else:
                        printtab("%s %s" % (tunable[0], ring[tunable[1]]))
                        printed.append(tunable[1])

        ringkeys = ring.keys()
        if len(ringkeys) != len(printed):
                print
                for tunable in ringkeys: