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 e34c4248af
)
This commit is contained in:
parent
886bb91156
commit
562e6119cc
|
@ -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):
|
||||
|
||||
|
|
|
@ -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')])
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue