Add code to check number of available nodes for deployment
Change-Id: I58fbf17d3bb1c0661181aa03d7a0431cf976137f Related-Bug: 1547381
This commit is contained in:
parent
dffdd03857
commit
19502443f1
@ -47,6 +47,33 @@ from fuelweb_test.settings import PUBLIC_TEST_IP
|
||||
ssh_manager = SSHManager()
|
||||
|
||||
|
||||
@logwrap
|
||||
def validate_amount_nodes(
|
||||
nodes, expected_amount,
|
||||
state='discover', online=True):
|
||||
"""Validate amount of nodes in state
|
||||
|
||||
:type nodes: iterable
|
||||
:type expected_amount: int
|
||||
:type state: str
|
||||
:type online: bool
|
||||
:raises: Exception
|
||||
"""
|
||||
fnodes = [
|
||||
node for node in nodes
|
||||
if node['online'] == online and node['status'] == state]
|
||||
if len(fnodes) != expected_amount:
|
||||
raise Exception(
|
||||
'Nodes in state {state} (online: {online}): '
|
||||
'{amount}, while expected: {expected}'.format(
|
||||
state=state,
|
||||
online=online,
|
||||
amount=len(fnodes),
|
||||
expected=expected_amount
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@logwrap
|
||||
def check_cinder_status(ip):
|
||||
"""Parse output and return False if any enabled service is down.
|
||||
|
@ -30,6 +30,7 @@ from core.models.collector_client import CollectorClient
|
||||
from core.helpers.log_helpers import logwrap
|
||||
from core.helpers.log_helpers import QuietLogger
|
||||
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.decorators import revert_info
|
||||
from fuelweb_test.helpers.decorators import update_rpm_packages
|
||||
from fuelweb_test.helpers.decorators import upload_manifests
|
||||
@ -124,6 +125,12 @@ class EnvironmentModel(six.with_metaclass(SingletonMeta, object)):
|
||||
|
||||
if not skip_timesync:
|
||||
self.sync_time()
|
||||
|
||||
checkers.validate_amount_nodes(
|
||||
nodes=self.fuel_web.client.list_nodes(),
|
||||
expected_amount=len(devops_nodes)
|
||||
)
|
||||
|
||||
return self.nailgun_nodes(devops_nodes)
|
||||
|
||||
def sync_time(self, nodes_names=None, skip_sync=False):
|
||||
|
Loading…
Reference in New Issue
Block a user