Unbind tenant ports before rebuild
Currently, during rebuild, tenant ports are bound to tenant network when we call add_provisioning_network. We need to unbind them first. Closes-Bug: #1657083 Change-Id: I475a089ee646872f7874c3d257c1dc571ea94f4d
This commit is contained in:
parent
2b6ff862c1
commit
c6abd51159
@ -425,6 +425,9 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
||||
# Adding the node to provisioning network so that the dhcp
|
||||
# options get added for the provisioning port.
|
||||
manager_utils.node_power_action(task, states.POWER_OFF)
|
||||
# NOTE(vdrok): in case of rebuild, we have tenant network already
|
||||
# configured, unbind tenant ports if present
|
||||
task.driver.network.unconfigure_tenant_networks(task)
|
||||
task.driver.network.add_provisioning_network(task)
|
||||
if node.provision_state == states.ACTIVE:
|
||||
task.driver.boot.prepare_instance(task)
|
||||
|
@ -497,6 +497,9 @@ class ISCSIDeploy(AgentDeployMixin, base.DeployInterface):
|
||||
# Adding the node to provisioning network so that the dhcp
|
||||
# options get added for the provisioning port.
|
||||
manager_utils.node_power_action(task, states.POWER_OFF)
|
||||
# NOTE(vdrok): in case of rebuild, we have tenant network
|
||||
# already configured, unbind tenant ports if present
|
||||
task.driver.network.unconfigure_tenant_networks(task)
|
||||
task.driver.network.add_provisioning_network(task)
|
||||
|
||||
deploy_opts = deploy_utils.build_agent_options(node)
|
||||
|
@ -286,8 +286,12 @@ class TestAgentDeploy(db_base.DbTestCase):
|
||||
@mock.patch.object(deploy_utils, 'build_instance_info_for_deploy')
|
||||
@mock.patch('ironic.drivers.modules.network.flat.FlatNetwork.'
|
||||
'add_provisioning_network', autospec=True)
|
||||
def test_prepare(self, add_provisioning_net_mock, build_instance_info_mock,
|
||||
build_options_mock, pxe_prepare_ramdisk_mock):
|
||||
@mock.patch('ironic.drivers.modules.network.flat.FlatNetwork.'
|
||||
'unconfigure_tenant_networks', spec_set=True, autospec=True)
|
||||
def test_prepare(
|
||||
self, unconfigure_tenant_net_mock, add_provisioning_net_mock,
|
||||
build_instance_info_mock, build_options_mock,
|
||||
pxe_prepare_ramdisk_mock):
|
||||
with task_manager.acquire(
|
||||
self.context, self.node['uuid'], shared=False) as task:
|
||||
task.node.provision_state = states.DEPLOYING
|
||||
@ -301,6 +305,7 @@ class TestAgentDeploy(db_base.DbTestCase):
|
||||
pxe_prepare_ramdisk_mock.assert_called_once_with(
|
||||
task, {'a': 'b'})
|
||||
add_provisioning_net_mock.assert_called_once_with(mock.ANY, task)
|
||||
unconfigure_tenant_net_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
self.node.refresh()
|
||||
self.assertEqual('bar', self.node.instance_info['foo'])
|
||||
|
@ -594,9 +594,11 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
|
||||
@mock.patch.object(pxe.PXEBoot, 'prepare_ramdisk', autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.network.flat.FlatNetwork.'
|
||||
'add_provisioning_network', spec_set=True, autospec=True)
|
||||
def test_prepare_node_deploying(self, add_provisioning_net_mock,
|
||||
mock_prepare_ramdisk,
|
||||
mock_agent_options):
|
||||
@mock.patch('ironic.drivers.modules.network.flat.FlatNetwork.'
|
||||
'unconfigure_tenant_networks', spec_set=True, autospec=True)
|
||||
def test_prepare_node_deploying(
|
||||
self, unconfigure_tenant_net_mock, add_provisioning_net_mock,
|
||||
mock_prepare_ramdisk, mock_agent_options):
|
||||
mock_agent_options.return_value = {'c': 'd'}
|
||||
with task_manager.acquire(self.context, self.node.uuid) as task:
|
||||
task.node.provision_state = states.DEPLOYING
|
||||
@ -607,6 +609,7 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
|
||||
mock_prepare_ramdisk.assert_called_once_with(
|
||||
task.driver.boot, task, {'c': 'd'})
|
||||
add_provisioning_net_mock.assert_called_once_with(mock.ANY, task)
|
||||
unconfigure_tenant_net_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
@mock.patch.object(manager_utils, 'node_power_action', autospec=True)
|
||||
@mock.patch.object(iscsi_deploy, 'check_image_size', autospec=True)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue with node rebuild, when tenant network ports were not
|
||||
unbound prior to moving the node to provisioning network.
|
Loading…
Reference in New Issue
Block a user