mukul1987 commented on a change in pull request #874:
URL: https://github.com/apache/hadoop-ozone/pull/874#discussion_r426821315



##########
File path: 
hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java
##########
@@ -406,19 +280,71 @@ public MiniOzoneChaosCluster build() throws IOException {
       final List<HddsDatanodeService> hddsDatanodes = createHddsDatanodes(
           scm, null);
 
-      MiniOzoneChaosCluster cluster;
-      if (failureService == FailureService.DATANODE) {
-        cluster = new MiniOzoneDatanodeChaosCluster(conf, omList, scm,
-            hddsDatanodes, omServiceId);
-      } else {
-        cluster = new MiniOzoneOMChaosCluster(conf, omList, scm,
-            hddsDatanodes, omServiceId);
-      }
+      MiniOzoneChaosCluster cluster =
+          new MiniOzoneChaosCluster(conf, omList, scm, hddsDatanodes,
+              omServiceId, clazzes);
 
       if (startDataNodes) {
         cluster.startHddsDatanodes();
       }
       return cluster;
     }
   }
+
+  // OzoneManager specifc
+  public List<OzoneManager> omToFail() {
+    int numNodesToFail = FailureManager.getNumberOfOmToFail();
+    if (failedOmSet.size() >= numOzoneManagers/2) {
+      return Collections.emptyList();
+    }
+
+    int numOms = getOzoneManagersList().size();
+    List<OzoneManager> oms = new ArrayList<>(numNodesToFail);
+    for (int i = 0; i < numNodesToFail; i++) {
+      int failedNodeIndex = FailureManager.getBoundedRandomIndex(numOms);
+      oms.add(getOzoneManager(failedNodeIndex));
+    }
+    return oms;
+  }
+
+  public void shutdownOzoneManager(OzoneManager om) {
+    super.shutdownOzoneManager(om);
+    failedOmSet.add(om);
+  }
+
+  public void restartOzoneManager(OzoneManager om, boolean waitForOM)
+      throws IOException, TimeoutException, InterruptedException {
+    super.restartOzoneManager(om, waitForOM);
+    failedOmSet.remove(om);
+  }
+
+  // Should the selected node be stopped or started.
+  public boolean shouldStop() {
+    if (failedOmSet.size() >= numOzoneManagers/2) {
+      return false;
+    }
+    return RandomUtils.nextBoolean();
+  }
+
+  public List<DatanodeDetails> dnToFail() {
+    int numNodesToFail = FailureManager.getNumberOfDnToFail();
+    int numDns = getHddsDatanodes().size();
+    List<DatanodeDetails> dns = new ArrayList<>(numNodesToFail);
+    for (int i = 0; i < numNodesToFail; i++) {
+      int failedNodeIndex = FailureManager.getBoundedRandomIndex(numDns);
+      dns.add(getHddsDatanodes().get(failedNodeIndex).getDatanodeDetails());
+    }
+    return dns;
+  }
+  
+  @Override
+  public void restartHddsDatanode(DatanodeDetails dn, boolean waitForDatanode)
+      throws InterruptedException, TimeoutException, IOException {
+    super.restartHddsDatanode(dn, waitForDatanode);
+  }
+
+  @Override
+  public void shutdownHddsDatanode(int i) {
+    super.shutdownHddsDatanode(i);
+  }

Review comment:
       Yes, they are getting this used now.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to