aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps
diff options
context:
space:
mode:
authorvalentin boucher <valentin.boucher@orange.com>2017-09-05 07:44:05 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-05 07:44:05 +0000
commit82b5b5c13ed5b08ff7191d0d1dcddfc4bd99f0c7 (patch)
treec34e13a5c470745d69fccc0e3a8f4e126bfdda09 /functest/opnfv_tests/openstack/snaps
parentffa9b999bb57208bd744b65d62570313f1b2b9d1 (diff)
parent12ba273fdbe74493123ceb73ab6d179e36b27dff (diff)
Merge "Enable tempest multinode tests"
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps')
-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)