diff options
author | Zuul <zuul@review.opendev.org> | 2021-12-15 16:39:28 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-12-15 16:39:28 +0000 |
commit | 19cafb55e134cf95477e9a7eff1542a6fae7dc6d (patch) | |
tree | 73aaea034185b6150eb29071bdd9ef605ee938be /ironic/api | |
parent | ab6ee8b656e98c375a84ba08a6c3022779ced8f4 (diff) | |
parent | 2a6cdf4b249a85575017264aea20dd0148564ee3 (diff) | |
download | ironic-19cafb55e134cf95477e9a7eff1542a6fae7dc6d.tar.gz |
Merge "Allow enabling fast-track per node"
Diffstat (limited to 'ironic/api')
-rw-r--r-- | ironic/api/controllers/v1/ramdisk.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ironic/api/controllers/v1/ramdisk.py b/ironic/api/controllers/v1/ramdisk.py index 2b26d35fc..5feef5e02 100644 --- a/ironic/api/controllers/v1/ramdisk.py +++ b/ironic/api/controllers/v1/ramdisk.py @@ -69,11 +69,13 @@ def convert_with_links(node): class LookupController(rest.RestController): """Controller handling node lookup for a deploy ramdisk.""" - @property - def lookup_allowed_states(self): - if CONF.deploy.fast_track: - return states.FASTTRACK_LOOKUP_ALLOWED_STATES - return states.LOOKUP_ALLOWED_STATES + def lookup_allowed(self, node): + if utils.fast_track_enabled(node): + return ( + node.provision_state in states.FASTTRACK_LOOKUP_ALLOWED_STATES + ) + else: + return node.provision_state in states.LOOKUP_ALLOWED_STATES @method.expose() @args.validate(addresses=args.string_list, node_uuid=args.uuid) @@ -135,8 +137,7 @@ class LookupController(rest.RestController): # at all and nodes in a wrong state by different error messages. raise exception.NotFound() - if (CONF.api.restrict_lookup - and node.provision_state not in self.lookup_allowed_states): + if CONF.api.restrict_lookup and not self.lookup_allowed(node): raise exception.NotFound() if api_utils.allow_agent_token(): |