Merge "Increase scope of stopable states"
This commit is contained in:
commit
c1df6cc974
|
@ -496,9 +496,11 @@ class TestVM(test.TestCase):
|
||||||
mock.Mock(state=pvm_bp.LPARState.NOT_ACTIVATED)))
|
mock.Mock(state=pvm_bp.LPARState.NOT_ACTIVATED)))
|
||||||
self.assertFalse(mock_power_off.called)
|
self.assertFalse(mock_power_off.called)
|
||||||
|
|
||||||
stop_states = [pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING,
|
stop_states = [
|
||||||
pvm_bp.LPARState.OPEN_FIRMWARE, pvm_bp.LPARState.ERROR,
|
pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING,
|
||||||
pvm_bp.LPARState.RESUMING]
|
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:
|
for stop_state in stop_states:
|
||||||
entry = mock.Mock(state=stop_state)
|
entry = mock.Mock(state=stop_state)
|
||||||
mock_power_off.reset_mock()
|
mock_power_off.reset_mock()
|
||||||
|
|
|
@ -94,10 +94,12 @@ RESUMING_EVENTS = [
|
||||||
pvm_bp.LPARState.RESUMING,
|
pvm_bp.LPARState.RESUMING,
|
||||||
]
|
]
|
||||||
|
|
||||||
POWERVM_STARTABLE_STATE = (pvm_bp.LPARState.NOT_ACTIVATED)
|
POWERVM_STARTABLE_STATE = (pvm_bp.LPARState.NOT_ACTIVATED, )
|
||||||
POWERVM_STOPABLE_STATE = (pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING,
|
POWERVM_STOPABLE_STATE = (
|
||||||
pvm_bp.LPARState.OPEN_FIRMWARE,
|
pvm_bp.LPARState.RUNNING, pvm_bp.LPARState.STARTING,
|
||||||
pvm_bp.LPARState.ERROR, pvm_bp.LPARState.RESUMING)
|
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):
|
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
|
# Get the current state and see if we can stop the VM
|
||||||
LOG.debug("Powering off request for instance %(inst)s which is in "
|
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:
|
if entry.state in POWERVM_STOPABLE_STATE:
|
||||||
# Now stop the lpar
|
# Now stop the lpar
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue