summaryrefslogtreecommitdiff
path: root/ironic/drivers
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2021-02-02 12:02:55 +0100
committerDmitry Tantsur <dtantsur@protonmail.com>2021-02-02 12:06:17 +0100
commitccc6c551c3909af74fa44d8030dc2c39bda75203 (patch)
tree32723d30f0c8ea4c71bb6cf4ce8889e9122e14d5 /ironic/drivers
parent6c8dad9465af138eb8c8c387af1f42e723310e26 (diff)
downloadironic-ccc6c551c3909af74fa44d8030dc2c39bda75203.tar.gz
Make boot_mode more consistent with other capabilities
All capabilities, except for boot_mode, are read from instance_info. This change makes instance_info.capabilities[boot_mode] work as well and deprecates instance_info.deploy_boot_mode. Note that the special handling of properties.capabilities[boot_mode] is kept in this patch. Change-Id: Ic2e7fd4c71b7a7bc2950d17f7e1bbdad73bbb8a7
Diffstat (limited to 'ironic/drivers')
-rw-r--r--ironic/drivers/modules/boot_mode_utils.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/ironic/drivers/modules/boot_mode_utils.py b/ironic/drivers/modules/boot_mode_utils.py
index 6eebe50aa..9ddf64849 100644
--- a/ironic/drivers/modules/boot_mode_utils.py
+++ b/ironic/drivers/modules/boot_mode_utils.py
@@ -224,27 +224,35 @@ def get_boot_mode_for_deploy(node):
# NOTE(etingof):
# The search for a boot mode should be in the priority order:
#
- # 1) instance_info
- # 2) properties.capabilities
- # 3) driver_internal_info
+ # 1) instance_info.capabilities
+ # 2) instance_info.deploy_boot_mode (deprecated in Wallaby)
+ # 3) properties.capabilities
+ # 4) driver_internal_info.deploy_boot_mode (internal)
#
# Because:
#
- # (1) can be deleted before teardown
- # (3) will never be touched if node properties/capabilities
+ # (1) and (2) are deleted during teardown
+ # (4) will never be touched if node properties/capabilities
# are still present.
- # (2) becomes operational default as the last resort
-
- instance_info = node.instance_info
+ # (3) becomes operational default as the last resort
+ inst_boot_mode = (
+ common_utils.parse_instance_info_capabilities(node).get('boot_mode')
+ )
cap_boot_mode = driver_utils.get_node_capability(node, 'boot_mode')
- boot_mode = instance_info.get('deploy_boot_mode')
- if boot_mode is None:
- boot_mode = cap_boot_mode
- if cap_boot_mode is None:
- driver_internal_info = node.driver_internal_info
- boot_mode = driver_internal_info.get('deploy_boot_mode')
+ old_boot_mode = node.instance_info.get('deploy_boot_mode')
+ if old_boot_mode:
+ LOG.warning('Using instance_info/deploy_boot_mode is deprecated, '
+ 'please use instance_info/capabilities with boot mode '
+ 'for node %s', node.uuid)
+
+ boot_mode = (
+ inst_boot_mode
+ or old_boot_mode
+ or cap_boot_mode
+ or node.driver_internal_info.get('deploy_boot_mode')
+ )
if not boot_mode:
return