Make scheduler target cells to get compute node instance info

This extends the previous patch to target cells during compute node
discovery to also target cells when fetching information about
instances prior to scheduling.

Change-Id: Idb9b969620c24f2b83f3205f95a9aab9daa28513
This commit is contained in:
Dan Smith
2017-03-01 14:00:21 -08:00
parent 4c04338fe4
commit 183da83693

View File

@@ -351,18 +351,21 @@ class TestCase(testtools.TestCase):
CONF.set_override(k, v, group, enforce_type=True)
def start_service(self, name, host=None, **kwargs):
svc = self.useFixture(
nova_fixtures.ServiceFixture(name, host, **kwargs))
if name == 'compute' and self.USES_DB:
# NOTE(danms): We need to create the HostMapping first, because
# otherwise we'll fail to update the scheduler while running
# the compute node startup routines below.
ctxt = context.get_context()
cell = self.cell_mappings[kwargs.pop('cell', CELL1_NAME)]
hm = objects.HostMapping(context=ctxt,
host=svc.service.host,
host=host or name,
cell_mapping=cell)
hm.create()
self.host_mappings[hm.host] = hm
svc = self.useFixture(
nova_fixtures.ServiceFixture(name, host, **kwargs))
return svc.service
def assertJsonEqual(self, expected, observed, message=''):