-
Improvement
-
Resolution: Done
-
None
-
None
-
Operating System: All
Platform: All
DeviceContextImpl.java class is first starting services before changing mastership on the switch. This could lead to potential race conditions which controllers start sending changes before being master.
I suggest that DeviceContextImpl.java should first ensure it holds the mastership to the switch and if it works start the services.
So, the method
public boolean onContextInstantiateService(final ConnectionContext connectionContext) {
Should call following line after checking connection is not dead.
Futures.addCallback(sendRoleChangeToDevice(OfpRole.BECOMEMASTER), new RpcResultFutureCallback());
For example,
@Override
public boolean onContextInstantiateService(final ConnectionContext connectionContext) {
if (getPrimaryConnectionContext().getConnectionState().equals(ConnectionContext.CONNECTION_STATE.RIP)) {
LOG.warn("Connection on device {} was interrupted, will stop starting master services.", deviceInfo.getLOGValue());
return false;
}
Futures.addCallback(sendRoleChangeToDevice(OfpRole.BECOMEMASTER), new RpcResultFutureCallback());