Merge "Don't immediately null host/node when shelving" into stable/mitaka
This commit is contained in:
commit
67cfb16a4f
|
@ -4321,15 +4321,19 @@ class ComputeManager(manager.Manager):
|
|||
block_device_info)
|
||||
|
||||
instance.power_state = current_power_state
|
||||
instance.host = None
|
||||
instance.node = None
|
||||
instance.vm_state = vm_states.SHELVED_OFFLOADED
|
||||
instance.task_state = None
|
||||
instance.save(expected_task_state=[task_states.SHELVING,
|
||||
task_states.SHELVING_OFFLOADING])
|
||||
# NOTE(ndipanov): This frees the resources with the resource_tracker
|
||||
|
||||
# NOTE(ndipanov): Free resources from the resource tracker
|
||||
self._update_resource_tracker(context, instance)
|
||||
|
||||
# NOTE(sfinucan): RPC calls should no longer be attempted against this
|
||||
# instance, so ensure any calls result in errors
|
||||
self._nil_out_instance_obj_host_and_node(instance)
|
||||
instance.save(expected_task_state=None)
|
||||
|
||||
self._delete_scheduler_instance_info(context, instance.uuid)
|
||||
self._notify_about_instance_usage(context, instance,
|
||||
'shelve_offload.end')
|
||||
|
|
|
@ -98,8 +98,6 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
|
|||
tracking['last_state'] = instance.vm_state
|
||||
elif (tracking['last_state'] == vm_states.SHELVED and
|
||||
CONF.shelved_offload_time == 0):
|
||||
self.assertIsNone(instance.host)
|
||||
self.assertIsNone(instance.node)
|
||||
self.assertIsNone(instance.task_state)
|
||||
self.assertEqual(vm_states.SHELVED_OFFLOADED,
|
||||
instance.vm_state)
|
||||
|
@ -107,6 +105,11 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
|
|||
task_states.SHELVING_OFFLOADING],
|
||||
expected_task_state)
|
||||
tracking['last_state'] = instance.vm_state
|
||||
elif (tracking['last_state'] == vm_states.SHELVED_OFFLOADED and
|
||||
CONF.shelved_offload_time == 0):
|
||||
self.assertIsNone(instance.host)
|
||||
self.assertIsNone(instance.node)
|
||||
self.assertIsNone(expected_task_state)
|
||||
else:
|
||||
self.fail('Unexpected save!')
|
||||
|
||||
|
|
Loading…
Reference in New Issue