On Fri, May 01, 2015 at 09:30:22AM +0200, Jiri Pirko wrote:
Thu, Apr 30, 2015 at 04:39:51PM CEST, jprochaz(a)redhat.com wrote:
...
>+ def set_mtu(self, if_id, mtu):
>+ device = self._if_manager.get_mapped_device(if_id)
>+ dev_name = device.get_name()
>+ exec_cmd("ip link set dev %s mtu %s" % (dev_name, mtu))
>+ return True
>+
>+ def get_mtu(self, if_id):
>+ device = self._if_manager.get_mapped_device(if_id)
>+ dev_name = device.get_name()
>+ mtu, _ = exec_cmd("cat /sys/class/net/%s/mtu" % dev_name,
log_outputs=False)
you use netlink for set and sysfs for get? That's weird. Also, why not
to use pyroute2 for this?
There's also the 'config' type command that can be used for the 'set'
operation and will also ensure that when the Task finishes, mtu will be
reset to the original value.
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers