I meant the RPC method config, not the HostAPI method...
The way I imagine it it should be a 'lnst/Controller/Machine:class Interface'
method, that constructs the 'config' rpc command and sends it through
a 'lnst/Controller/Machine:class Machine' object to the slave. The
InterfaceAPI class should just be an interface (as in design patterns)
to the Interface class methods.
I don't really see the use in HostAPI methods for {set, get}_mtu() but
you can keep them if you think they're useful. But they definitely
should be available from InterfaceAPI.
-Ondrej
On Sat, May 02, 2015 at 05:51:00AM -0400, Jiri Prochazka wrote:
I've sent a new implementation for set_mtu. It uses
implementation of config method to set up MTU.
The first idea for set_mtu method was it to be InterfaceAPI method, but because config is
HostAPI method and uses running custom command via rpc calls,
the implementation couldn't be done in a nice way, so I made it HostAPI method as
well.
The new implementation should be better, both methods use sysfs. The reason for not using
pyroute, is that config method uses sysfs and it's pointless
to make a new implementation for the pretty much same thing.
Next thing I want to discuss, if this patch set will be accepted, is integration into
ENRT/NS-Sanity tests via aliases.
--
Jiri Prochazka
LNST developer (
www.lnst-project.org)
Red Hat Czech s.r.o.
----- Original Message -----
From: "Ondrej Lichtner" <olichtne(a)redhat.com>
To: "Jiri Pirko" <jiri(a)resnulli.us>
Cc: "Jiri Prochazka" <jprochaz(a)redhat.com>,
lnst-developers(a)lists.fedorahosted.org
Sent: Friday, May 1, 2015 8:39:55 PM
Subject: Re: [PATCH] Add set_mtu and get_mtu API methods
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