Add possibility to set number of sequiential deploys

New task-based deployment and testing strategy for fuel-library LCM readiness
requires tests for several layers. In the most common case it is just rerun deploy
for ready cluster without any changes. Second deploy should not break anything.

New environment variable DEPLOYMENT_RETRIES will allow us to rerun system test
in a several-in-a-row-deploy way and be sure that additional deploys don't break
that test.

Implements: blueprint fuel-qa-deploy-retries

Change-Id: I2b7b6933f9a331fa9f2c16f3893d4aa39d094355
This commit is contained in:
Dmitry Kalashnik 2016-02-19 16:15:26 +03:00
parent 1d5eec0bbc
commit eab863675d
2 changed files with 28 additions and 19 deletions

View File

@ -735,25 +735,7 @@ class FuelWebClient(object):
attributes = self.client.get_cluster_attributes(cluster_id)
return attributes['editable']['repo_setup']['repos']
@download_packages_json
@download_astute_yaml
@duration
@check_repos_management
@custom_repo
def deploy_cluster_wait(self, cluster_id, is_feature=False,
timeout=help_data.DEPLOYMENT_TIMEOUT, interval=30,
check_services=True):
if not is_feature:
logger.info('Deploy cluster %s', cluster_id)
task = self.deploy_cluster(cluster_id)
self.assert_task_success(task, interval=interval, timeout=timeout)
else:
logger.info('Provision nodes of a cluster %s', cluster_id)
task = self.client.provision_nodes(cluster_id)
self.assert_task_success(task, timeout=timeout, interval=interval)
logger.info('Deploy nodes of a cluster %s', cluster_id)
task = self.client.deploy_nodes(cluster_id)
self.assert_task_success(task, timeout=timeout, interval=interval)
def check_deploy_state(self, cluster_id, check_services=True):
if check_services:
self.assert_ha_services_ready(cluster_id)
self.assert_os_services_ready(cluster_id)
@ -789,6 +771,32 @@ class FuelWebClient(object):
logger.info('Node status: {}'.format(pretty_log(node_status,
indent=1)))
@download_packages_json
@download_astute_yaml
@duration
@check_repos_management
@custom_repo
def deploy_cluster_wait(self, cluster_id, is_feature=False,
timeout=help_data.DEPLOYMENT_TIMEOUT, interval=30,
check_services=True):
if not is_feature and help_data.DEPLOYMENT_RETRIES == 1:
logger.info('Deploy cluster %s', cluster_id)
task = self.deploy_cluster(cluster_id)
self.assert_task_success(task, interval=interval, timeout=timeout)
self.check_deploy_state(cluster_id, check_services)
return
logger.info('Provision nodes of a cluster %s', cluster_id)
task = self.client.provision_nodes(cluster_id)
self.assert_task_success(task, timeout=timeout, interval=interval)
for retry_number in range(help_data.DEPLOYMENT_RETRIES):
logger.info('Deploy nodes of a cluster %s, run: %s',
cluster_id, str(retry_number + 1))
task = self.client.deploy_nodes(cluster_id)
self.assert_task_success(task, timeout=timeout, interval=interval)
self.check_deploy_state(cluster_id, check_services)
def deploy_cluster_wait_progress(self, cluster_id, progress,
return_task=None):
task = self.deploy_cluster(cluster_id)

View File

@ -75,6 +75,7 @@ DEPLOYMENT_MODE_SIMPLE = "multinode"
DEPLOYMENT_MODE_HA = "ha_compact"
DEPLOYMENT_MODE = os.environ.get("DEPLOYMENT_MODE", DEPLOYMENT_MODE_HA)
DEPLOYMENT_TIMEOUT = int(os.environ.get("DEPLOYMENT_TIMEOUT", 7800))
DEPLOYMENT_RETRIES = int(os.environ.get("DEPLOYMENT_RETRIES", 1))
BOOTSTRAP_TIMEOUT = int(os.environ.get("BOOTSTRAP_TIMEOUT", 900))
WAIT_FOR_PROVISIONING_TIMEOUT = int(os.environ.get(
"WAIT_FOR_PROVISIONING_TIMEOUT", 1200))