Merge "Pass correct flags during PXE cleanup in iPXEBoot"
This commit is contained in:
commit
631294442f
@ -43,6 +43,8 @@ COMMON_PROPERTIES = pxe_base.COMMON_PROPERTIES
|
|||||||
|
|
||||||
class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
|
class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
|
||||||
|
|
||||||
|
ipxe_enabled = True
|
||||||
|
|
||||||
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot']
|
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot']
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -303,4 +305,4 @@ class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
|
|||||||
'to clean up images for node %(node)s: %(err)s',
|
'to clean up images for node %(node)s: %(err)s',
|
||||||
{'node': node.uuid, 'err': e})
|
{'node': node.uuid, 'err': e})
|
||||||
else:
|
else:
|
||||||
pxe_utils.clean_up_pxe_env(task, images_info)
|
pxe_utils.clean_up_pxe_env(task, images_info, ipxe_enabled=True)
|
||||||
|
@ -67,6 +67,8 @@ COMMON_PROPERTIES.update(RESCUE_PROPERTIES)
|
|||||||
|
|
||||||
class PXEBaseMixin(object):
|
class PXEBaseMixin(object):
|
||||||
|
|
||||||
|
ipxe_enabled = False
|
||||||
|
|
||||||
def get_properties(self):
|
def get_properties(self):
|
||||||
"""Return the properties of the interface.
|
"""Return the properties of the interface.
|
||||||
|
|
||||||
@ -93,13 +95,15 @@ class PXEBaseMixin(object):
|
|||||||
node = task.node
|
node = task.node
|
||||||
mode = deploy_utils.rescue_or_deploy_mode(node)
|
mode = deploy_utils.rescue_or_deploy_mode(node)
|
||||||
try:
|
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:
|
except exception.MissingParameterValue as e:
|
||||||
LOG.warning('Could not get %(mode)s image info '
|
LOG.warning('Could not get %(mode)s image info '
|
||||||
'to clean up images for node %(node)s: %(err)s',
|
'to clean up images for node %(node)s: %(err)s',
|
||||||
{'mode': mode, 'node': node.uuid, 'err': e})
|
{'mode': mode, 'node': node.uuid, 'err': e})
|
||||||
else:
|
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')
|
@METRICS.timer('PXEBaseMixin.validate_rescue')
|
||||||
def validate_rescue(self, task):
|
def validate_rescue(self, task):
|
||||||
|
@ -589,8 +589,10 @@ class iPXEBootTestCase(db_base.DbTestCase):
|
|||||||
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
|
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
|
||||||
get_image_info_mock.return_value = image_info
|
get_image_info_mock.return_value = image_info
|
||||||
task.driver.boot.clean_up_ramdisk(task)
|
task.driver.boot.clean_up_ramdisk(task)
|
||||||
clean_up_pxe_env_mock.assert_called_once_with(task, image_info)
|
clean_up_pxe_env_mock.assert_called_once_with(
|
||||||
get_image_info_mock.assert_called_once_with(task.node, mode=mode)
|
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):
|
def test_clean_up_ramdisk(self):
|
||||||
self.node.provision_state = states.DEPLOYING
|
self.node.provision_state = states.DEPLOYING
|
||||||
@ -834,7 +836,8 @@ class iPXEBootTestCase(db_base.DbTestCase):
|
|||||||
'ramdisk': ['', '/path/to/ramdisk']}
|
'ramdisk': ['', '/path/to/ramdisk']}
|
||||||
get_image_info_mock.return_value = image_info
|
get_image_info_mock.return_value = image_info
|
||||||
task.driver.boot.clean_up_instance(task)
|
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(
|
get_image_info_mock.assert_called_once_with(
|
||||||
task, ipxe_enabled=True)
|
task, ipxe_enabled=True)
|
||||||
|
|
||||||
|
@ -1266,8 +1266,8 @@ class CleanUpFullFlowTestCase(db_base.DbTestCase):
|
|||||||
shared=True) as task:
|
shared=True) as task:
|
||||||
task.driver.deploy.clean_up(task)
|
task.driver.deploy.clean_up(task)
|
||||||
mock_get_instance_image_info.assert_called_with(task)
|
mock_get_instance_image_info.assert_called_with(task)
|
||||||
mock_get_deploy_image_info.assert_called_with(task.node,
|
mock_get_deploy_image_info.assert_called_with(
|
||||||
mode='deploy')
|
task.node, mode='deploy', ipxe_enabled=False)
|
||||||
set_dhcp_provider_mock.assert_called_once_with()
|
set_dhcp_provider_mock.assert_called_once_with()
|
||||||
clean_dhcp_mock.assert_called_once_with(task)
|
clean_dhcp_mock.assert_called_once_with(task)
|
||||||
for path in ([self.kernel_path, self.image_path, self.config_path]
|
for path in ([self.kernel_path, self.image_path, self.config_path]
|
||||||
|
@ -591,8 +591,10 @@ class PXEBootTestCase(db_base.DbTestCase):
|
|||||||
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
|
ramdisk_label: ['', '/path/to/' + ramdisk_label]}
|
||||||
get_image_info_mock.return_value = image_info
|
get_image_info_mock.return_value = image_info
|
||||||
task.driver.boot.clean_up_ramdisk(task)
|
task.driver.boot.clean_up_ramdisk(task)
|
||||||
clean_up_pxe_env_mock.assert_called_once_with(task, image_info)
|
clean_up_pxe_env_mock.assert_called_once_with(
|
||||||
get_image_info_mock.assert_called_once_with(task.node, mode=mode)
|
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):
|
def test_clean_up_ramdisk(self):
|
||||||
self.node.provision_state = states.DEPLOYING
|
self.node.provision_state = states.DEPLOYING
|
||||||
|
5
releasenotes/notes/cleanup-ipxe-f1349e2ac9ec2825.yaml
Normal file
5
releasenotes/notes/cleanup-ipxe-f1349e2ac9ec2825.yaml
Normal 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.
|
Loading…
x
Reference in New Issue
Block a user