nova/nova/compute
Matt Riedemann 1a11d5c7f3 Raise InstanceFaultRollback for UnableToMigrateToSelf from _prep_resize
It is possible to cold migrate a stopped server. If, however, the
cold migrate is scheduled to the instance's current host and the
compute driver does not support cold migrating to the same host,
then UnableToMigrateToSelf was being raised from _prep_resize. If
_reschedule_resize_or_reraise re-raises that exception, then
_error_out_instance_on_exception in prep_resize handles it and
sets the instance vm_state to ACTIVE. This is wrong since the
instance power state is unchanged at this point and the instance
is actually stopped.

This fixes the problem by wrapping UnableToMigrateToSelf in
InstanceFaultRollback and raises that from _prep_resize, and
_error_out_instance_on_exception is called with the initial
vm_state (STOPPED in this case) so when _error_out_instance_on_exception
handles the InstanceFaultRollback exception it sets the instance
vm_state to STOPPED (what it already was) rather than ACTIVE.

There were no existing unit tests for the UnableToMigrateToSelf
case in _prep_resize so those are added here.

Conflicts:
      nova/tests/unit/compute/test_compute_mgr.py

NOTE(mriedem): The conflict is due to some unit tests from change
I734cc01dce13f9e75a16639faf890ddb1661b7eb not being in Stein.

Change-Id: I17543ecb572934ecc7d0bbc7a4ad2f537fa499bc
Closes-Bug: #1811235
(cherry picked from commit d1931ac063)
2019-06-20 12:43:25 -04:00
..
monitors Do not log a warning about not using compute monitors 2019-04-08 15:35:04 +00:00
__init__.py Switch to using oslo_* instead of oslo.* 2015-02-06 06:03:10 -05:00
api.py Block swap volume on volumes with >1 rw attachment 2019-05-30 20:59:55 +00:00
build_results.py
cells_api.py Minimal construct plumbing for nova service-list when a cell is down 2018-10-31 15:22:15 -04:00
claims.py Make Claim._claim_test handle SchedulerLimits object 2019-02-12 11:59:51 -05:00
flavors.py Remove unused flavor_delete_info() method 2018-08-03 12:44:52 -04:00
instance_actions.py Add instance action record for snapshot instances 2017-12-11 17:46:38 +08:00
instance_list.py Plumbing for ignoring list_records_by_skipping_down_cells 2019-02-08 16:28:28 -05:00
manager.py Raise InstanceFaultRollback for UnableToMigrateToSelf from _prep_resize 2019-06-20 12:43:25 -04:00
migration_list.py Refactor scatter-gather utility to return exception objects 2018-10-31 15:18:07 -04:00
multi_cell_list.py Plumbing for ignoring list_records_by_skipping_down_cells 2019-02-08 16:28:28 -05:00
power_state.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00
provider_tree.py Reduce calls to placement from _ensure 2019-01-16 18:34:34 +00:00
resource_tracker.py Remove unnecessary default provider_tree when getting traits 2019-03-18 20:16:00 +00:00
rpcapi.py Update compute rpc version alias for stein 2019-03-12 08:46:28 +09:00
stats.py Change consecutive build failure limit to a weigher 2018-06-06 15:18:50 -07:00
task_states.py Fix resource tracker updates during instance evacuation 2018-09-12 13:05:29 +03:00
utils.py Merge "Share snapshot image membership with instance owner" 2019-03-12 18:43:12 +00:00
vm_states.py Removed enum duplication from nova.compute 2016-09-02 07:30:44 +00:00