diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-12-08 12:26:48 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-12-08 14:26:51 +0100 |
commit | 2a6cdf4b249a85575017264aea20dd0148564ee3 (patch) | |
tree | f3d9410d8306e39e966deb1d86bf9ffe7b910e26 /ironic/common/utils.py | |
parent | 79311c88dfe346cf7edc6015efa4511312623eee (diff) | |
download | ironic-2a6cdf4b249a85575017264aea20dd0148564ee3.tar.gz |
Allow enabling fast-track per node
This is useful when some nodes need the "agent" power interface, while
the others can be deployed normally.
Change-Id: Ief7df40c83ef03d0ec5ae92d09ceffd39d3c12a3
Diffstat (limited to 'ironic/common/utils.py')
-rw-r--r-- | ironic/common/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ironic/common/utils.py b/ironic/common/utils.py index e15083396..fc600d335 100644 --- a/ironic/common/utils.py +++ b/ironic/common/utils.py @@ -36,6 +36,7 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import fileutils from oslo_utils import netutils +from oslo_utils import strutils from oslo_utils import timeutils import psutil import pytz @@ -654,3 +655,15 @@ def remove_large_keys(var): return var.__class__(map(remove_large_keys, var)) else: return var + + +def fast_track_enabled(node): + is_enabled = node.driver_info.get('fast_track') + if is_enabled is None: + return CONF.deploy.fast_track + else: + try: + return strutils.bool_from_string(is_enabled, strict=True) + except ValueError as exc: + raise exception.InvalidParameterValue( + _("Invalid value of fast_track: %s") % exc) |