Honor timeout with config-download

The timeout specified with --timeout will now be honored with config-download.
An additional cli arg, --config-download-timeout is also added that can be used
to specify a specific timeout just for the config-download part of the
deployment.

Change-Id: I5c81ebfb8d070920352e2fb4cfae641b88d8f9ab
Closes-Bug: #1783893
Depends-On: I522b71f92149e0cee7842d1bcbf35d9e820454b8
This commit is contained in:
James Slagle 2018-07-26 17:46:39 -04:00
parent 6b0f54c07a
commit 4e854edeb4
3 changed files with 29 additions and 3 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- The timeout specified with --timeout will now be honored with
config-download. An additional cli arg, --config-download-timeout is also
added that can be used to specify a specific timeout (in minutes) just for
the config-download part of the deployment.

View File

@ -24,6 +24,7 @@ import re
import shutil import shutil
import six import six
import tempfile import tempfile
import time
import yaml import yaml
from heatclient.common import template_utils from heatclient.common import template_utils
@ -820,6 +821,14 @@ class DeployOvercloud(command.Command):
'in the file will override any configuration used by ' 'in the file will override any configuration used by '
'config-download by default.') 'config-download by default.')
) )
parser.add_argument(
'--config-download-timeout',
action='store',
default=None,
help=_('Timeout (in minutes) to use for config-download steps. If '
'unset, will default to however much time is leftover '
'from the --timeout parameter after the stack operation.')
)
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
@ -873,6 +882,8 @@ class DeployOvercloud(command.Command):
print("Validation Finished") print("Validation Finished")
return return
start = time.time()
if not parsed_args.config_download_only: if not parsed_args.config_download_only:
self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args) self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args)
@ -895,6 +906,13 @@ class DeployOvercloud(command.Command):
hosts, hosts,
parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_user,
parsed_args.overcloud_ssh_key) parsed_args.overcloud_ssh_key)
if parsed_args.config_download_timeout:
timeout = parsed_args.config_download_timeout * 60
else:
used = int(time.time() - start)
timeout = (parsed_args.timeout * 60) - used
deployment.config_download(self.log, self.clients, stack, deployment.config_download(self.log, self.clients, stack,
parsed_args.templates, parsed_args.templates,
parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_user,
@ -902,6 +920,7 @@ class DeployOvercloud(command.Command):
parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_network,
parsed_args.output_dir, parsed_args.output_dir,
parsed_args.override_ansible_cfg, parsed_args.override_ansible_cfg,
timeout,
verbosity=self.app_args.verbose_level) verbosity=self.app_args.verbose_level)
# Force fetching of attributes # Force fetching of attributes

View File

@ -243,15 +243,16 @@ def enable_ssh_admin(log, clients, hosts, ssh_user, ssh_key):
def config_download(log, clients, stack, templates, def config_download(log, clients, stack, templates,
ssh_user, ssh_key, ssh_network, output_dir, ssh_user, ssh_key, ssh_network,
override_ansible_cfg, verbosity=1): output_dir, override_ansible_cfg, timeout, verbosity=1):
workflow_client = clients.workflow_engine workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient tripleoclients = clients.tripleoclient
workflow_input = { workflow_input = {
'verbosity': verbosity or 1, 'verbosity': verbosity or 1,
'plan_name': stack.stack_name, 'plan_name': stack.stack_name,
'ssh_network': ssh_network 'ssh_network': ssh_network,
'config_download_timeout': timeout
} }
if output_dir: if output_dir:
workflow_input.update(dict(work_dir=output_dir)) workflow_input.update(dict(work_dir=output_dir))