Skip to content

Commit

Permalink
Merge "Fix Multi_Scheduler to process host capabilities"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed May 18, 2012
2 parents 129795c + 3ae69eb commit 75cd464
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .mailmap
Expand Up @@ -8,6 +8,7 @@
<anotherjesse@gmail.com> <jesse@aire.local>
<ant@openstack.org> <amesserl@rackspace.com>
<Armando.Migliaccio@eu.citrix.com> <armando.migliaccio@citrix.com>
<Armando.Migliaccio@eu.citrix.com> <amigliaccio@internap.com>
<brian.elliott@rackspace.com> <bdelliott@gmail.com>
<brian.lamar@rackspace.com> <brian.lamar@gmail.com>
<brian.waldon@rackspace.com> <bcwaldon@gmail.com>
Expand Down
6 changes: 6 additions & 0 deletions nova/scheduler/multi.py
Expand Up @@ -81,3 +81,9 @@ def schedule_run_instance(self, *args, **kwargs):

def schedule_prep_resize(self, *args, **kwargs):
return self.drivers['compute'].schedule_prep_resize(*args, **kwargs)

def update_service_capabilities(self, service_name, host, capabilities):
# Multi scheduler is only a holder of sub-schedulers, so
# pass the capabilities to the schedulers that matter
for d in self.drivers.values():
d.update_service_capabilities(service_name, host, capabilities)
22 changes: 22 additions & 0 deletions nova/tests/scheduler/test_multi_scheduler.py
Expand Up @@ -28,6 +28,10 @@
class FakeComputeScheduler(driver.Scheduler):
is_fake_compute = True

def __init__(self):
super(FakeComputeScheduler, self).__init__()
self.is_update_caps_called = False

def schedule_theoretical(self, *args, **kwargs):
pass

Expand All @@ -38,6 +42,10 @@ def schedule(self, *args, **kwargs):
class FakeVolumeScheduler(driver.Scheduler):
is_fake_volume = True

def __init__(self):
super(FakeVolumeScheduler, self).__init__()
self.is_update_caps_called = False

def schedule_create_volume(self, *args, **kwargs):
pass

Expand Down Expand Up @@ -103,3 +111,17 @@ def test_schedule_fallback_proxy(self):
self.mox.ReplayAll()
mgr.schedule(ctxt, 'compute', method, *fake_args, **fake_kwargs)
mgr.schedule(ctxt, 'volume', method, *fake_args, **fake_kwargs)

def test_update_service_capabilities(self):
def fake_update_service_capabilities(self, service, host, caps):
self.is_update_caps_called = True

mgr = self._manager
self.stubs.Set(driver.Scheduler,
'update_service_capabilities',
fake_update_service_capabilities)
self.assertFalse(mgr.drivers['compute'].is_update_caps_called)
self.assertFalse(mgr.drivers['volume'].is_update_caps_called)
mgr.update_service_capabilities('foo_svc', 'foo_host', 'foo_caps')
self.assertTrue(mgr.drivers['compute'].is_update_caps_called)
self.assertTrue(mgr.drivers['volume'].is_update_caps_called)

0 comments on commit 75cd464

Please sign in to comment.