<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 8, 2019 at 3:52 PM Daniel Alvarez Sanchez &lt;<a href="mailto:dalvarez@redhat.com" target="_blank">dalvarez@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi folks,<br>
<br>
While working with an OpenStack environment running OVN and<br>
ovsdb-server in A/P configuration with Pacemaker we hit an issue that<br>
has been probably around for a long time. The bug itself seems to be<br>
related with ovsdb-server not updating the read-only flag properly.<br>
<br>
With a 3 nodes cluster running ovsdb-server in active/passive mode,<br>
when we restart the master-node, pacemaker promotes another node as<br>
master and moves the associated IPAddr2 resource to it.<br>
At this point, ovn-controller instances across the cloud reconnect to<br>
the new node but there&#39;s a window where ovsdb-server is still running<br>
as backup.<br>
<br>
For those ovn-controller instances that reconnect within that window,<br>
every attempt to write in the OVSDB will fail with &quot;operation not<br>
allowed when database server is in read only mode&quot;. This state will<br>
remain forever unless a reconnection is forced. Restarting<br>
ovn-controller or killing the connection (for example with tcpkill)<br>
will make things work again.<br>
<br>
A workaround in OVN OCF script could be to wait for the<br>
ovsdb_server_promote function to wait until we get &#39;running/active&#39; on<br>
that instance.<br>
<br>
Another open question is what should clients (in this case,<br>
ovn-controller) do in such situation? Shall they log an error and<br>
attempt a reconnection (rate limited)?<br></blockquote><div><br></div><div>Thanks for reporting this issue Daniel.</div><div><br></div><div>I can easily  reproduce the issue with the below commands.</div><div><br></div><div>$ &lt;start the sandbox with --ovn</div><div>$export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach)</div><div>$ovn-nbctl ls-add sw0</div><div>$ovs-appctl -t $PWD/sandbox/nb1 ovsdb-server/sync-status</div><div>state: active<br></div><div>$ovs-appctl -t $PWD/sandbox/nb1 ovsdb-server/set-active-ovsdb-server tcp:<a href="http://192.0.2.2:6641">192.0.2.2:6641</a></div><div>$ovs-appctl -t $PWD/sandbox/nb1 ovsdb-server/connect-active-ovsdb-server</div><div>$ovs-appctl -t $PWD/sandbox/nb1 ovsdb-server/sync-status</div><div>state: backup<br>connecting: tcp:<a href="http://192.0.2.2:6641">192.0.2.2:6641</a><br></div><div>$ovn-nbctl ls-add sw1  --&gt; This should have failed. Since OVN_NB_DAEMON is set, ovn-nbctl talks to the</div><div>                                           ovn-nbctl daemon and it is able to create a logical switch even though the db is in backup mode</div><div>$unset OVN_NB_DAEMON</div><div>$ovn-nbctl ls-add sw2<br>ovn-nbctl: transaction error: {&quot;details&quot;:&quot;insert operation not allowed when database server is in read only mode&quot;,&quot;error&quot;:&quot;not allowed&quot;}<br></div><div><br></div><div><br></div><div>I looked into the ovsdb-server code, when the user changes the state of the ovsdb-server, the read_only param of  active ovsdb_server_sessions</div><div>are not updated.</div><div><br></div><div>Thanks</div><div>Numan</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thoughts?<br>
<br>
Thanks a lot,<br>
Daniel<br>
_______________________________________________<br>
discuss mailing list<br>
<a href="mailto:discuss@openvswitch.org" target="_blank">discuss@openvswitch.org</a><br>
<a href="https://mail.openvswitch.org/mailman/listinfo/ovs-discuss" rel="noreferrer" target="_blank">https://mail.openvswitch.org/mailman/listinfo/ovs-discuss</a><br>
</blockquote></div></div>
</div>