diff options
| author | matt.dietz@rackspace.com <> | 2011-05-17 19:50:43 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-05-17 19:50:43 +0000 |
| commit | 8541290e7fccc64ea325f4f5d63d5ba9fdd56692 (patch) | |
| tree | 2b55f5b878eee32570489650b8bf91e0028f9b36 /nova | |
| parent | 97e2a3610e3cd3dbc539c1486b8ae82475578bb7 (diff) | |
| parent | 2aaeb82d5c2587adcad46e4087a3fb0aafdc1bbb (diff) | |
Fixes improper attribute naming around instance types that broke Resizes.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/compute/manager.py | 2 | ||||
| -rw-r--r-- | nova/tests/test_compute.py | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 923feaa59..11565c25e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -628,7 +628,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_type = self.db.instance_type_get_by_flavor_id(context, migration_ref['new_flavor_id']) self.db.instance_update(context, instance_id, - dict(instance_type=instance_type['name'], + dict(instance_type_id=instance_type['id'], memory_mb=instance_type['memory_mb'], vcpus=instance_type['vcpus'], local_gb=instance_type['local_gb'])) diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 55e7ae0c4..9170837b6 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -334,6 +334,28 @@ class ComputeTestCase(test.TestCase): self.compute.terminate_instance(self.context, instance_id) + def test_finish_resize(self): + """Contrived test to ensure finish_resize doesn't raise anything""" + + def fake(*args, **kwargs): + pass + + self.stubs.Set(self.compute.driver, 'finish_resize', fake) + context = self.context.elevated() + instance_id = self._create_instance() + self.compute.prep_resize(context, instance_id, 1) + migration_ref = db.migration_get_by_instance_and_status(context, + instance_id, 'pre-migrating') + try: + self.compute.finish_resize(context, instance_id, + int(migration_ref['id']), {}) + except KeyError, e: + # Only catch key errors. We want other reasons for the test to + # fail to actually error out so we don't obscure anything + self.fail() + + self.compute.terminate_instance(self.context, instance_id) + def test_resize_instance(self): """Ensure instance can be migrated/resized""" instance_id = self._create_instance() |
