aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps/snaps_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps/snaps_utils.py')
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 309f9db1..956b104a 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -5,7 +5,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-from snaps.openstack.utils import neutron_utils
+from snaps.openstack.utils import neutron_utils, nova_utils
def get_ext_net_name(os_creds):
@@ -17,3 +17,14 @@ def get_ext_net_name(os_creds):
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
return ext_nets[0].name
+
+
+def get_active_compute_cnt(os_creds):
+ """
+ Returns the number of active compute servers
+ :param: os_creds: an instance of snaps OSCreds object
+ :return: the number of active compute servers
+ """
+ nova = nova_utils.nova_client(os_creds)
+ computes = nova_utils.get_availability_zone_hosts(nova, zone_name='nova')
+ return len(computes)