diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-05-03 13:28:09 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-05-03 13:28:09 -0500 |
commit | cd8d7018844bca8c764b4122c0857de7b361cf65 (patch) | |
tree | 04ad22f0de06d69f42055b02d3ea30339b3ea3a5 | |
parent | 60f169e38cfa5313ed5d09762e6d221d5785d2bb (diff) | |
download | cxmanage-cd8d7018844bca8c764b4122c0857de7b361cf65.tar.gz |
Fabric: Fix get_link_stats to match Node.get_fabric_link_stats()
For commands that run across all nodes, we want the interface of
Fabric and Node to be very similar.
This means Fabric.get_link_stats now takes a "link" parameter as
well, instead of returning results for all links.
-rw-r--r-- | cxmanage_api/fabric.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 119f9c2..be93c0d 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -823,20 +823,21 @@ class Fabric(object): self.primary_node.bmc.fabric_config_set_uplink(uplink=uplink, iface=iface) - def get_link_stats(self): - """Get the link_stats for each link on each node in the fabric. + def get_link_stats(self, link=0, async=False): + """Get the link_stats for each node in the fabric. + + :param link: The link to get stats for (0-4). + :type link: integer + + :param async: Flag that determines if the command result (dictionary) + is returned or a Task object (can get status, etc.). + :type async: boolean :returns: The link_stats for each link on each node. :rtype: dictionary """ - link_stats = {} - for nn, node in self.nodes.items(): - link_stats[nn] = {} - for l in range(0, 5): - link_stats[nn][l] = node.get_fabric_link_stats(link=l) - - return link_stats + return self._run_on_all_nodes(async, "get_fabric_link_stats", link) def get_linkmap(self, async=False): """Get the linkmap for each node in the fabric. |