[SDFAB-753] Optimize several ONOS components
Leverage the improved ClusterEvent to optimize several ONOS components.
The idea behind is that there is no need to react for these components
when an Atomix goes down. Actually, reacting will put additional
pressure in the Atomix nodes for no reason. Moreover, any operation done
in this period can potentially timeout
Change-Id: I5edeb3c1189e4255cdb1efb712da33d397da27bf
(cherry picked from commit 75ac28406acc3adf639385694ebb458d52ad8c88)
diff --git a/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/RouteMonitor.java b/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/RouteMonitor.java
index 5ae2628..1ee7daa 100644
--- a/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/RouteMonitor.java
+++ b/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/RouteMonitor.java
@@ -152,6 +152,11 @@
@Override
public void event(ClusterEvent event) {
eventExecutor.execute(() -> {
+ if (event.instanceType() == ClusterEvent.InstanceType.STORAGE) {
+ log.debug("Skipping cluster event for {}", event.subject().id().id());
+ return;
+ }
+
switch (event.type()) {
case INSTANCE_DEACTIVATED:
NodeId id = event.subject().id();
diff --git a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/FpmManager.java b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/FpmManager.java
index 6b6df43..41f3103 100644
--- a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/FpmManager.java
+++ b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/FpmManager.java
@@ -830,6 +830,11 @@
@Override
public void event(ClusterEvent event) {
clusterEventExecutor.execute(() -> {
+ if (event.instanceType() == ClusterEvent.InstanceType.STORAGE) {
+ log.debug("Skipping cluster event for {}", event.subject().id().id());
+ return;
+ }
+
log.info("Receives ClusterEvent {} for {}", event.type(), event.subject().id());
switch (event.type()) {
case INSTANCE_READY:
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
index 776ea58..c8680ba 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
@@ -922,7 +922,11 @@
private class InternalClusterListener implements ClusterEventListener {
@Override
public void event(ClusterEvent event) {
- msgSender.execute(() -> sendMessage(instanceMessage(event, null)));
+ msgSender.execute(() -> {
+ if (event.instanceType() == ClusterEvent.InstanceType.ONOS) {
+ sendMessage(instanceMessage(event, null));
+ }
+ });
}
}
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
index 6f8a706..474bb4b 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
@@ -380,23 +380,25 @@
}
private void handleEvent(ClusterEvent event) {
- ControllerNode cnode = event.subject();
+ if (event.instanceType() == ClusterEvent.InstanceType.ONOS) {
+ ControllerNode cnode = event.subject();
- switch (event.type()) {
+ switch (event.type()) {
- case INSTANCE_ADDED:
- case INSTANCE_ACTIVATED:
- case INSTANCE_READY:
- case INSTANCE_DEACTIVATED:
- cache.addOrUpdateClusterMember(cnode);
- break;
+ case INSTANCE_ADDED:
+ case INSTANCE_ACTIVATED:
+ case INSTANCE_READY:
+ case INSTANCE_DEACTIVATED:
+ cache.addOrUpdateClusterMember(cnode);
+ break;
- case INSTANCE_REMOVED:
- cache.removeClusterMember(cnode);
- break;
+ case INSTANCE_REMOVED:
+ cache.removeClusterMember(cnode);
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
}
}