From: Josh Durgin Date: Thu, 17 Mar 2016 01:20:07 +0000 (-0700) Subject: misc: add cluster filter to num_instances_of_type X-Git-Tag: 1.1.0~615^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4e20fe97e26a4e3cb0197122b3fbb5f6fa7ff565;p=teuthology.git misc: add cluster filter to num_instances_of_type Signed-off-by: Josh Durgin --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 9c9e33787..1d8275548 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -445,16 +445,17 @@ def is_type(type_, cluster=None): return _is_type -def num_instances_of_type(cluster, type_): +def num_instances_of_type(cluster, type_, ceph_cluster='ceph'): """ Total the number of instances of the role type specified in all remotes. :param cluster: Cluster extracted from ctx. :param type_: role + :param ceph_cluster: filter for ceph cluster name """ remotes_and_roles = cluster.remotes.items() roles = [roles for (remote, roles) in remotes_and_roles] - is_ceph_type = is_type(type_) + is_ceph_type = is_type(type_, ceph_cluster) num = sum(sum(1 for role in hostroles if is_ceph_type(role)) for hostroles in roles) return num