diff options
| author | Mark Goddard <mark@stackhpc.com> | 2024-07-18 11:33:19 +0100 |
|---|---|---|
| committer | Mark Goddard <mark@stackhpc.com> | 2024-07-18 13:21:51 +0000 |
| commit | bbc7ddf883d608b1be44e7a4aee5348256f57dfb (patch) | |
| tree | bc78ed7224047bfad4b5dbf8588f2d3a7198cf22 /ansible | |
| parent | fc44651d6297b760e5e39bf6635a0cc22e341ce9 (diff) | |
| download | kolla-ansible-bbc7ddf883d608b1be44e7a4aee5348256f57dfb.tar.gz kolla-ansible-bbc7ddf883d608b1be44e7a4aee5348256f57dfb.zip | |
Work around OVN DB leader election race condition
After OVN DB leader restarts there is a period before a new leader has
been elected where the old leader is returned in the cluster status.
This can result in a failure to apply the connection settings if a
different leader is elected.
Wait for a few seconds for the leader election to complete.
Change-Id: I20f08c986fa6b4b3ec668dad649e69f23119796b
Closes-Bug: #2059124
Diffstat (limited to 'ansible')
| -rw-r--r-- | ansible/roles/ovn-db/defaults/main.yml | 2 | ||||
| -rw-r--r-- | ansible/roles/ovn-db/tasks/bootstrap-db.yml | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/ansible/roles/ovn-db/defaults/main.yml b/ansible/roles/ovn-db/defaults/main.yml index a5d301ad5..c6b314c6b 100644 --- a/ansible/roles/ovn-db/defaults/main.yml +++ b/ansible/roles/ovn-db/defaults/main.yml @@ -94,3 +94,5 @@ ovn_sb_command: >- --db-sb-pidfile=/run/ovn/ovnsb_db.pid --db-sb-file=/var/lib/openvswitch/ovn-sb/ovnsb.db --ovn-sb-logfile=/var/log/kolla/openvswitch/ovn-sb-db.log +# Workaround: pause after restarting containers to allow for leader election. +ovn_leader_election_pause: 5 diff --git a/ansible/roles/ovn-db/tasks/bootstrap-db.yml b/ansible/roles/ovn-db/tasks/bootstrap-db.yml index 2763005a9..deb4e0d5b 100644 --- a/ansible/roles/ovn-db/tasks/bootstrap-db.yml +++ b/ansible/roles/ovn-db/tasks/bootstrap-db.yml @@ -1,4 +1,14 @@ --- +# NOTE(mgoddard): After OVN DB leader restarts there is a period before a new +# leader has been elected where the old leader is returned in the cluster +# status. This can result in a failure to apply the connection settings if a +# different leader is elected. Wait for a few seconds for the leader election +# to complete. +- name: Wait for leader election + pause: + seconds: "{{ ovn_leader_election_pause }}" + when: ovn_nb_db_cluster_exists | default(false) or ovn_sb_db_cluster_exists | default(false) + - name: Get OVN_Northbound cluster leader become: true command: "{{ kolla_container_engine }} exec ovn_nb_db ovs-appctl -t /var/run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound" |
