Fixed an issue where only the new device master node would receive mastership change events.
Change-Id: I08a6530c57c91f006994412b4dfbfb3c16571593
diff --git a/core/store/dist/src/main/java/org/onosproject/store/mastership/impl/ConsistentDeviceMastershipStore.java b/core/store/dist/src/main/java/org/onosproject/store/mastership/impl/ConsistentDeviceMastershipStore.java
index 5225549..6ff050c 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/mastership/impl/ConsistentDeviceMastershipStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/mastership/impl/ConsistentDeviceMastershipStore.java
@@ -400,25 +400,22 @@
if (!isDeviceMastershipTopic(leadership.topic())) {
return;
}
- NodeId nodeId = leadership.leader();
DeviceId deviceId = extractDeviceIdFromTopic(leadership.topic());
- if (Objects.equal(nodeId, localNodeId) && connectedDevices.contains(deviceId)) {
- switch (event.type()) {
- case LEADER_ELECTED:
- notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId)));
- break;
- case LEADER_REELECTED:
- // There is no concept of leader re-election in the new distributed leadership manager.
- throw new IllegalStateException("Unexpected event type");
- case LEADER_BOOTED:
- notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId)));
- break;
- case CANDIDATES_CHANGED:
- notifyDelegate(new MastershipEvent(BACKUPS_CHANGED, deviceId, getNodes(deviceId)));
- break;
- default:
- return;
- }
+ switch (event.type()) {
+ case LEADER_ELECTED:
+ notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId)));
+ break;
+ case LEADER_REELECTED:
+ // There is no concept of leader re-election in the new distributed leadership manager.
+ throw new IllegalStateException("Unexpected event type");
+ case LEADER_BOOTED:
+ notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId)));
+ break;
+ case CANDIDATES_CHANGED:
+ notifyDelegate(new MastershipEvent(BACKUPS_CHANGED, deviceId, getNodes(deviceId)));
+ break;
+ default:
+ return;
}
}
}