Merge "Add pxe template per node"
This commit is contained in:
commit
2dacda772b
@ -735,12 +735,15 @@ def get_pxe_config_template(node):
|
||||
"""Return the PXE config template file name requested for deploy.
|
||||
|
||||
This method returns PXE config template file to be used for deploy.
|
||||
Architecture specific template file is searched first. BIOS/UEFI
|
||||
template file is used if no valid architecture specific file found.
|
||||
First specific pxe template is searched in the node. After that
|
||||
architecture specific template file is searched. BIOS/UEFI template file
|
||||
is used if no valid architecture specific file found.
|
||||
|
||||
:param node: A single Node.
|
||||
:returns: The PXE config template file name.
|
||||
"""
|
||||
config_template = node.driver_info.get("pxe_template", None)
|
||||
if config_template is None:
|
||||
cpu_arch = node.properties.get('cpu_arch')
|
||||
config_template = CONF.pxe.pxe_config_template_by_arch.get(cpu_arch)
|
||||
if config_template is None:
|
||||
|
@ -1113,6 +1113,14 @@ class GetPxeBootConfigTestCase(db_base.DbTestCase):
|
||||
result = utils.get_pxe_config_template(self.node)
|
||||
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)
|
||||
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