diff options
author | Balazs Gibizer <balazs.gibizer@ericsson.com> | 2014-04-04 16:55:01 +0200 |
---|---|---|
committer | Russell Bryant <rbryant@redhat.com> | 2014-04-08 13:22:27 -0400 |
commit | 0614a83e3ccb2c1e891909ffffe6380c8617bee3 (patch) | |
tree | b8328c504928ecb247b5a2c790e6def192f8f3e3 | |
parent | cf0a22c2ac71726080fc5281ca0ed4c3ed5ef8e3 (diff) | |
download | nova-0614a83e3ccb2c1e891909ffffe6380c8617bee3.tar.gz |
Fix anti-affinity server-group boot failure
When the second instance is booted to an anti-affinity group
the scheduler fails with an exception due to a missing type conversion.
Closes-Bug: #1301982
Change-Id: I87b2a8d8c7d04b781c789374d6e9c7f4c8567e5d
(cherry picked from commit 1680cf8cef9bd670306a0ef74803409f60f21f28)
-rw-r--r-- | nova/scheduler/filter_scheduler.py | 2 | ||||
-rw-r--r-- | nova/tests/scheduler/test_filter_scheduler.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/nova/scheduler/filter_scheduler.py b/nova/scheduler/filter_scheduler.py index 62da2e6c02..35f73fac6a 100644 --- a/nova/scheduler/filter_scheduler.py +++ b/nova/scheduler/filter_scheduler.py @@ -270,7 +270,7 @@ class FilterScheduler(driver.Scheduler): if any((policy in policies) for policy in group.policies): update_group_hosts = True filter_properties.setdefault('group_hosts', set()) - user_hosts = filter_properties['group_hosts'] + user_hosts = set(filter_properties['group_hosts']) group_hosts = set(group.get_hosts(context)) filter_properties['group_hosts'] = user_hosts | group_hosts filter_properties['group_policies'] = group.policies diff --git a/nova/tests/scheduler/test_filter_scheduler.py b/nova/tests/scheduler/test_filter_scheduler.py index c88d43933d..cd0d4eca07 100644 --- a/nova/tests/scheduler/test_filter_scheduler.py +++ b/nova/tests/scheduler/test_filter_scheduler.py @@ -391,6 +391,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): 'scheduler_hints': { 'group': group.uuid, }, + 'group_hosts': ['hostB'], } with contextlib.nested( @@ -402,7 +403,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): update_group_hosts = sched._setup_instance_group(self.context, filter_properties) self.assertTrue(update_group_hosts) - self.assertEqual(set(['hostA']), filter_properties['group_hosts']) + self.assertEqual(set(['hostA', 'hostB']), + filter_properties['group_hosts']) self.assertEqual(['anti-affinity'], filter_properties['group_policies']) |