Add pxe template per node
Allow to pass a pxe_template field in driver_info. If that is present, it will search for the template file specified there, instead of checking the per-arch/agent templates. Change-Id: I436a61ad6a3e688bc6f833f5645c99be6d7e26e7 Story: #2004525 Task: #28264
This commit is contained in:
parent
fec97d9156
commit
0bda09acf4
@ -735,19 +735,22 @@ def get_pxe_config_template(node):
|
|||||||
"""Return the PXE config template file name requested for deploy.
|
"""Return the PXE config template file name requested for deploy.
|
||||||
|
|
||||||
This method returns PXE config template file to be used for deploy.
|
This method returns PXE config template file to be used for deploy.
|
||||||
Architecture specific template file is searched first. BIOS/UEFI
|
First specific pxe template is searched in the node. After that
|
||||||
template file is used if no valid architecture specific file found.
|
architecture specific template file is searched. BIOS/UEFI template file
|
||||||
|
is used if no valid architecture specific file found.
|
||||||
|
|
||||||
:param node: A single Node.
|
:param node: A single Node.
|
||||||
:returns: The PXE config template file name.
|
:returns: The PXE config template file name.
|
||||||
"""
|
"""
|
||||||
cpu_arch = node.properties.get('cpu_arch')
|
config_template = node.driver_info.get("pxe_template", None)
|
||||||
config_template = CONF.pxe.pxe_config_template_by_arch.get(cpu_arch)
|
|
||||||
if config_template is None:
|
if config_template is None:
|
||||||
if boot_mode_utils.get_boot_mode(node) == 'uefi':
|
cpu_arch = node.properties.get('cpu_arch')
|
||||||
config_template = CONF.pxe.uefi_pxe_config_template
|
config_template = CONF.pxe.pxe_config_template_by_arch.get(cpu_arch)
|
||||||
else:
|
if config_template is None:
|
||||||
config_template = CONF.pxe.pxe_config_template
|
if boot_mode_utils.get_boot_mode(node) == 'uefi':
|
||||||
|
config_template = CONF.pxe.uefi_pxe_config_template
|
||||||
|
else:
|
||||||
|
config_template = CONF.pxe.pxe_config_template
|
||||||
|
|
||||||
return config_template
|
return config_template
|
||||||
|
|
||||||
|
@ -1113,6 +1113,14 @@ class GetPxeBootConfigTestCase(db_base.DbTestCase):
|
|||||||
result = utils.get_pxe_config_template(self.node)
|
result = utils.get_pxe_config_template(self.node)
|
||||||
self.assertEqual('bios-template', result)
|
self.assertEqual('bios-template', result)
|
||||||
|
|
||||||
|
def test_get_pxe_config_template_per_node(self):
|
||||||
|
node = obj_utils.create_test_node(
|
||||||
|
self.context, driver='fake-hardware',
|
||||||
|
driver_info={"pxe_template": "fake-template"},
|
||||||
|
)
|
||||||
|
result = utils.get_pxe_config_template(node)
|
||||||
|
self.assertEqual('fake-template', result)
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('time.sleep', lambda sec: None)
|
@mock.patch('time.sleep', lambda sec: None)
|
||||||
class OtherFunctionTestCase(db_base.DbTestCase):
|
class OtherFunctionTestCase(db_base.DbTestCase):
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add a new field pxe_template that can be set at driver-info level. This
|
||||||
|
will specify a path for a custom pxe boot template. If present, this
|
||||||
|
template will be read and will have priority in front of the per-arch and
|
||||||
|
general pxe templates.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user