ashishkumar50 commented on code in PR #9611:
URL: https://github.com/apache/ozone/pull/9611#discussion_r2685945921


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -45,12 +71,106 @@ public void execute(ScmClient scmClient) throws 
IOException {
       System.out.println("SCM is out of safe mode.");
     }
     if (isVerbose()) {
-      for (Map.Entry<String, Pair<Boolean, String>> entry :
-          scmClient.getSafeModeRuleStatuses().entrySet()) {
-        Pair<Boolean, String> value = entry.getValue();
-        System.out.printf("validated:%s, %s, %s%n",
-            value.getLeft(), entry.getKey(), value.getRight());
+      printSafeModeRules(scmClient.getSafeModeRuleStatuses());
+    }
+  }
+
+  private void executeForSpecificNodeInHA(ScmClient scmClient, String 
serviceId) throws IOException {
+    String scmAddress = getScmOption().getScm();

Review Comment:
   scmAddress is not mandatory option.



##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -33,9 +42,26 @@
     mixinStandardHelpOptions = true,
     versionProvider = HddsVersionProvider.class)
 public class SafeModeCheckSubcommand extends ScmSubcommand {
+  @CommandLine.Option(names = {"--all", "-a"},
+      description = "Show safe mode status for all SCM nodes in the service. " 
+
+          "When multiple SCM service IDs are configured, --service-id must be 
specified.")
+  private boolean allNodes;
 
   @Override
   public void execute(ScmClient scmClient) throws IOException {
+    final OzoneConfiguration conf = getOzoneConf();
+    String serviceId = HddsUtils.getScmServiceId(conf);
+    
+    if (allNodes) {
+      executeForAllNodes(scmClient);
+    } else if (StringUtils.isNotEmpty(getScmOption().getScm()) && serviceId != 
null) {
+      executeForSpecificNodeInHA(scmClient, serviceId);
+    } else {
+      executeForSingleNode(scmClient);

Review Comment:
   In normal or existing behaviour we need safemode status from leader node 
most of the time. When no scm address is passed, whether we are getting safe 
mode status from leader node or not? Because now follower also can accept 
safemode and can return the status.



-- 
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.

To unsubscribe, e-mail: [email protected]

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