Merge "metalsmith_instances module, pass hostname in reserve"

This commit is contained in:
Zuul 2022-06-24 00:34:46 +00:00 committed by Gerrit Code Review
commit c79aaef1b6
2 changed files with 4 additions and 0 deletions

View File

@ -55,6 +55,7 @@ class TestMetalsmithInstances(unittest.TestCase):
def test_reserve(self):
provisioner = mock.Mock()
instances = [{
'hostname': 'node-1',
'name': 'node',
'candidates': ['other_node'],
'resource_class': 'boxen',
@ -73,6 +74,7 @@ class TestMetalsmithInstances(unittest.TestCase):
result = mi.reserve(provisioner, instances, True)
provisioner.reserve_node.assert_has_calls([
mock.call(
hostname='node-1',
candidates=['other_node', 'node'],
capabilities={'foo': 'bar'},
conductor_group='group',
@ -80,6 +82,7 @@ class TestMetalsmithInstances(unittest.TestCase):
traits=['this', 'that']
),
mock.call(
hostname=None,
candidates=None,
capabilities=None,
conductor_group=None,

View File

@ -268,6 +268,7 @@ def reserve(provisioner, instances, clean_up):
candidates = None
try:
node = provisioner.reserve_node(
hostname=instance.get('hostname'),
resource_class=instance.get('resource_class', 'baremetal'),
capabilities=instance.get('capabilities'),
candidates=candidates,