Fail in undercloud pre_upgrade if overcloud not in *_COMPLETE state

We migrate overcloud stack to convergence in post_config which would
otherwise fail. It makes sense to fail quicker before doing any upgrade.

Change-Id: Ie5831b022d1a7572729e0715cdc07253efbbca17
Related-Bug: #1767962
This commit is contained in:
rabi 2018-05-18 12:07:05 +05:30
parent 38befed4f8
commit 04919e7a7c
1 changed files with 17 additions and 0 deletions

View File

@ -2367,6 +2367,23 @@ def _is_database_upgrade_needed():
def pre_upgrade():
_configure_logging(DEFAULT_LOG_LEVEL, PATHS.LOG_FILE)
# Don't upgrade undercloud unless overcloud is in *_COMPLETE.
# As we're migrating overcloud stack to convergence in post_config,
# which would fail otherwise. It's better to fail fast.
user, password, project, auth_url = _get_auth_values()
heat = os_client_config.make_client('orchestration',
auth_url=auth_url,
username=user,
password=password,
project_name=project,
project_domain_name='Default',
user_domain_name='Default')
for stack in heat.stacks.list():
if stack.status != 'COMPLETE':
LOG.error('Can not upgrade undercloud with FAILED overcloud')
sys.exit(1)
args = ['sudo', 'systemctl', 'stop', 'openstack-*', 'neutron-*',
'openvswitch', 'httpd']
LOG.info('Stopping OpenStack and related services')