summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/pxe.py
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2018-02-01 09:00:16 -0500
committerJim Rollenhagen <jim@jimrollenhagen.com>2018-02-01 15:40:50 +0000
commit954a23482082f3dcfb57cfbb71e5d61f05c7fbce (patch)
treeae3a2375d07a8622d556bb0cede0cd2ba9b4d0bc /ironic/drivers/modules/pxe.py
parentd4e35611c4be8aba07907e57e684c10219af7f9c (diff)
downloadironic-954a23482082f3dcfb57cfbb71e5d61f05c7fbce.tar.gz
Remove mode argument from boot.(prepare|clean_up)_ramdisk
Ideally, the boot interface shouldn't care if it's booting an image for deploy or rescue. The first step to unwinding this is not passing the mode argument into the boot interface - for now, we infer it from the state. Also stop validating whether the boot interface methods have a mode argument, as this is totally broken anyway (due to the decorator on the method). The rest of the boot interface's knowledge about deploy vs rescue can be eliminated in the future, as we shouldn't rework too much of that during feature freeze. We fix the bug in validation this way for now, for two reasons: * This argument really doesn't belong, and it's only been on master for six days. Get it out before people use it. * Library updates are currently frozen; fixing the decorator isn't an option right now. Change-Id: Icdeb870e9fd9cf836ff7ab97624189c8436adaba Closes-Bug: #1746730
Diffstat (limited to 'ironic/drivers/modules/pxe.py')
-rw-r--r--ironic/drivers/modules/pxe.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py
index 8a820a6ea..c43558377 100644
--- a/ironic/drivers/modules/pxe.py
+++ b/ironic/drivers/modules/pxe.py
@@ -234,8 +234,7 @@ def _build_pxe_config_options(task, pxe_info, service=False):
template.
"""
node = task.node
- mode = ('rescue' if node.provision_state in deploy_utils.RESCUE_LIKE_STATES
- else 'deploy')
+ mode = deploy_utils.rescue_or_deploy_mode(node)
if service:
pxe_options = {}
elif (node.driver_internal_info.get('boot_from_volume') and
@@ -469,7 +468,7 @@ class PXEBoot(base.BootInterface):
deploy_utils.validate_image_properties(task.context, d_info, props)
@METRICS.timer('PXEBoot.prepare_ramdisk')
- def prepare_ramdisk(self, task, ramdisk_params, mode='deploy'):
+ def prepare_ramdisk(self, task, ramdisk_params):
"""Prepares the boot of Ironic ramdisk using PXE.
This method prepares the boot of the deploy or rescue kernel/ramdisk
@@ -493,6 +492,7 @@ class PXEBoot(base.BootInterface):
operation failed on the node.
"""
node = task.node
+ mode = deploy_utils.rescue_or_deploy_mode(node)
if CONF.pxe.ipxe_enabled:
# NOTE(mjturek): At this point, the ipxe boot script should
@@ -536,7 +536,7 @@ class PXEBoot(base.BootInterface):
_cache_ramdisk_kernel(task.context, node, pxe_info)
@METRICS.timer('PXEBoot.clean_up_ramdisk')
- def clean_up_ramdisk(self, task, mode='deploy'):
+ def clean_up_ramdisk(self, task):
"""Cleans up the boot of ironic ramdisk.
This method cleans up the PXE environment that was setup for booting
@@ -552,6 +552,7 @@ class PXEBoot(base.BootInterface):
:returns: None
"""
node = task.node
+ mode = deploy_utils.rescue_or_deploy_mode(node)
try:
images_info = _get_image_info(node, mode=mode)
except exception.MissingParameterValue as e: