metalsmith_instances module, pass hostname in reserve
The allocation name/hostname is set during the provision step, but it is also possible to set it during the reserve step, which is done in this change. Setting the name during reservation is more correct, and triggers some extra sanity checks during provision. But it also enables this change[1] which attempts to reserve the node with the same name as the allocation. [1] https://review.opendev.org/c/openstack/ironic/+/845856 Change-Id: I0da4644a955b8e9fbf509c074b939b97c64739cb
This commit is contained in:
parent
cf6b37ab22
commit
e6568a02bd
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user