Skip to content

Commit f8f9b24

Browse files
authored
Fix OVN leader detection in chassis priority fix (#1970)
After kolla-ansible patch [1] ovn commands can run on all nodes. Changing method of getting the leader. [1] https://review.opendev.org/c/openstack/kolla-ansible/+/963412 Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com>
1 parent 6946bf2 commit f8f9b24

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

etc/kayobe/ansible/fixes/ovn-fix-chassis-priorities.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@
2525
when: kolla_enable_ovn | bool
2626
block:
2727
- name: Find the OVN NB DB leader
28-
ansible.builtin.command: docker exec ovn_nb_db ovn-nbctl get-connection
28+
ansible.builtin.command: >-
29+
docker exec ovn_nb_db
30+
ovs-appctl -t /var/run/ovn/ovnnb_db.ctl
31+
cluster/status OVN_Northbound
2932
changed_when: false
3033
failed_when: false
31-
register: ovn_check_result
34+
register: ovn_cluster_status
3235
check_mode: false
3336

3437
- name: Group hosts by leader/follower role
3538
ansible.builtin.group_by:
36-
key: ovn_nb_{{ 'leader' if ovn_check_result.rc == 0 else 'follower' }}
39+
key: "{{ 'ovn_nb_leader' if 'Role: leader' in ovn_cluster_status.stdout else 'ovn_nb_follower' }}"
3740
changed_when: false
3841

3942
- name: Assert one leader exists
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Updated the OVN chassis priority fix playbook to detect the northbound
5+
database leader via ``ovs-appctl cluster/status``, ensuring only the true
6+
leader runs the priority alignment.

0 commit comments

Comments
 (0)