From 054825834ad23450af9d1ae83bdbbe3dc059ac7c Mon Sep 17 00:00:00 2001 From: Shivanand Tendulker Date: Wed, 8 Apr 2015 09:28:13 -0700 Subject: Nit fixes for boot_mode being overwritten This is follow-up patch addressing the comments that were given as part of review I9b6cf288b34707a8a1d5d99a95f2bc9f6bf380f1 Change-Id: Ifeb1581a6391c00f55af0068c99e141b80948cfa --- ironic/drivers/modules/deploy_utils.py | 19 +++++++++---------- ironic/drivers/modules/ilo/common.py | 2 +- ironic/drivers/modules/ilo/deploy.py | 4 ++-- ironic/drivers/modules/iscsi_deploy.py | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 79fcaecd3..e6c2c48ef 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -1046,24 +1046,22 @@ def is_secure_boot_requested(node): def get_boot_mode_for_deploy(node): """Returns the boot mode that would be used for deploy. - This method returns boot mode to used for deploy using following order: + This method returns boot mode to be used for deploy. It returns 'uefi' if 'secure_boot' is set to 'true' in 'instance_info/capabilities' of node. - It returns value of 'boot_mode' in 'properties/capabilities' of node. - It returns boot mode specified in 'instance_info/deploy_boot_mode' of - node. + Otherwise it returns value of 'boot_mode' in 'properties/capabilities' + of node if set. If that is not set, it returns boot mode in + 'instance_info/deploy_boot_mode' for the node. It would return None if boot mode is present neither in 'capabilities' of - node 'properties' nor in node's 'instance_info'. + node 'properties' nor in node's 'instance_info' (which could also be None). :param node: an ironic node object. :returns: 'bios', 'uefi' or None """ if is_secure_boot_requested(node): - boot_mode = 'uefi' - LOG.debug('Deploy boot mode is %(boot_mode)s for %(node)s.', - {'boot_mode': boot_mode, 'node': node.uuid}) - return boot_mode + LOG.debug('Deploy boot mode is uefi for %s.', node.uuid) + return 'uefi' boot_mode = driver_utils.get_node_capability(node, 'boot_mode') if boot_mode is None: @@ -1072,4 +1070,5 @@ def get_boot_mode_for_deploy(node): LOG.debug('Deploy boot mode is %(boot_mode)s for %(node)s.', {'boot_mode': boot_mode, 'node': node.uuid}) - return boot_mode + + return boot_mode.lower() if boot_mode else boot_mode diff --git a/ironic/drivers/modules/ilo/common.py b/ironic/drivers/modules/ilo/common.py index 02085ea5d..1d1363d0d 100644 --- a/ironic/drivers/modules/ilo/common.py +++ b/ironic/drivers/modules/ilo/common.py @@ -348,7 +348,7 @@ def update_boot_mode(task): if boot_mode is not None: LOG.debug("Node %(uuid)s boot mode is being set to %(boot_mode)s", {'uuid': node.uuid, 'boot_mode': boot_mode}) - set_boot_mode(node, boot_mode.lower()) + set_boot_mode(node, boot_mode) return LOG.debug("Check pending boot mode for node %s.", node.uuid) diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py index dbd9d7340..86dc0c729 100644 --- a/ironic/drivers/modules/ilo/deploy.py +++ b/ironic/drivers/modules/ilo/deploy.py @@ -335,8 +335,8 @@ def _prepare_node_for_deploy(task): if change_boot_mode: ilo_common.update_boot_mode(task) else: - # Need to update boot mode that would used during deploy, if one is not - # provided. + # Need to update boot mode that will be used during deploy, if one is + # not provided. # Since secure boot was disabled, we are in 'uefi' boot mode. if deploy_utils.get_boot_mode_for_deploy(task.node) is None: instance_info = task.node.instance_info diff --git a/ironic/drivers/modules/iscsi_deploy.py b/ironic/drivers/modules/iscsi_deploy.py index 57df4a7d6..8e39e744b 100644 --- a/ironic/drivers/modules/iscsi_deploy.py +++ b/ironic/drivers/modules/iscsi_deploy.py @@ -422,7 +422,7 @@ def _get_boot_mode(node): """ boot_mode = deploy_utils.get_boot_mode_for_deploy(node) if boot_mode: - return boot_mode.lower() + return boot_mode return "bios" -- cgit v1.2.1