diff options
author | Yaguang Tang <yaguang.tang@canonical.com> | 2013-06-21 14:40:37 +0800 |
---|---|---|
committer | Yaguang Tang <yaguang.tang@canonical.com> | 2013-06-21 21:39:56 +0800 |
commit | a42adb28c9817b96178617bba9c42dac18bfec24 (patch) | |
tree | 665835c2285274e9fe4aa4b182e5c9728a1bfa35 | |
parent | d8c9864d95bec6d2babb2cb5a2aeeb284fca4834 (diff) | |
download | nova-a42adb28c9817b96178617bba9c42dac18bfec24.tar.gz nova-a42adb28c9817b96178617bba9c42dac18bfec24.tar.xz nova-a42adb28c9817b96178617bba9c42dac18bfec24.zip |
Fix KeyError exception when scheduling to child cell.
Fix typo 'security_group' and update related unit tests.
Fix bug #1193233
Change-Id: I6d92759b0d7e2ce81c2065a4eada35c559ccbcd7
-rw-r--r-- | nova/cells/scheduler.py | 5 | ||||
-rw-r--r-- | nova/tests/cells/test_cells_scheduler.py | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/nova/cells/scheduler.py b/nova/cells/scheduler.py index aa081a726..08f485189 100644 --- a/nova/cells/scheduler.py +++ b/nova/cells/scheduler.py @@ -175,9 +175,10 @@ class CellsScheduler(base.Base): """Attempt to build instance(s) or send msg to child cell.""" ctxt = message.ctxt instance_properties = build_inst_kwargs['instances'][0] - instance_type = build_inst_kwargs['instance_type'] + filter_properties = build_inst_kwargs['filter_properties'] + instance_type = filter_properties['instance_type'] image = build_inst_kwargs['image'] - security_groups = build_inst_kwargs['security_group'] + security_groups = build_inst_kwargs['security_groups'] block_device_mapping = build_inst_kwargs['block_device_mapping'] LOG.debug(_("Building instances with routing_path=%(routing_path)s"), diff --git a/nova/tests/cells/test_cells_scheduler.py b/nova/tests/cells/test_cells_scheduler.py index 600867f43..46be492cc 100644 --- a/nova/tests/cells/test_cells_scheduler.py +++ b/nova/tests/cells/test_cells_scheduler.py @@ -84,10 +84,9 @@ class CellsSchedulerTestCase(test.TestCase): 'block_device_mapping': 'fake_bdm'} self.build_inst_kwargs = { 'instances': self.instances, - 'instance_type': 'fake_type', 'image': 'fake_image', - 'filter_properties': {}, - 'security_group': 'fake_sec_groups', + 'filter_properties': {'instance_type': 'fake_type'}, + 'security_groups': 'fake_sec_groups', 'block_device_mapping': 'fake_bdm'} def test_create_instances_here(self): @@ -284,10 +283,11 @@ class CellsSchedulerTestCase(test.TestCase): self.assertEqual(self.instance_uuids, call_info['instance_uuids']) self.assertEqual(self.build_inst_kwargs['instances'][0], call_info['instance_properties']) - self.assertEqual(self.build_inst_kwargs['instance_type'], - call_info['instance_type']) + self.assertEqual( + self.build_inst_kwargs['filter_properties']['instance_type'], + call_info['instance_type']) self.assertEqual(self.build_inst_kwargs['image'], call_info['image']) - self.assertEqual(self.build_inst_kwargs['security_group'], + self.assertEqual(self.build_inst_kwargs['security_groups'], call_info['security_groups']) self.assertEqual(self.build_inst_kwargs['block_device_mapping'], call_info['block_device_mapping']) |