mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Remove Disconnected link state
Dynamically flipping from Established to Disconnected is not the intended usage of InstanceLink State. - Link state starts in Adding and becomes Established once any control node first sees the link is in the status KnownConnectionCosts
This commit is contained in:
@@ -36,7 +36,7 @@ class Migration(migrations.Migration):
|
|||||||
model_name='instancelink',
|
model_name='instancelink',
|
||||||
name='link_state',
|
name='link_state',
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
choices=[('adding', 'Adding'), ('established', 'Established'), ('disconnected', 'Disconnected'), ('removing', 'Removing')],
|
choices=[('adding', 'Adding'), ('established', 'Established'), ('removing', 'Removing')],
|
||||||
default='adding',
|
default='adding',
|
||||||
help_text='Indicates the current life cycle stage of this peer link.',
|
help_text='Indicates the current life cycle stage of this peer link.',
|
||||||
max_length=16,
|
max_length=16,
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ class InstanceLink(BaseModel):
|
|||||||
class States(models.TextChoices):
|
class States(models.TextChoices):
|
||||||
ADDING = 'adding', _('Adding')
|
ADDING = 'adding', _('Adding')
|
||||||
ESTABLISHED = 'established', _('Established')
|
ESTABLISHED = 'established', _('Established')
|
||||||
DISCONNECTED = 'disconnected', _('Disconnected')
|
|
||||||
REMOVING = 'removing', _('Removing')
|
REMOVING = 'removing', _('Removing')
|
||||||
|
|
||||||
link_state = models.CharField(
|
link_state = models.CharField(
|
||||||
|
|||||||
@@ -514,11 +514,15 @@ def execution_node_health_check(node):
|
|||||||
|
|
||||||
def inspect_established_receptor_connections(mesh_status):
|
def inspect_established_receptor_connections(mesh_status):
|
||||||
'''
|
'''
|
||||||
detect active/inactive receptor links
|
Flips link state from ADDING to ESTABLISHED
|
||||||
|
If the InstanceLink source and target match the entries
|
||||||
|
in Known Connection Costs, flip to Established.
|
||||||
'''
|
'''
|
||||||
from awx.main.models import InstanceLink
|
from awx.main.models import InstanceLink
|
||||||
|
|
||||||
all_links = InstanceLink.objects.all()
|
all_links = InstanceLink.objects.filter(link_state=InstanceLink.States.ADDING)
|
||||||
|
if not all_links.exists():
|
||||||
|
return
|
||||||
active_receptor_conns = mesh_status['KnownConnectionCosts']
|
active_receptor_conns = mesh_status['KnownConnectionCosts']
|
||||||
update_links = []
|
update_links = []
|
||||||
for link in all_links:
|
for link in all_links:
|
||||||
@@ -527,10 +531,6 @@ def inspect_established_receptor_connections(mesh_status):
|
|||||||
if link.link_state is not InstanceLink.States.ESTABLISHED:
|
if link.link_state is not InstanceLink.States.ESTABLISHED:
|
||||||
link.link_state = InstanceLink.States.ESTABLISHED
|
link.link_state = InstanceLink.States.ESTABLISHED
|
||||||
update_links.append(link)
|
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'])
|
InstanceLink.objects.bulk_update(update_links, ['link_state'])
|
||||||
|
|
||||||
@@ -538,7 +538,6 @@ def inspect_established_receptor_connections(mesh_status):
|
|||||||
def inspect_execution_and_hop_nodes(instance_list):
|
def inspect_execution_and_hop_nodes(instance_list):
|
||||||
with advisory_lock('inspect_execution_and_hop_nodes_lock', wait=False):
|
with advisory_lock('inspect_execution_and_hop_nodes_lock', wait=False):
|
||||||
node_lookup = {inst.hostname: inst for inst in instance_list}
|
node_lookup = {inst.hostname: inst for inst in instance_list}
|
||||||
|
|
||||||
ctl = get_receptor_ctl()
|
ctl = get_receptor_ctl()
|
||||||
mesh_status = ctl.simple_command('status')
|
mesh_status = ctl.simple_command('status')
|
||||||
|
|
||||||
|
|||||||
@@ -252,22 +252,6 @@ function Legend() {
|
|||||||
</DescriptionListTerm>
|
</DescriptionListTerm>
|
||||||
<DescriptionListDescription>{t`Established`}</DescriptionListDescription>
|
<DescriptionListDescription>{t`Established`}</DescriptionListDescription>
|
||||||
</DescriptionListGroup>
|
</DescriptionListGroup>
|
||||||
<DescriptionListGroup>
|
|
||||||
<DescriptionListTerm>
|
|
||||||
<svg width="20" height="15" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line
|
|
||||||
x1="0"
|
|
||||||
y1="9"
|
|
||||||
x2="20"
|
|
||||||
y2="9"
|
|
||||||
stroke="#ccc"
|
|
||||||
strokeWidth="4"
|
|
||||||
strokeDasharray="6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</DescriptionListTerm>
|
|
||||||
<DescriptionListDescription>{t`Disconnected`}</DescriptionListDescription>
|
|
||||||
</DescriptionListGroup>
|
|
||||||
<DescriptionListGroup>
|
<DescriptionListGroup>
|
||||||
<DescriptionListTerm>
|
<DescriptionListTerm>
|
||||||
<svg width="20" height="15" xmlns="http://www.w3.org/2000/svg">
|
<svg width="20" height="15" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|||||||
@@ -181,7 +181,6 @@ function MeshGraph({
|
|||||||
.data([
|
.data([
|
||||||
'end',
|
'end',
|
||||||
'end-active',
|
'end-active',
|
||||||
'end-disconnected',
|
|
||||||
'end-adding',
|
'end-adding',
|
||||||
'end-removing',
|
'end-removing',
|
||||||
])
|
])
|
||||||
@@ -197,7 +196,6 @@ function MeshGraph({
|
|||||||
mesh.select('#end').attr('refX', 23).attr('fill', '#6A6E73');
|
mesh.select('#end').attr('refX', 23).attr('fill', '#6A6E73');
|
||||||
mesh.select('#end-removing').attr('refX', 23).attr('fill', '#C9190B');
|
mesh.select('#end-removing').attr('refX', 23).attr('fill', '#C9190B');
|
||||||
mesh.select('#end-adding').attr('refX', 23).attr('fill', '#3E8635');
|
mesh.select('#end-adding').attr('refX', 23).attr('fill', '#3E8635');
|
||||||
mesh.select('#end-disconnected').attr('refX', 23).attr('fill', '#CCC');
|
|
||||||
mesh.select('#end-active').attr('refX', 18).attr('fill', '#0066CC');
|
mesh.select('#end-active').attr('refX', 18).attr('fill', '#0066CC');
|
||||||
|
|
||||||
// Add links
|
// Add links
|
||||||
@@ -214,9 +212,6 @@ function MeshGraph({
|
|||||||
.attr('x2', (d) => d.target.x)
|
.attr('x2', (d) => d.target.x)
|
||||||
.attr('y2', (d) => d.target.y)
|
.attr('y2', (d) => d.target.y)
|
||||||
.attr('marker-end', (d) => {
|
.attr('marker-end', (d) => {
|
||||||
if (d.link_state === 'disconnected') {
|
|
||||||
return 'url(#end-disconnected)';
|
|
||||||
}
|
|
||||||
if (d.link_state === 'adding') {
|
if (d.link_state === 'adding') {
|
||||||
return 'url(#end-adding)';
|
return 'url(#end-adding)';
|
||||||
}
|
}
|
||||||
@@ -366,9 +361,6 @@ function MeshGraph({
|
|||||||
.style('stroke', (d) => renderLinkStatusColor(d.link_state))
|
.style('stroke', (d) => renderLinkStatusColor(d.link_state))
|
||||||
.style('stroke-width', '2px')
|
.style('stroke-width', '2px')
|
||||||
.attr('marker-end', (d) => {
|
.attr('marker-end', (d) => {
|
||||||
if (d.link_state === 'disconnected') {
|
|
||||||
return 'url(#end-disconnected)';
|
|
||||||
}
|
|
||||||
if (d.link_state === 'adding') {
|
if (d.link_state === 'adding') {
|
||||||
return 'url(#end-adding)';
|
return 'url(#end-adding)';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ export const NODE_STATE_COLOR_KEY = {
|
|||||||
|
|
||||||
export const LINK_STATE_COLOR_KEY = {
|
export const LINK_STATE_COLOR_KEY = {
|
||||||
established: '#6A6E73',
|
established: '#6A6E73',
|
||||||
disconnected: '#CCC',
|
|
||||||
adding: '#3E8635',
|
adding: '#3E8635',
|
||||||
removing: '#C9190B',
|
removing: '#C9190B',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ export function redirectToDetailsPage(selectedNode, history) {
|
|||||||
export function renderLinkState(linkState) {
|
export function renderLinkState(linkState) {
|
||||||
const linkPattern = {
|
const linkPattern = {
|
||||||
established: null,
|
established: null,
|
||||||
disconnected: 3,
|
|
||||||
adding: 3,
|
adding: 3,
|
||||||
removing: 3,
|
removing: 3,
|
||||||
};
|
};
|
||||||
@@ -111,7 +110,7 @@ export function getRandomInt(min, max) {
|
|||||||
const generateRandomLinks = (n, r) => {
|
const generateRandomLinks = (n, r) => {
|
||||||
const links = [];
|
const links = [];
|
||||||
function getRandomLinkState() {
|
function getRandomLinkState() {
|
||||||
return ['established', 'adding', 'removing', 'disconnected'][
|
return ['established', 'adding', 'removing'][
|
||||||
getRandomInt(0, 3)
|
getRandomInt(0, 3)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user