Trivial: Adds comments and tests for scheduler

This patch adds a comment for aggregate operation in scheduler utils
since aggregate requests to placement has a bit complex or/and logic.

This patch also fixes scheduler util tests where there was
inconsistency between the name of mocked compute node objects and
mocked request spec objects.

This is a follow up of https://review.opendev.org/#/c/650878/.

Change-Id: Ic00f8f39200b46908f474c7fc09415063a730ce2
This commit is contained in:
Tetsuro Nakamura
2019-05-11 02:36:55 +00:00
parent 316b176a57
commit 7d0556b196
2 changed files with 12 additions and 5 deletions
+5
View File
@@ -504,6 +504,11 @@ def resources_from_request_spec(ctxt, spec_obj, host_manager):
target_cell = destination.cell
if destination.aggregates:
grp = res_req.get_request_group(None)
# If the target must be either in aggA *or* in aggB and must
# definitely be in aggC, the destination.aggregates would be
# ['aggA,aggB', 'aggC']
# Here we are converting it to
# [['aggA', 'aggB'], ['aggC']]
grp.aggregates = [ored.split(',')
for ored in destination.aggregates]
+7 -5
View File
@@ -422,7 +422,8 @@ class TestUtils(test.NoDBTestCase):
def test_process_use_force_nodes(self):
fake_nodes = objects.ComputeNodeList(objects=[
objects.ComputeNode(host='fake-host',
uuid='12345678-1234-1234-1234-123456789012')])
uuid='12345678-1234-1234-1234-123456789012',
hypervisor_hostname='test')])
self.mock_host_manager.get_compute_nodes_by_host_or_node.\
return_value = fake_nodes
flavor = objects.Flavor(vcpus=1,
@@ -453,7 +454,7 @@ class TestUtils(test.NoDBTestCase):
def test_process_use_force_hosts(self):
fake_nodes = objects.ComputeNodeList(objects=[
objects.ComputeNode(host='fake-host',
objects.ComputeNode(host='test',
uuid='12345678-1234-1234-1234-123456789012')
])
self.mock_host_manager.get_compute_nodes_by_host_or_node.\
@@ -486,9 +487,9 @@ class TestUtils(test.NoDBTestCase):
def test_process_use_force_hosts_multinodes_found(self):
fake_nodes = objects.ComputeNodeList(objects=[
objects.ComputeNode(host='fake-host',
objects.ComputeNode(host='test',
uuid='12345678-1234-1234-1234-123456789012'),
objects.ComputeNode(host='fake-host',
objects.ComputeNode(host='test',
uuid='87654321-4321-4321-4321-210987654321'),
])
self.mock_host_manager.get_compute_nodes_by_host_or_node.\
@@ -527,7 +528,8 @@ class TestUtils(test.NoDBTestCase):
host='fake-host', node='fake-node', cell=fake_cell)
fake_nodes = objects.ComputeNodeList(objects=[
objects.ComputeNode(host='fake-host',
uuid='12345678-1234-1234-1234-123456789012')
uuid='12345678-1234-1234-1234-123456789012',
hypervisor_hostname='fake-node')
])
self.mock_host_manager.get_compute_nodes_by_host_or_node.\
return_value = fake_nodes