Implement action for rebalancing L3 agents in HA environment

Bug #1951886 reported by John Lettman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Neutron Gateway Charm
New
Undecided
Unassigned

Bug Description

After cycling all other partners on a neutron-gateway HA configuration, all L3 agents appear stuck on the remaining partner. This condition is undesirable as the HA becomes completely unbalanced.

It would be helpful to automatically detect/rectify this condition or offer an action to rebalance the L3 agents after maintenance activities.

Our current workaround is the following script (for a 2 gateway HA):

UNIT="neutron-gateway/0"
HOSTNAME=$(juju run -u $UNIT -- hostname)
L3AGENT=$(openstack network agent list --host $HOSTNAME --agent-type l3 -cID -fvalue)

HAROUTERS=($(openstack router list -cHA -cID -fvalue | awk '/True/ {print $1}' | tr '\n' ' '));

HALEN=${#HAROUTERS[@]};
HASEL=$(( HALEN / 2 ));

for (( i=0; i<${HASEL}; i++ )); do
        neutron l3-agent-router-remove $L3AGENT ${HAROUTERS[$i]};
done;

# wait a while here

for (( i=0; i<${HASEL}; i++ )); do
        neutron l3-agent-router-add $L3AGENT ${HAROUTERS[$i]};
done;

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.