From 6c5a5cdff330a775c343ab81cac5c45820176a12 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 7 Jan 2021 20:16:20 +0000 Subject: [PATCH] Ensure user is aware upgrade has not happened w/ train There is a 'hole' in the user experience where if you try to openstack-upgrade from stein to train but have no already related placement to the nova-cc unit, then the openstack upgrade is aborted and a workload message indicates that the relation is needed. However, if you then subsequently add the placement relation, the warning goes away, but the payload is not upgraded to match the openstack-origin value. This patch adds a warning if the openstack-origin is for train, the payload is stein, the action-managed-upgrade is false and the placement relation is made; i.e. that the operator fell into the above hole. Change-Id: I360f2d72cad374c31ee766065af682e2fa6218d1 Closes-Bug: #1910276 --- hooks/nova_cc_utils.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hooks/nova_cc_utils.py b/hooks/nova_cc_utils.py index 9a1da969..feeccc39 100644 --- a/hooks/nova_cc_utils.py +++ b/hooks/nova_cc_utils.py @@ -1694,7 +1694,11 @@ def check_optional_relations(configs): """Check optional relations and set status If attempting to upgrade from Stein->Train, block until Placement - charm is related. + charm is related. If placement does exist, but openstack-origin doesn't + match installed payload then order of upgrades may mean that the blocked + message has been missed; e.g. the upgrade was attempted, then placement was + related, but the payload version doesn't match the corresponding + openstack-origin. Check only performed if action-managed-upgrade is false. Also check that if we have a relation_id for high availability that we can get the hacluster config. If we can't then we are blocked. @@ -1712,12 +1716,15 @@ def check_optional_relations(configs): new_os_rel = ch_utils.get_os_codename_install_source(new_src) cmp_new_os_rel = ch_utils.CompareOpenStackReleases(new_os_rel) - if (cmp_cur_os_rel == 'stein' and - cmp_new_os_rel == 'train' and - not hookenv.relation_ids('placement')): - return ('blocked', - 'placement charm must be related prior to ' - 'upgrading to OpenStack Train') + if cmp_cur_os_rel == 'stein' and cmp_new_os_rel == 'train': + if not hookenv.relation_ids('placement'): + return ('blocked', + 'placement charm must be related prior to ' + 'upgrading to OpenStack Train') + if not hookenv.config('action-managed-upgrade'): + return ('blocked', + "openstack-origin '{}' doesn't match installed payload" + .format(new_src)) if hookenv.relation_ids('ha'): try: