Record right action name while migrate
Actions are recorded in database while users take atcions in specific instance. These actions can be listed by comand 'nova instance-action-list'. Resize and migrate use same code path, but always record the action as 'resize' even user migrate instance. This commit check the action firstly then record right action. Change-Id: I3462275fa3022173d55dfa0c87328d4bb518239b Closes-Bug: #1323173
This commit is contained in:
@@ -2433,7 +2433,12 @@ class API(base.Base):
|
||||
current_instance_type,
|
||||
new_instance_type)
|
||||
|
||||
self._record_action_start(context, instance, instance_actions.RESIZE)
|
||||
if not flavor_id:
|
||||
self._record_action_start(context, instance,
|
||||
instance_actions.MIGRATE)
|
||||
else:
|
||||
self._record_action_start(context, instance,
|
||||
instance_actions.RESIZE)
|
||||
|
||||
scheduler_hint = {'filter_properties': filter_properties}
|
||||
self.compute_task_api.resize_instance(context, instance,
|
||||
|
||||
@@ -34,6 +34,7 @@ REBUILD = 'rebuild'
|
||||
REVERT_RESIZE = 'revertResize'
|
||||
CONFIRM_RESIZE = 'confirmResize'
|
||||
RESIZE = 'resize'
|
||||
MIGRATE = 'migrate'
|
||||
PAUSE = 'pause'
|
||||
UNPAUSE = 'unpause'
|
||||
SUSPEND = 'suspend'
|
||||
|
||||
@@ -1062,8 +1062,12 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
self.context.elevated().AndReturn(self.context)
|
||||
mig.create(self.context).WithSideEffects(_check_mig)
|
||||
|
||||
self.compute_api._record_action_start(self.context, fake_inst,
|
||||
'resize')
|
||||
if flavor_id_passed:
|
||||
self.compute_api._record_action_start(self.context, fake_inst,
|
||||
'resize')
|
||||
else:
|
||||
self.compute_api._record_action_start(self.context, fake_inst,
|
||||
'migrate')
|
||||
|
||||
scheduler_hint = {'filter_properties': filter_properties}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user