summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNisha Agarwal <agarwalnisha1980@gmail.com>2015-10-07 10:27:41 -0700
committerNisha Agarwal <agarwalnisha1980@gmail.com>2015-10-14 23:18:02 -0700
commit562e6119cc58e98d1bc71d096e18982f39004bcd (patch)
treeae3576e26d54d5ca9202519784aa39d2234aed6a
parent886bb91156556589d4d5a36dd969d0133831b1dc (diff)
downloadironic-562e6119cc58e98d1bc71d096e18982f39004bcd.tar.gz
Fix agent_ilo to remove temporary images
agent_ilo driver doesn't cleanup the temporary files created. This commit makes sure that the temporary files are cleaned up before the server goes for second boot. Closes-bug: #1503795 Change-Id: I6cce1d1f3a5631e1af992c173379927fed3c55a1 (cherry picked from commit e34c4248af5f453a776af8b3933c5d7ece1c7b9c)
-rw-r--r--ironic/drivers/modules/ilo/deploy.py6
-rw-r--r--ironic/tests/drivers/ilo/test_common.py1
-rw-r--r--ironic/tests/drivers/ilo/test_deploy.py15
3 files changed, 21 insertions, 1 deletions
diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py
index 388ca6e07..788dff201 100644
--- a/ironic/drivers/modules/ilo/deploy.py
+++ b/ironic/drivers/modules/ilo/deploy.py
@@ -731,6 +731,12 @@ class IloVirtualMediaAgentVendorInterface(agent.AgentVendorInterface):
super(IloVirtualMediaAgentVendorInterface,
self).reboot_to_instance(task, **kwargs)
+ @task_manager.require_exclusive_lock
+ def continue_deploy(self, task, **kwargs):
+ ilo_common.cleanup_vmedia_boot(task)
+ super(IloVirtualMediaAgentVendorInterface,
+ self).continue_deploy(task, **kwargs)
+
class IloPXEDeploy(iscsi_deploy.ISCSIDeploy):
diff --git a/ironic/tests/drivers/ilo/test_common.py b/ironic/tests/drivers/ilo/test_common.py
index 5040a377d..a9a85e4e4 100644
--- a/ironic/tests/drivers/ilo/test_common.py
+++ b/ironic/tests/drivers/ilo/test_common.py
@@ -504,7 +504,6 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
ilo_common.eject_vmedia_devices(task)
-
ilo_object_mock.eject_virtual_media.assert_has_calls(
[mock.call('FLOPPY'), mock.call('CDROM')])
diff --git a/ironic/tests/drivers/ilo/test_deploy.py b/ironic/tests/drivers/ilo/test_deploy.py
index df886cd09..5f761a98e 100644
--- a/ironic/tests/drivers/ilo/test_deploy.py
+++ b/ironic/tests/drivers/ilo/test_deploy.py
@@ -1858,3 +1858,18 @@ class IloVirtualMediaAgentVendorInterfaceTestCase(db_base.DbTestCase):
self.assertFalse(func_update_secure_boot_mode.called)
agent_reboot_to_instance_mock.assert_called_once_with(
mock.ANY, task, **kwargs)
+
+ @mock.patch.object(ilo_common, 'cleanup_vmedia_boot',
+ spec_set=True, autospec=True)
+ @mock.patch.object(agent.AgentVendorInterface, 'continue_deploy',
+ spec_set=True, autospec=True)
+ def test_continue_deploy(self, agent_continue_deploy_mock,
+ cleanup_mock):
+ CONF.ilo.use_web_server_for_images = True
+ kwargs = {'address': '123456'}
+ with task_manager.acquire(self.context, self.node.uuid,
+ shared=False) as task:
+ task.driver.vendor.continue_deploy(task, **kwargs)
+ cleanup_mock.assert_called_once_with(task)
+ agent_continue_deploy_mock.assert_called_once_with(
+ mock.ANY, task, **kwargs)