summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/common
diff options
context:
space:
mode:
authorHarald Jensås <hjensas@redhat.com>2022-01-07 13:16:09 +0100
committerHarald Jensås <hjensas@redhat.com>2022-01-12 00:45:08 +0000
commit9a7bc058218ea01008e2632303b092701c73d327 (patch)
tree97ebef2d3b2423e91282aa576cc3c7678dd95e3a /ironic/tests/unit/common
parentff375734b13cc37308c6ab0c9bfd1ead210f5d67 (diff)
downloadironic-9a7bc058218ea01008e2632303b092701c73d327.tar.gz
Ensure 'port' is up2date after binding:host_id
On neutron routed provider networks IP allocation is deferred until 'binding:host_id' is set. When ironic creates neutron ports it first creates the port, then updates the port setting binding information. When using IPv6 networking ironic adds additional address allocations to ensure network chain-booting will succeed. When address allocation is deferred on port create ironic cannot detect that IPv6 is used and does not add the required additional addresses. This change ensures the 'port' object is updated after the port update setting the port binding required for neutron to allocate the address. This allows ironic to correctly detect IPv6 is used, and it will add the required IP address allocations. Story: 2009773 Task: 44254 Change-Id: I863dd4ab9615a9ce3b3dcb8798af674ac9966bf2 (cherry picked from commit 3404dc913e0a0a595c3696454b878b716833d612)
Diffstat (limited to 'ironic/tests/unit/common')
-rw-r--r--ironic/tests/unit/common/test_neutron.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index 900049df6..7dc67ab32 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -290,11 +290,13 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
fixed_ips=[])
self.client_mock.create_port.side_effect = [self.neutron_port,
neutron_port2]
+ update_mock.side_effect = [self.neutron_port, neutron_port2]
expected = {port.uuid: self.neutron_port.id,
port2.uuid: neutron_port2.id}
else:
self.client_mock.create_port.return_value = self.neutron_port
+ update_mock.return_value = self.neutron_port
expected = {port.uuid: self.neutron_port['id']}
with task_manager.acquire(self.context, self.node.uuid) as task:
@@ -458,6 +460,7 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
vpi_mock.return_value = True
# Ensure we can create ports
self.client_mock.create_port.return_value = self.neutron_port
+ update_mock.return_value = self.neutron_port
expected = {port.uuid: self.neutron_port.id}
with task_manager.acquire(self.context, self.node.uuid) as task:
ports = neutron.add_ports_to_network(task, self.network_uuid)
@@ -492,6 +495,7 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
)
self.client_mock.create_port.side_effect = [
self.neutron_port, openstack_exc.OpenStackCloudException]
+ update_mock.return_value = self.neutron_port
with task_manager.acquire(self.context, self.node.uuid) as task:
neutron.add_ports_to_network(task, self.network_uuid)
self.assertIn("Could not create neutron port for node's",
@@ -999,6 +1003,7 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
# Ensure we can create ports
self.client_mock.create_port.return_value = self.neutron_port
+ update_mock.return_value = self.neutron_port
expected = {port.uuid: self.neutron_port.id}
with task_manager.acquire(self.context, self.node.uuid) as task:
ports = neutron.add_ports_to_network(task, self.network_uuid)