Close old OVSDB connection when ping fails 30/75430/4
authorVictor Pickard <vpickard@redhat.com>
Thu, 23 Aug 2018 17:09:13 +0000 (13:09 -0400)
committerVictor Pickard <vpickard@redhat.com>
Tue, 16 Oct 2018 14:50:08 +0000 (14:50 +0000)
When rebooting a compute node, the ovsdb hostconfig is missing
from oper d/s.

The change resolves the issue, by closing the connection if
the ping/echo fails. The ping/echo is triggered when a new
connection comes in.

What was happening before this change, is that the new
connection from the rebooted compute node would be rejected
and closed, because the code saw an existing connection, and
had not yet "closed" the old connection, which would fail later,
about 3 seconds later.

Tested this with queens/oxygen by manually rebooting compute node
(sudo shutdown -r now) a number of times.

Many more details in the JIRA.

JIRA: OVSDB-444

Change-Id: I0c7e53b032fd53d0287bc28ae86f7ebda06cfabe
Signed-off-by: Victor Pickard <vpickard@redhat.com>
library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/StalePassiveConnectionService.java

index 68090b6b5c3397708d4d9e0f7a06513ebcb65505..f5b8fd672c7c4783b887c8f7574a6cabd0460655 100644 (file)
@@ -75,12 +75,15 @@ public class StalePassiveConnectionService implements AutoCloseable {
                     @Override
                     public void onSuccess(List<String> result) {
                         //old client still active
-                        LOG.info("Echo testing of old client {} succeded", oldClient.getConnectionInfo());
+                        LOG.info("Echo testing of old client {} succeeded", oldClient.getConnectionInfo());
                     }
 
                     @Override
                     public void onFailure(Throwable throwable) {
-                        LOG.info("Echo testing of old client {} failed", oldClient.getConnectionInfo());
+                        LOG.info("Echo testing of old client {} failed, disconnect and notify clients",
+                                oldClient.getConnectionInfo());
+                        //disconnect the old client to cleanup, so that new connection can proceed
+                        oldClient.disconnect();
                         onInactiveClient(oldClient);
                     }
                 }, MoreExecutors.directExecutor());