Merge "Upgrade activation interrupted by host-swact"

This commit is contained in:
Zuul 2021-03-05 17:05:23 +00:00 committed by Gerrit Code Review
commit 10661df727
2 changed files with 20 additions and 0 deletions

View File

@ -5833,6 +5833,18 @@ class HostController(rest.RestController):
_("Swact action not allowed. Upgrade state must be %s") %
(constants.UPGRADE_DATA_MIGRATION_COMPLETE))
activating_states = [constants.UPGRADE_ACTIVATION_REQUESTED,
constants.UPGRADE_ACTIVATING]
if upgrade.state in activating_states and not force_swact:
# Block swacts during activation to prevent interrupting the
# upgrade scripts.
# Allow swacts during UPGRADE_ACTIVATING_HOSTS as the active
# controller may need a lock/unlock if a runtime manifest fails.
# Allow force swacts for recovery in edge cases.
raise wsme.exc.ClientSideError(
_("Swact action not allowed. Wait until the upgrade-activate "
"command completes"))
if upgrade.state in [constants.UPGRADE_ABORTING,
constants.UPGRADE_ABORTING_ROLLBACK]:
if to_host_load_id == upgrade.to_load:

View File

@ -402,6 +402,14 @@ class ConductorManager(service.PeriodicService):
if system_mode == constants.SYSTEM_MODE_SIMPLEX:
self._init_controller_for_upgrade(upgrade)
if upgrade.state in [constants.UPGRADE_ACTIVATION_REQUESTED,
constants.UPGRADE_ACTIVATING]:
# Reset to activation-failed if the conductor restarts. This could
# be due to a swact or the process restarting. Either way we'll
# need to rerun the activation.
self.dbapi.software_upgrade_update(
upgrade.uuid, {'state': constants.UPGRADE_ACTIVATION_FAILED})
self._upgrade_default_service()
self._upgrade_default_service_parameter()