Skip unnecessary SDK get_machine calls
The _process_sdk function starts by calling cloud.list_machines() which
returns all nodes including their names. There is no need to call
cloud.get_machine individually for each node just to get its name
attribute when we might be skipping this node.
This speeds up execution of the Bifrost inventory module when
BIFROST_NODE_NAMES is used.
Change-Id: I27ccc12b9f408d510710d5ba82ad04135169827a
(cherry picked from commit aa4cf7a903
)
This commit is contained in:
parent
c6b578338b
commit
7e4fd3ec5f
|
@ -231,7 +231,6 @@ def _process_sdk(groups, hostvars):
|
|||
node_names = node_names.split(',')
|
||||
|
||||
for machine in machines:
|
||||
machine = cloud.get_machine(machine['uuid'])
|
||||
if machine['name'] is None:
|
||||
name = machine['uuid']
|
||||
else:
|
||||
|
@ -240,6 +239,7 @@ def _process_sdk(groups, hostvars):
|
|||
if node_names and name not in node_names:
|
||||
continue
|
||||
|
||||
machine = cloud.get_machine(machine['uuid'])
|
||||
new_machine = {}
|
||||
for key, value in machine.items():
|
||||
# NOTE(TheJulia): We don't want to pass infomrational links
|
||||
|
|
Loading…
Reference in New Issue