From: Jiri Pirko jiri@mellanox.com
python task might need to get host object by interface object. I actually have usecase for this. So just add the method.
Signed-off-by: Jiri Pirko jiri@mellanox.com --- lnst/Controller/Task.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index 7f9dc8e..673048d 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -175,7 +175,7 @@ class HostAPI(object): for i in self._m.get_interfaces(): if i.get_id() is None: continue - self._interfaces[i.get_id()] = InterfaceAPI(i) + self._interfaces[i.get_id()] = InterfaceAPI(i, self)
self._bg_id_seq = 0
@@ -364,8 +364,9 @@ class HostAPI(object): self._m.sync_resources(sync_table)
class InterfaceAPI(object): - def __init__(self, interface): + def __init__(self, interface, host): self._if = interface + self._host = host
def get_id(self): return self._if.get_id() @@ -418,6 +419,9 @@ class InterfaceAPI(object): def set_link_down(self): return self._if.set_link_down()
+ def get_host(self): + return self._host + class ModuleAPI(object): """ An API class representing a module. """
On Fri, Dec 18, 2015 at 03:20:19PM +0100, Jiri Pirko wrote:
From: Jiri Pirko jiri@mellanox.com
python task might need to get host object by interface object. I actually have usecase for this. So just add the method.
Signed-off-by: Jiri Pirko jiri@mellanox.com
Acked-by: Ondrej Lichtner olichtne@redhat.com
lnst-developers@lists.fedorahosted.org