Merge "Set physical_network on baremetal nodes"

This commit is contained in:
Zuul 2018-02-12 19:40:42 +00:00 committed by Gerrit Code Review
commit 9e8b61395e
4 changed files with 12 additions and 9 deletions

View File

@ -72,7 +72,7 @@ class TripleOAction(actions.Action):
ironic_endpoint.url,
token=context.auth_token,
region_name=ironic_endpoint.region,
os_ironic_api_version='1.33',
os_ironic_api_version='1.36',
# FIXME(lucasagomes):Paramtetize max_retries and
# max_interval. At the moment since we are dealing with
# a critical bug (#1612622) let's just hardcode the times

View File

@ -39,7 +39,7 @@ class TestActionsBase(tests_base.TestCase):
url='http://ironic/v1', region='ironic-region')
self.action.get_baremetal_client(mock_cxt)
mock_client.assert_called_once_with(
'http://ironic/v1', max_retries=12, os_ironic_api_version='1.33',
'http://ironic/v1', max_retries=12, os_ironic_api_version='1.36',
region_name='ironic-region', retry_interval=5, token=mock.ANY)
mock_endpoint.assert_called_once_with(mock_cxt, 'ironic')
mock_cxt.assert_not_called()

View File

@ -287,7 +287,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
properties=node_properties)
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])
@ -311,7 +311,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
properties=node_properties)
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])
@ -341,7 +341,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
properties=node_properties)
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])
@ -365,7 +365,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
uuid="abcdef")
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])
@ -390,7 +390,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
properties=node_properties)
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])
@ -425,7 +425,7 @@ class NodesTest(base.TestCase):
resource_class='baremetal',
**interfaces)
port_call = mock.call(node_uuid=ironic.node.create.return_value.uuid,
address='aaa')
address='aaa', physical_network='ctlplane')
ironic.node.create.assert_has_calls([pxe_node, mock.ANY])
ironic.port.create.assert_has_calls([port_call])

View File

@ -31,6 +31,8 @@ _KNOWN_INTERFACE_FIELDS = [
'power', 'raid', 'storage', 'vendor')
]
CTLPLANE_NETWORK = 'ctlplane'
class DriverInfo(object):
"""Class encapsulating field conversion logic."""
@ -355,7 +357,8 @@ def register_ironic_node(node, client):
ironic_node = client.node.create(**create_map)
for mac in node.get("mac", []):
client.port.create(address=mac, node_uuid=ironic_node.uuid)
client.port.create(address=mac, physical_network=CTLPLANE_NETWORK,
node_uuid=ironic_node.uuid)
validation = client.node.validate(ironic_node.uuid)
if not validation.power['result']: