Browse Source

Merge "Wait for node to be unlocked before provide"

tags/1.7.0
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
23e25d9e15
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      tripleo_ansible/ansible_plugins/modules/os_baremetal_provide_node.py

+ 14
- 2
tripleo_ansible/ansible_plugins/modules/os_baremetal_provide_node.py View File

@@ -365,10 +365,21 @@ def get_info_nodes(nodes_wait, msg, result, client):
return result, msg


def wait_for_unlocked(client, node, timeout):
timeout_msg = 'Timeout waiting for node %s to be unlocked' % node
for count in iterate_timeout(timeout, timeout_msg):
node_info = client.get_node(
node,
fields=['reservation']
).to_dict()
if node_info['reservation'] is None:
return


def wait_for_bridge_mapping(conn, node):
client = conn.network
timeout_msg = ('Timeout waiting for node %(node) to have bridge_mappings '
'set in the ironic-neutron-agent entry')
timeout_msg = ('Timeout waiting for node %s to have bridge_mappings '
'set in the ironic-neutron-agent entry' % node)
# default agent polling period is 30s, so wait 60s
timeout = 60
for count in iterate_timeout(timeout, timeout_msg):
@@ -386,6 +397,7 @@ def parallel_nodes_providing(conn, module):
result = {}
nodes_wait = nodes[:]
for node in nodes:
wait_for_unlocked(client, node, node_timeout)
if wait_for_bridge_mappings:
wait_for_bridge_mapping(conn, node)
try:


Loading…
Cancel
Save