Ensure audit only updates upgrade state after the activate is complete

Code was removed that updated config targets before the upgrade
activate started. This prevented the audit from setting the state to
activation-completed before the tasks completed. This change restores
that code.

Change-Id: I726eb24cc4732063931c63f76f7efca99f32ca5b
Story: 2007403
Task: 40231
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
David Sullivan 2020-06-25 21:58:33 -04:00
parent 3294641535
commit 93be0c8d08
1 changed files with 9 additions and 0 deletions

View File

@ -9414,6 +9414,11 @@ class ConductorManager(service.PeriodicService):
to_load = self.dbapi.load_get(upgrade.to_load)
to_version = to_load.software_version
# Update the config target of the controllers. This prevents the audit
# from changing the upgrade state before we're ready.
personalities = [constants.CONTROLLER]
config_uuid = self._config_update_hosts(context, personalities)
self.dbapi.software_upgrade_update(
upgrade.uuid, {'state': constants.UPGRADE_ACTIVATING})
@ -9433,6 +9438,10 @@ class ConductorManager(service.PeriodicService):
upgrade.uuid,
{'state': constants.UPGRADE_ACTIVATION_FAILED})
hosts = self.dbapi.ihost_get_by_personality(constants.CONTROLLER)
for host in hosts:
self._update_host_config_applied(context, host, config_uuid)
def complete_upgrade(self, context, upgrade, state):
""" Complete the upgrade"""