[ovs-git] [openvswitch/ovs] 04f888: ovsdb-idl: Fix the database update signaling if it...

Ilya Maximets noreply at github.com
Fri Jun 11 05:07:23 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 04f8881f5795483968987d6d7e8b522c11f2d06e
      https://github.com/openvswitch/ovs/commit/04f8881f5795483968987d6d7e8b522c11f2d06e
  Author: Ilya Maximets <i.maximets at ovn.org>
  Date:   2021-06-11 (Fri, 11 Jun 2021)

  Changed paths:
    M lib/ovsdb-idl.c

  Log Message:
  -----------
  ovsdb-idl: Fix the database update signaling if it has never been connected.

The symptom of this issue is that OVS bridge looses its IP address on
restart.

Simple reproducer:
 0. start ovsdb-server and ovs-vswitchd
 1. ovs-vsctl add-br br0
 2. ifconfig br0 10.0.0.1 up
 3. ovs-appctl -t ovs-vswitchd exit
 4. start ovs-vswitchd back.

After step #3 ovs-vswitchd is down, but br0 interface exists and
has configured IP address.  After step #4 there is no IP address
on the port br0.

What happened:
1. ovsdb-cs connects to the database via ovsdb-idl and requests
   database lock.
   --> get_schema for _Server database
   --> lock request

2. ovsdb-cs receives schema for the _Server database.  And sends
   monitor request.
   <-- schema for _Server
   --> monitor_cond for _Server

3. ovsdb-cs receives lock reply.
   <-- locked
   At this point ovsdb-cs generates OVSDB_CS_EVENT_TYPE_LOCKED
   event and passes it to ovsdb-idl.  ovsdb-idl increases change_seqno.

4. ovsdb_idl_has_ever_connected() is 'true' now, because change_seqno
   is not zero.

5. ovs-vswitchd decides that it has connection with database and
   all the initial data, therefore initiates configuration of bridges.
   bridge_run():ovsdb_idl_has_ever_connected() --> true

6. Since monitor request for the Open_vSwitch database is not even
   sent yet, the database is empty.  This leads to removal of all the
   ports and all other resources.

7. When data finally received, ovs-vswitchd re-creates bridges and
   ports, but IP addresses can not be restored.

While splitting out ovsdb-cs from ovsdb-idl one part of the logic
was lost.  Particularly, before the split, ovsdb-idl updated
change_seqno only in MONITORING state.

Restoring the logic by updating the change_seqno only if may send
transaction, i.e. lock is ours and ovsdb-cs is in the MONITORING
state.  This matches with the main purpose of increasing change_seqno
at this point, i.e. to force the client to re-try the transaction.
With this change ovsdb_idl_has_ever_connected() remains 'false'
until the first monitor reply with the actual data received.

This issue was reported several times during the last couple of weeks.

Reported-at: https://bugzilla.redhat.com/1968445
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-June/383512.html
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2021-June/051222.html
Fixes: 1c337c43ac1c ("ovsdb-idl: Break into two layers.")
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
Acked-by: Dumitru Ceara <dceara at redhat.com>


  Commit: c5a58ec155d89addeaff73cef95dc5f0dce2ef97
      https://github.com/openvswitch/ovs/commit/c5a58ec155d89addeaff73cef95dc5f0dce2ef97
  Author: Ilya Maximets <i.maximets at ovn.org>
  Date:   2021-06-11 (Fri, 11 Jun 2021)

  Changed paths:
    M python/ovs/db/idl.py
    M tests/ovsdb-cluster.at
    M tests/test-ovsdb.py

  Log Message:
  -----------
  python: idl: Allow retry even when using a single remote.

As described in commit [1], it's possible that remote IP is backed by
a load-balancer and re-connection to this same IP will lead to
connection to a different server.  This case is supported for C version
of IDL and should be supported in a same way for python implementation.

[1] ca367fa5f8bb ("ovsdb-idl.c: Allows retry even when using a single remote.")

Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
Acked-by: Dumitru Ceara <dceara at redhat.com>


Compare: https://github.com/openvswitch/ovs/compare/91cb55bc8aad...c5a58ec155d8


More information about the git mailing list