Call clean_up_instance() during node teardown for Agent deploy

Agent based deploy do not call boot.clean_up_instance() during node
teardown. This is required so that instance clean up can happen as
part of node teardown.

Change-Id: I6077b69f17ce462b6aae1b16fdb40158cf111c5e
Closes-Bug: #1676321
This commit is contained in:
Shivanand Tendulker 2017-03-27 06:15:02 -04:00
parent 8aec5fb6a5
commit ef9300cb59
3 changed files with 14 additions and 1 deletions

View File

@ -459,6 +459,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
"""
if CONF.agent.manage_agent_boot:
task.driver.boot.clean_up_ramdisk(task)
task.driver.boot.clean_up_instance(task)
provider = dhcp_factory.DHCPFactory()
provider.clean_dhcp(task)

View File

@ -374,20 +374,25 @@ class TestAgentDeploy(db_base.DbTestCase):
@mock.patch('ironic.common.dhcp_factory.DHCPFactory._set_dhcp_provider')
@mock.patch('ironic.common.dhcp_factory.DHCPFactory.clean_dhcp')
@mock.patch.object(pxe.PXEBoot, 'clean_up_instance')
@mock.patch.object(pxe.PXEBoot, 'clean_up_ramdisk')
def test_clean_up(self, pxe_clean_up_ramdisk_mock, clean_dhcp_mock,
def test_clean_up(self, pxe_clean_up_ramdisk_mock,
pxe_clean_up_instance_mock, clean_dhcp_mock,
set_dhcp_provider_mock):
with task_manager.acquire(
self.context, self.node['uuid'], shared=False) as task:
self.driver.clean_up(task)
pxe_clean_up_ramdisk_mock.assert_called_once_with(task)
pxe_clean_up_instance_mock.assert_called_once_with(task)
set_dhcp_provider_mock.assert_called_once_with()
clean_dhcp_mock.assert_called_once_with(task)
@mock.patch('ironic.common.dhcp_factory.DHCPFactory._set_dhcp_provider')
@mock.patch('ironic.common.dhcp_factory.DHCPFactory.clean_dhcp')
@mock.patch.object(pxe.PXEBoot, 'clean_up_instance')
@mock.patch.object(pxe.PXEBoot, 'clean_up_ramdisk')
def test_clean_up_manage_agent_boot_false(self, pxe_clean_up_ramdisk_mock,
pxe_clean_up_instance_mock,
clean_dhcp_mock,
set_dhcp_provider_mock):
with task_manager.acquire(
@ -395,6 +400,7 @@ class TestAgentDeploy(db_base.DbTestCase):
self.config(group='agent', manage_agent_boot=False)
self.driver.clean_up(task)
self.assertFalse(pxe_clean_up_ramdisk_mock.called)
pxe_clean_up_instance_mock.assert_called_once_with(task)
set_dhcp_provider_mock.assert_called_once_with()
clean_dhcp_mock.assert_called_once_with(task)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue wherein agent based deploy do not call
clean up the instance related configurations done on
the Ironic node.