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
(cherry picked from commit 4e854edeb4)
This commit is contained in:
James Slagle 2018-07-26 17:46:39 -04:00
parent 1d8dcb6937
commit 5e03a6c0c6
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 six
import tempfile
import time
import yaml
from heatclient.common import template_utils
@ -818,6 +819,14 @@ class DeployOvercloud(command.Command):
'in the file will override any configuration used by '
'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
def take_action(self, parsed_args):
@ -871,6 +880,8 @@ class DeployOvercloud(command.Command):
print("Validation Finished")
return
start = time.time()
if not parsed_args.config_download_only:
self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args)
@ -893,6 +904,13 @@ class DeployOvercloud(command.Command):
hosts,
parsed_args.overcloud_ssh_user,
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,
parsed_args.templates,
parsed_args.overcloud_ssh_user,
@ -900,6 +918,7 @@ class DeployOvercloud(command.Command):
parsed_args.overcloud_ssh_network,
parsed_args.output_dir,
parsed_args.override_ansible_cfg,
timeout,
verbosity=self.app_args.verbose_level)
# 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,
ssh_user, ssh_key, ssh_network, output_dir,
override_ansible_cfg, verbosity=1):
ssh_user, ssh_key, ssh_network,
output_dir, override_ansible_cfg, timeout, verbosity=1):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
workflow_input = {
'verbosity': verbosity or 1,
'plan_name': stack.stack_name,
'ssh_network': ssh_network
'ssh_network': ssh_network,
'config_download_timeout': timeout
}
if output_dir:
workflow_input.update(dict(work_dir=output_dir))