diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index 2451ce884c..70cd6beb2b 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -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: diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index 6302eb33b3..a4be8a03ed 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -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()