Merge "Set migration_type for existing cold migrations and resizes"
This commit is contained in:
commit
a443494024
@ -2549,6 +2549,9 @@ class API(base.Base):
|
||||
mig.old_instance_type_id = current_instance_type['id']
|
||||
mig.new_instance_type_id = new_instance_type['id']
|
||||
mig.status = 'finished'
|
||||
mig.migration_type = (
|
||||
mig.old_instance_type_id != mig.new_instance_type_id and
|
||||
'resize' or 'migration')
|
||||
mig.create()
|
||||
|
||||
@wrap_check_policy
|
||||
|
@ -206,6 +206,9 @@ class ResourceTracker(object):
|
||||
migration.instance_uuid = instance['uuid']
|
||||
migration.source_compute = instance['host']
|
||||
migration.source_node = instance['node']
|
||||
migration.migration_type = (
|
||||
migration.old_instance_type_id != migration.new_instance_type_id
|
||||
and 'resize' or 'migration')
|
||||
migration.create()
|
||||
return migration
|
||||
|
||||
|
@ -7001,6 +7001,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
migration = objects.Migration(context=self.context.elevated())
|
||||
migration.instance_uuid = instance.uuid
|
||||
migration.status = 'finished'
|
||||
migration.migration_type = 'resize'
|
||||
migration.create()
|
||||
|
||||
instance.task_state = task_states.DELETING
|
||||
|
@ -1329,6 +1329,10 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
self.assertEqual(new_flavor.id,
|
||||
mig.new_instance_type_id)
|
||||
self.assertEqual('finished', mig.status)
|
||||
if new_flavor.id != current_flavor.id:
|
||||
self.assertEqual('resize', mig.migration_type)
|
||||
else:
|
||||
self.assertEqual('migration', mig.migration_type)
|
||||
|
||||
self.stubs.Set(objects, 'Migration', _get_migration)
|
||||
self.mox.StubOutWithMock(self.context, 'elevated')
|
||||
|
Loading…
x
Reference in New Issue
Block a user