diff --git a/nova_powervm/tests/virt/powervm/test_vm.py b/nova_powervm/tests/virt/powervm/test_vm.py index c4bff348..166312e2 100644 --- a/nova_powervm/tests/virt/powervm/test_vm.py +++ b/nova_powervm/tests/virt/powervm/test_vm.py @@ -496,9 +496,11 @@ class TestVM(test.TestCase): mock.Mock(state=pvm_bp.LPARState.NOT_ACTIVATED))) self.assertFalse(mock_power_off.called) - stop_states = [pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING, - pvm_bp.LPARState.OPEN_FIRMWARE, pvm_bp.LPARState.ERROR, - pvm_bp.LPARState.RESUMING] + stop_states = [ + pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING, + pvm_bp.LPARState.OPEN_FIRMWARE, pvm_bp.LPARState.SHUTTING_DOWN, + pvm_bp.LPARState.ERROR, pvm_bp.LPARState.RESUMING, + pvm_bp.LPARState.SUSPENDING] for stop_state in stop_states: entry = mock.Mock(state=stop_state) mock_power_off.reset_mock() diff --git a/nova_powervm/virt/powervm/vm.py b/nova_powervm/virt/powervm/vm.py index 7cd023ac..9f408140 100644 --- a/nova_powervm/virt/powervm/vm.py +++ b/nova_powervm/virt/powervm/vm.py @@ -94,10 +94,12 @@ RESUMING_EVENTS = [ pvm_bp.LPARState.RESUMING, ] -POWERVM_STARTABLE_STATE = (pvm_bp.LPARState.NOT_ACTIVATED) -POWERVM_STOPABLE_STATE = (pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING, - pvm_bp.LPARState.OPEN_FIRMWARE, - pvm_bp.LPARState.ERROR, pvm_bp.LPARState.RESUMING) +POWERVM_STARTABLE_STATE = (pvm_bp.LPARState.NOT_ACTIVATED, ) +POWERVM_STOPABLE_STATE = ( + pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING, + pvm_bp.LPARState.OPEN_FIRMWARE, pvm_bp.LPARState.SHUTTING_DOWN, + pvm_bp.LPARState.ERROR, pvm_bp.LPARState.RESUMING, + pvm_bp.LPARState.SUSPENDING) def translate_event(pvm_state, pwr_state): @@ -650,7 +652,9 @@ def power_off(adapter, instance, host_uuid, entry=None, add_parms=None, # Get the current state and see if we can stop the VM LOG.debug("Powering off request for instance %(inst)s which is in " - "state %(state)s", {'inst': instance.name, 'state': entry.state}) + "state %(state)s. Force Immediate Flag: %(force)s.", + {'inst': instance.name, 'state': entry.state, + 'force': force_immediate}) if entry.state in POWERVM_STOPABLE_STATE: # Now stop the lpar try: