Enforce memory percentage 00/37500/3
authorRobert Varga <rovarga@cisco.com>
Tue, 12 Apr 2016 14:47:49 +0000 (16:47 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 19 Apr 2016 11:43:42 +0000 (11:43 +0000)
Setting a negative percentage does not make sense. Make sure we validate
them in setters.

Change-Id: I4e0eb0a6ea47b3dda897946cc172899996e301f3
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContext.java

index 6af96221998aabf68614098fa7fc507929c53760..cf14ebe28d11b0c39e105ab6396f8aff4c37903a 100644 (file)
@@ -220,6 +220,8 @@ public class DatastoreContext {
     }
 
     private void setSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) {
     }
 
     private void setSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) {
+        Preconditions.checkArgument(shardSnapshotDataThresholdPercentage >= 0
+                && shardSnapshotDataThresholdPercentage <= 100);
         raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
     }
 
         raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
     }