Merge "Pass correct flags during PXE cleanup in iPXEBoot"

This commit is contained in:
Zuul 2019-11-20 11:26:46 +00:00 committed by Gerrit Code Review
commit 631294442f
6 changed files with 26 additions and 10 deletions

View File

@ -43,6 +43,8 @@ COMMON_PROPERTIES = pxe_base.COMMON_PROPERTIES
class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
ipxe_enabled = True
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot']
def __init__(self):
@ -303,4 +305,4 @@ class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
'to clean up images for node %(node)s: %(err)s',
{'node': node.uuid, 'err': e})
else:
pxe_utils.clean_up_pxe_env(task, images_info)
pxe_utils.clean_up_pxe_env(task, images_info, ipxe_enabled=True)

View File

@ -67,6 +67,8 @@ COMMON_PROPERTIES.update(RESCUE_PROPERTIES)
class PXEBaseMixin(object):
ipxe_enabled = False
def get_properties(self):
"""Return the properties of the interface.
@ -93,13 +95,15 @@ class PXEBaseMixin(object):
node = task.node
mode = deploy_utils.rescue_or_deploy_mode(node)
try:
images_info = pxe_utils.get_image_info(node, mode=mode)
images_info = pxe_utils.get_image_info(
node, mode=mode, ipxe_enabled=self.ipxe_enabled)
except exception.MissingParameterValue as e:
LOG.warning('Could not get %(mode)s image info '
'to clean up images for node %(node)s: %(err)s',
{'mode': mode, 'node': node.uuid, 'err': e})
else:
pxe_utils.clean_up_pxe_env(task, images_info)
pxe_utils.clean_up_pxe_env(
task, images_info, ipxe_enabled=self.ipxe_enabled)
@METRICS.timer('PXEBaseMixin.validate_rescue')
def validate_rescue(self, task):

View File

@ -589,8 +589,10 @@ class iPXEBootTestCase(db_base.DbTestCase):
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
get_image_info_mock.return_value = image_info
task.driver.boot.clean_up_ramdisk(task)
clean_up_pxe_env_mock.assert_called_once_with(task, image_info)
get_image_info_mock.assert_called_once_with(task.node, mode=mode)
clean_up_pxe_env_mock.assert_called_once_with(
task, image_info, ipxe_enabled=True)
get_image_info_mock.assert_called_once_with(
task.node, mode=mode, ipxe_enabled=True)
def test_clean_up_ramdisk(self):
self.node.provision_state = states.DEPLOYING
@ -834,7 +836,8 @@ class iPXEBootTestCase(db_base.DbTestCase):
'ramdisk': ['', '/path/to/ramdisk']}
get_image_info_mock.return_value = image_info
task.driver.boot.clean_up_instance(task)
clean_up_pxe_env_mock.assert_called_once_with(task, image_info)
clean_up_pxe_env_mock.assert_called_once_with(
task, image_info, ipxe_enabled=True)
get_image_info_mock.assert_called_once_with(
task, ipxe_enabled=True)

View File

@ -1266,8 +1266,8 @@ class CleanUpFullFlowTestCase(db_base.DbTestCase):
shared=True) as task:
task.driver.deploy.clean_up(task)
mock_get_instance_image_info.assert_called_with(task)
mock_get_deploy_image_info.assert_called_with(task.node,
mode='deploy')
mock_get_deploy_image_info.assert_called_with(
task.node, mode='deploy', ipxe_enabled=False)
set_dhcp_provider_mock.assert_called_once_with()
clean_dhcp_mock.assert_called_once_with(task)
for path in ([self.kernel_path, self.image_path, self.config_path]

View File

@ -591,8 +591,10 @@ class PXEBootTestCase(db_base.DbTestCase):
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
get_image_info_mock.return_value = image_info
task.driver.boot.clean_up_ramdisk(task)
clean_up_pxe_env_mock.assert_called_once_with(task, image_info)
get_image_info_mock.assert_called_once_with(task.node, mode=mode)
clean_up_pxe_env_mock.assert_called_once_with(
task, image_info, ipxe_enabled=False)
get_image_info_mock.assert_called_once_with(
task.node, mode=mode, ipxe_enabled=False)
def test_clean_up_ramdisk(self):
self.node.provision_state = states.DEPLOYING

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Now passing proper flags during clean up of iPXE boot environments,
so that no leftovers are left after node tear down.