mirror of
https://github.com/ansible/awx.git
synced 2026-04-03 17:25:08 -02:30
Add peers readonly api and instancelink constraint (#13916)
Add Disconnected link state introspect_receptor_connections is a periodic task that examines active receptor connections and cross-checks it with the InstanceLink info. Any links that should be active but are not will be put into a Disconnected state. If active, it will be in an Established state. UI - Add hop creation and peers mgmt (#13922) * add UI for mgmt peers, instance edit and add * add peer info on detail and bug fix on detail * remove unused chip and change peer label * rename lookup, put Instance type disable on edit --------- Co-authored-by: tanganellilore <lorenzo.tanagnelli@hotmail.it>
This commit is contained in:
committed by
Seth Foster
parent
d8abd4912b
commit
f7fdb7fe8d
@@ -512,6 +512,30 @@ def execution_node_health_check(node):
|
||||
return data
|
||||
|
||||
|
||||
@task(queue=get_task_queuename)
|
||||
def inspect_receptor_connections():
|
||||
ctl = get_receptor_ctl()
|
||||
mesh_status = ctl.simple_command('status')
|
||||
|
||||
# detect active/inactive receptor links
|
||||
from awx.main.models import InstanceLink
|
||||
|
||||
all_links = InstanceLink.objects.all()
|
||||
active_receptor_conns = mesh_status['KnownConnectionCosts']
|
||||
update_links = []
|
||||
for link in all_links:
|
||||
if link.target.hostname in active_receptor_conns.get(link.source.hostname, {}):
|
||||
if link.link_state is not InstanceLink.States.ESTABLISHED:
|
||||
link.link_state = InstanceLink.States.ESTABLISHED
|
||||
update_links.append(link)
|
||||
else:
|
||||
if link.link_state is not InstanceLink.States.DISCONNECTED:
|
||||
link.link_state = InstanceLink.States.DISCONNECTED
|
||||
update_links.append(link)
|
||||
|
||||
InstanceLink.objects.bulk_update(update_links, ['link_state'])
|
||||
|
||||
|
||||
def inspect_execution_nodes(instance_list):
|
||||
with advisory_lock('inspect_execution_nodes_lock', wait=False):
|
||||
node_lookup = {inst.hostname: inst for inst in instance_list}
|
||||
|
||||
Reference in New Issue
Block a user