commit 8468135d308ddf3c8d6a6b5a7770aebab9580d89
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Feb 10 12:13:42 2014 +0100
NetUtils: add netlink msg to scan_netdevs return
The list returned by the scan_netdevs function will now also contain the
netlink message describing the device this will be used later when
creating the slave local device database.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/NetUtils.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/lnst/Common/NetUtils.py b/lnst/Common/NetUtils.py
index b649483..79d2de7 100644
--- a/lnst/Common/NetUtils.py
+++ b/lnst/Common/NetUtils.py
@@ -52,12 +52,13 @@ def scan_netdevs():
if part["header"]["type"] == RTM_NEWLINK:
new_link = {}
- for name, value in part["attrs"]:
- if name == "IFLA_IFNAME":
- new_link["name"] = value
- elif name == "IFLA_ADDRESS":
- new_link["hwaddr"] = normalize_hwaddr(value)
+ new_link["netlink_msg"] = part
new_link["index"] = part["index"]
+ new_link["name"] = part.get_attr("IFLA_IFNAME")
+
+ hwaddr = part.get_attr("IFLA_ADDRESS")
+ new_link["hwaddr"] = normalize_hwaddr(hwaddr)
+
scan.append(new_link)
nl_socket.close()
Show replies by date