sumitagrawl commented on code in PR #9611:
URL: https://github.com/apache/ozone/pull/9611#discussion_r2821554658
##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -32,25 +44,203 @@
description = "Check if SCM is in safe mode",
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
-public class SafeModeCheckSubcommand extends ScmSubcommand {
+public class SafeModeCheckSubcommand extends AbstractSubcommand implements
Callable<Void> {
+ @CommandLine.Mixin
+ private ScmOption scmOption;
+
+ @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;
+
+ private String serviceId;
+ private List<SCMNodeInfo> nodes;
@Override
- public void execute(ScmClient scmClient) throws IOException {
- boolean execReturn = scmClient.inSafeMode();
+ public Void call() throws Exception {
+ OzoneConfiguration conf = getOzoneConf();
+ serviceId = HddsUtils.getScmServiceId(conf);
+ String scmAddress = scmOption.getScm();
+ if (serviceId != null) {
+ nodes = SCMNodeInfo.buildNodeInfo(conf);
+ }
+
+ ScmNodeTarget targetScmNode = new ScmNodeTarget();
+ try (ScmClient scmClient = scmOption.createScmClient(conf, targetScmNode))
{
Review Comment:
simplify the code, all node: iterate all, query, scm: get matching node,
query, default: get leader or only one if empty, query
--
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]