summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/pxe.py
diff options
context:
space:
mode:
authorArne Wiebalck <Arne.Wiebalck@cern.ch>2019-01-23 17:19:55 +0100
committerArne Wiebalck <Arne.Wiebalck@cern.ch>2019-02-07 22:51:56 +0100
commit206134cf58266859fc7b21cd76831955cad72b56 (patch)
treee9878e8d5b614eaf010e22b7d0da7ebc313ab884 /ironic/drivers/modules/pxe.py
parent69baaca23d63ba5df959aa8337f30643ad807573 (diff)
downloadironic-206134cf58266859fc7b21cd76831955cad72b56.tar.gz
Optionally preserve original system boot order upon instance deployment
By default, Ironic makes persistent changes to the system boot order at the end of an instance deployment. This may not be desired in all cases, e.g. when DC policies require to leave the persistent system boot order unchanged. While keeping the persistent approach as the default, this patch proposes to extent the existing 'force_persistent_boot_device' field in the node's driver_info for (i)PXE in a way that allows to have all boot device changes to be non-persistent. Change-Id: If3a19f74fb0dfbcff2cde4cd5a8cc1edf5de3058 Story: #2004846 Task: #29058
Diffstat (limited to 'ironic/drivers/modules/pxe.py')
-rw-r--r--ironic/drivers/modules/pxe.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py
index 4ee5c35b2..d4b0bce8e 100644
--- a/ironic/drivers/modules/pxe.py
+++ b/ironic/drivers/modules/pxe.py
@@ -172,9 +172,15 @@ class PXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
pxe_utils.create_pxe_config(task, pxe_options,
pxe_config_template,
ipxe_enabled=CONF.pxe.ipxe_enabled)
- persistent = strutils.bool_from_string(
- node.driver_info.get('force_persistent_boot_device',
- False))
+
+ persistent = False
+ value = node.driver_info.get('force_persistent_boot_device',
+ 'Default')
+ if value in {'Always', 'Default', 'Never'}:
+ if value == 'Always':
+ persistent = True
+ else:
+ persistent = strutils.bool_from_string(value, False)
manager_utils.node_set_boot_device(task, boot_devices.PXE,
persistent=persistent)
@@ -274,8 +280,12 @@ class PXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
# NOTE(pas-ha) do not re-set boot device on ACTIVE nodes
# during takeover
if boot_device and task.node.provision_state != states.ACTIVE:
+ persistent = True
+ if node.driver_info.get('force_persistent_boot_device',
+ 'Default') == 'Never':
+ persistent = False
manager_utils.node_set_boot_device(task, boot_device,
- persistent=True)
+ persistent=persistent)
@METRICS.timer('PXEBoot.clean_up_instance')
def clean_up_instance(self, task):