diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-11 12:39:51 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-11 12:42:26 +0100 |
commit | 1a34e5d4ae77f064c598fe84b4c5c1237b1d763d (patch) | |
tree | aac2c28271067ecaf7d839669a206a488793da00 /yardstick/network_services/collector | |
parent | 438f7b5100e05ed668a0ea90674008a391eb5784 (diff) |
Do not request NFVi metrics from empty nodes
In Collector class [1], the information from the nodes is retrieved to
create a ResourceProfile object per node. If the node information is
empty, Collector should skip this node.
[1] https://github.com/opnfv/yardstick/blob/master/yardstick/network_services/collector/subscriber.py#L34
JIRA: YARDSTICK-1302
Change-Id: I84dff3e20881352263736b682a60a4f382960153
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/network_services/collector')
-rw-r--r-- | yardstick/network_services/collector/subscriber.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/yardstick/network_services/collector/subscriber.py b/yardstick/network_services/collector/subscriber.py index 937c266a6..0c6d97771 100644 --- a/yardstick/network_services/collector/subscriber.py +++ b/yardstick/network_services/collector/subscriber.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""This module implements stub for publishing results in yardstick format.""" + import logging from yardstick.network_services.nfvi.resource import ResourceProfile @@ -31,12 +31,13 @@ class Collector(object): self.bin_path = get_nsb_option('bin_path', '') self.resource_profiles = {} - for ctx_name, nodes in contexts_nodes.items(): - for node in (node for node in nodes if node.get('collectd')): + for ctx_name, nodes in ((ctx_name, nodes) for (ctx_name, nodes) + in contexts_nodes.items() if nodes): + for node in (node for node in nodes + if node and node.get('collectd')): name = ".".join([node['name'], ctx_name]) self.resource_profiles.update( - {name: ResourceProfile.make_from_node(node, timeout)} - ) + {name: ResourceProfile.make_from_node(node, timeout)}) def start(self): for resource in self.resource_profiles.values(): |