From 985d703d2731fe9ec968ef6698bbf39743ede32a Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 26 Mar 2013 13:14:56 -0700 Subject: Always store old instance_type during a migration Previously, we were trying to optimize for the migration (as opposed to resize) case by not storing the old_ instance_type. However, this is confusing to the vast amount of shared code that works on migrations and resizes because the "is old == new" logic must be replicated everywhere. To cut our losses and hopefully avoid other hidden dragons, this patch removes the optimization and makes both paths the same. Fixes bug #1160489 Change-Id: I2ad7b02239baada5fd2174f5b61cdc90ec91e6f5 --- nova/tests/compute/test_compute.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index c36496f79..3a1526522 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -2806,7 +2806,7 @@ class ComputeTestCase(BaseTestCase): self.mox.StubOutWithMock(instance_types, 'extract_instance_type') self.mox.StubOutWithMock(instance_types, 'delete_instance_type_info') self.mox.StubOutWithMock(instance_types, 'save_instance_type_info') - if revert and old != new: + if revert: instance_types.extract_instance_type(instance, 'old_').AndReturn( {'instance_type_id': old}) instance_types.save_instance_type_info( @@ -2814,9 +2814,8 @@ class ComputeTestCase(BaseTestCase): else: instance_types.extract_instance_type(instance).AndReturn( {'instance_type_id': new}) - if old != new: - instance_types.delete_instance_type_info( - sys_meta, 'old_').AndReturn(sys_meta) + instance_types.delete_instance_type_info( + sys_meta, 'old_').AndReturn(sys_meta) instance_types.delete_instance_type_info( sys_meta, 'new_').AndReturn(sys_meta) -- cgit