mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-28 14:51:37 +01:00
Ignore replica change events if backups are disabled + Eliminate usage of Maps.filterKeys
Change-Id: I17f03e2d8f71a197f57c0dc062ef16301b80cf66
This commit is contained in:
parent
7269f71fba
commit
a98bf9395e
@ -608,6 +608,9 @@ public class NewDistributedFlowRuleStore
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void event(ReplicaInfoEvent event) {
|
public void event(ReplicaInfoEvent event) {
|
||||||
|
if (!backupEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.type() == ReplicaInfoEvent.Type.BACKUPS_CHANGED) {
|
if (event.type() == ReplicaInfoEvent.Type.BACKUPS_CHANGED) {
|
||||||
DeviceId deviceId = event.subject();
|
DeviceId deviceId = event.subject();
|
||||||
NodeId master = mastershipService.getMasterFor(deviceId);
|
NodeId master = mastershipService.getMasterFor(deviceId);
|
||||||
@ -767,14 +770,14 @@ public class NewDistributedFlowRuleStore
|
|||||||
log.debug("Received flowEntries for {} to backup", flowTables.keySet());
|
log.debug("Received flowEntries for {} to backup", flowTables.keySet());
|
||||||
Set<DeviceId> backedupDevices = Sets.newHashSet();
|
Set<DeviceId> backedupDevices = Sets.newHashSet();
|
||||||
try {
|
try {
|
||||||
Set<DeviceId> managedDevices = mastershipService.getDevicesOf(local);
|
flowTables.forEach((deviceId, deviceFlowTable) -> {
|
||||||
// Only process those devices are that not managed by the local node.
|
// Only process those devices are that not managed by the local node.
|
||||||
Maps.filterKeys(flowTables, deviceId -> !managedDevices.contains(deviceId))
|
if (!Objects.equal(local, mastershipService.getMasterFor(deviceId))) {
|
||||||
.forEach((deviceId, flowTable) -> {
|
Map<FlowId, Set<StoredFlowEntry>> backupFlowTable = getFlowTable(deviceId);
|
||||||
Map<FlowId, Set<StoredFlowEntry>> deviceFlowTable = getFlowTable(deviceId);
|
backupFlowTable.clear();
|
||||||
deviceFlowTable.clear();
|
backupFlowTable.putAll(deviceFlowTable);
|
||||||
deviceFlowTable.putAll(flowTable);
|
backedupDevices.add(deviceId);
|
||||||
backedupDevices.add(deviceId);
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Failure processing backup request", e);
|
log.warn("Failure processing backup request", e);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user