diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/OzoneGetConf.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/OzoneGetConf.java
deleted file mode 100644
index e14fe3fa5b79..000000000000
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/OzoneGetConf.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.freon;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.InetSocketAddress;
-import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.hadoop.HadoopIllegalArgumentException;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.hdds.HddsUtils;
-import org.apache.hadoop.hdds.conf.ConfigurationSource;
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdfs.DFSUtil;
-import org.apache.hadoop.ozone.OmUtils;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.util.Tool;
-import org.apache.hadoop.util.ToolRunner;
-
-/**
- * CLI utility to print out ozone related configuration.
- */
-public class OzoneGetConf extends Configured implements Tool {
-
- private static final String DESCRIPTION = "ozone getconf is utility for "
- + "getting configuration information from the config file.\n";
-
- enum Command {
- INCLUDE_FILE("-includeFile",
- "gets the include file path that defines the datanodes " +
- "that can join the cluster."),
- EXCLUDE_FILE("-excludeFile",
- "gets the exclude file path that defines the datanodes " +
- "that need to decommissioned."),
- OZONEMANAGER("-ozonemanagers",
- "gets list of Ozone Manager nodes in the cluster"),
- STORAGECONTAINERMANAGER("-storagecontainermanagers",
- "gets list of ozone storage container manager nodes in the cluster"),
- CONFKEY("-confKey [key]", "gets a specific key from the configuration");
-
- private static final Map HANDLERS;
-
- static {
- HANDLERS = new HashMap();
- HANDLERS.put(StringUtils.toLowerCase(OZONEMANAGER.getName()),
- new OzoneManagersCommandHandler());
- HANDLERS.put(StringUtils.toLowerCase(STORAGECONTAINERMANAGER.getName()),
- new StorageContainerManagersCommandHandler());
- HANDLERS.put(StringUtils.toLowerCase(CONFKEY.getName()),
- new PrintConfKeyCommandHandler());
- }
-
- private final String cmd;
- private final String description;
-
- Command(String cmd, String description) {
- this.cmd = cmd;
- this.description = description;
- }
-
- public String getName() {
- return cmd.split(" ")[0];
- }
-
- public String getUsage() {
- return cmd;
- }
-
- public String getDescription() {
- return description;
- }
-
- public static OzoneGetConf.CommandHandler getHandler(String cmd) {
- return HANDLERS.get(StringUtils.toLowerCase(cmd));
- }
- }
-
- static final String USAGE;
- static {
- /* Initialize USAGE based on Command values */
- StringBuilder usage = new StringBuilder(DESCRIPTION);
- usage.append("\nozone getconf \n");
- for (OzoneGetConf.Command cmd : OzoneGetConf.Command.values()) {
- usage.append("\t[" + cmd.getUsage() + "]\t\t\t" + cmd.getDescription()
- + "\n");
- }
- USAGE = usage.toString();
- }
-
- /**
- * Handler to return value for key corresponding to the
- * {@link OzoneGetConf.Command}.
- */
- static class CommandHandler {
-
- @SuppressWarnings("visibilitymodifier")
- protected String key; // Configuration key to lookup
-
- CommandHandler() {
- this(null);
- }
-
- CommandHandler(String key) {
- this.key = key;
- }
-
- final int doWork(OzoneGetConf tool, String[] args) {
- try {
- checkArgs(args);
-
- return doWorkInternal(tool, args);
- } catch (Exception e) {
- tool.printError(e.getMessage());
- }
- return -1;
- }
-
- protected void checkArgs(String[] args) {
- if (args.length > 0) {
- throw new HadoopIllegalArgumentException(
- "Did not expect argument: " + args[0]);
- }
- }
-
-
- /** Method to be overridden by sub classes for specific behavior. */
- int doWorkInternal(OzoneGetConf tool, String[] args) throws Exception {
-
- String value = tool.getConf().getTrimmed(key);
- if (value != null) {
- tool.printOut(value);
- return 0;
- }
- tool.printError("Configuration " + key + " is missing.");
- return -1;
- }
- }
-
- static class PrintConfKeyCommandHandler extends OzoneGetConf.CommandHandler {
- @Override
- protected void checkArgs(String[] args) {
- if (args.length != 1) {
- throw new HadoopIllegalArgumentException(
- "usage: " + OzoneGetConf.Command.CONFKEY.getUsage());
- }
- }
-
- @Override
- int doWorkInternal(OzoneGetConf tool, String[] args) throws Exception {
- this.key = args[0];
- return super.doWorkInternal(tool, args);
- }
- }
-
- private final PrintStream out; // Stream for printing command output
- private final PrintStream err; // Stream for printing error
-
- protected OzoneGetConf(OzoneConfiguration conf) {
- this(conf, System.out, System.err);
- }
-
- protected OzoneGetConf(OzoneConfiguration conf, PrintStream out,
- PrintStream err) {
- super(conf);
- this.out = out;
- this.err = err;
- }
-
- void printError(String message) {
- err.println(message);
- }
-
- void printOut(String message) {
- out.println(message);
- }
-
- private void printUsage() {
- printError(USAGE);
- }
-
- /**
- * Main method that runs the tool for given arguments.
- * @param args arguments
- * @return return status of the command
- */
- private int doWork(String[] args) {
- if (args.length >= 1) {
- OzoneGetConf.CommandHandler handler =
- OzoneGetConf.Command.getHandler(args[0]);
- if (handler != null) {
- return handler.doWork(this, Arrays.copyOfRange(args, 1, args.length));
- }
- }
- printUsage();
- return -1;
- }
-
- @Override
- public int run(final String[] args) throws Exception {
- return SecurityUtil.doAsCurrentUser(
- new PrivilegedExceptionAction() {
- @Override
- public Integer run() throws Exception {
- return doWork(args);
- }
- });
- }
-
- /**
- * Handler for {@link Command#STORAGECONTAINERMANAGER}.
- */
- static class StorageContainerManagersCommandHandler extends CommandHandler {
-
- @Override
- public int doWorkInternal(OzoneGetConf tool, String[] args)
- throws IOException {
- Collection addresses = HddsUtils
- .getSCMAddresses(OzoneConfiguration.of(tool.getConf()));
-
- for (InetSocketAddress addr : addresses) {
- tool.printOut(addr.getHostName());
- }
- return 0;
- }
- }
-
- /**
- * Handler for {@link Command#OZONEMANAGER}.
- */
- static class OzoneManagersCommandHandler extends CommandHandler {
- @Override
- public int doWorkInternal(OzoneGetConf tool, String[] args)
- throws IOException {
- ConfigurationSource configSource =
- OzoneConfiguration.of(tool.getConf());
- if (OmUtils.isServiceIdsDefined(
- configSource)) {
- tool.printOut(OmUtils.getOmHAAddressesById(configSource).toString());
- } else {
- tool.printOut(OmUtils.getOmAddress(configSource).getHostName());
- }
-
- return 0;
- }
- }
-
- public static void main(String[] args) throws Exception {
- if (DFSUtil.parseHelpArgument(args, USAGE, System.out, true)) {
- System.exit(0);
- }
-
- OzoneConfiguration conf = new OzoneConfiguration();
- conf.addResource(new OzoneConfiguration());
- int res = ToolRunner.run(new OzoneGetConf(conf), args);
- System.exit(res);
- }
-}
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/package-info.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/package-info.java
deleted file mode 100644
index 150c64e7d96f..000000000000
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/freon/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.freon;
-/**
- * Classes related to Ozone tools.
- */
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot b/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot
new file mode 100644
index 000000000000..ea61c8eab302
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/getconf.robot
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Smoketest ozone cluster startup
+Library OperatingSystem
+Resource ../commonlib.robot
+Test Timeout 5 minutes
+
+*** Test Cases ***
+Ozone getconf OM
+ ${result} = Execute ozone getconf ozonemanagers
+ Should contain ${result} om
+
+Ozone getconf SCM
+ ${result} = Execute ozone getconf storagecontainermanagers
+ Should contain ${result} scm
+
+Ozone getconf configration keys
+ ${result} = Execute ozone getconf confKey endpoint.token
+ Should contain ${result} Configuration endpoint.token is missing
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/shell/ozone/ozone b/hadoop-ozone/dist/src/shell/ozone/ozone
index c536484e9b56..598b33ddc7c5 100755
--- a/hadoop-ozone/dist/src/shell/ozone/ozone
+++ b/hadoop-ozone/dist/src/shell/ozone/ozone
@@ -148,7 +148,7 @@ function ozonecmd_case
OZONE_RUN_ARTIFACT_NAME="hadoop-ozone-tools"
;;
getconf)
- HADOOP_CLASSNAME=org.apache.hadoop.ozone.freon.OzoneGetConf;
+ HADOOP_CLASSNAME=org.apache.hadoop.ozone.conf.OzoneGetConf;
OZONE_RUN_ARTIFACT_NAME="hadoop-ozone-tools"
;;
om)
diff --git a/hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh b/hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh
index 5693f81ef69e..60ea58ebe554 100755
--- a/hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh
+++ b/hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh
@@ -47,8 +47,8 @@ else
exit 1
fi
-#SECURITY_ENABLED=$("${HADOOP_HDFS_HOME}/bin/ozone" getozoneconf -confKey hadoop.security.authentication | tr '[:upper:]' '[:lower:]' 2>&-)
-#SECURITY_AUTHORIZATION_ENABLED=$("${HADOOP_HDFS_HOME}/bin/ozone" getozoneconf -confKey hadoop.security.authorization | tr '[:upper:]' '[:lower:]' 2>&-)
+#SECURITY_ENABLED=$("${HADOOP_HDFS_HOME}/bin/ozone" getozoneconf confKey hadoop.security.authentication | tr '[:upper:]' '[:lower:]' 2>&-)
+#SECURITY_AUTHORIZATION_ENABLED=$("${HADOOP_HDFS_HOME}/bin/ozone" getozoneconf confKey hadoop.security.authorization | tr '[:upper:]' '[:lower:]' 2>&-)
#if [[ ${SECURITY_ENABLED} == "kerberos" || ${SECURITY_AUTHORIZATION_ENABLED} == "true" ]]; then
# echo "Ozone is not supported in a security enabled cluster."
# exit 1
@@ -66,7 +66,7 @@ hadoop_uservar_su ozone datanode "${HADOOP_HDFS_HOME}/bin/ozone" \
#---------------------------------------------------------
# Ozone Manager nodes
-OM_NODES=$("${HADOOP_HDFS_HOME}/bin/ozone" getconf -ozonemanagers 2>/dev/null)
+OM_NODES=$("${HADOOP_HDFS_HOME}/bin/ozone" getconf ozonemanagers 2>/dev/null)
echo "Stopping Ozone Manager nodes [${OM_NODES}]"
if [[ "${OM_NODES}" == "0.0.0.0" ]]; then
OM_NODES=$(hostname)
@@ -81,7 +81,7 @@ hadoop_uservar_su hdfs om "${HADOOP_HDFS_HOME}/bin/ozone" \
#---------------------------------------------------------
# Ozone storagecontainermanager nodes
-SCM_NODES=$("${HADOOP_HDFS_HOME}/bin/ozone" getconf -storagecontainermanagers 2>/dev/null)
+SCM_NODES=$("${HADOOP_HDFS_HOME}/bin/ozone" getconf storagecontainermanagers 2>/dev/null)
echo "Stopping storage container manager nodes [${SCM_NODES}]"
hadoop_uservar_su hdfs scm "${HADOOP_HDFS_HOME}/bin/ozone" \
--workers \
diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneGetConf.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneGetConf.java
new file mode 100644
index 000000000000..bdb749d52181
--- /dev/null
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneGetConf.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.hadoop.ozone.conf;
+
+import java.io.PrintStream;
+
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.util.NativeCodeLoader;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import picocli.CommandLine;
+
+/**
+ * CLI utility to print out ozone related configuration.
+ */
+@CommandLine.Command(
+ name = "ozone getconf",
+ description = "ozone getconf is utility for"
+ + " getting configuration information from the config file.",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class,
+ subcommands = {
+ PrintConfKeyCommandHandler.class,
+ StorageContainerManagersCommandHandler.class,
+ OzoneManagersCommandHandler.class
+ })
+public class OzoneGetConf extends GenericCli {
+ private final PrintStream out; // Stream for printing command output
+ private final PrintStream err; // Stream for printing error
+ private OzoneConfiguration conf;
+
+ protected OzoneGetConf(OzoneConfiguration conf) {
+ this(conf, System.out, System.err);
+ }
+
+ protected OzoneGetConf(OzoneConfiguration conf, PrintStream out,
+ PrintStream err) {
+ this.conf = conf;
+ this.out = out;
+ this.err = err;
+ }
+
+ void printError(String message) {
+ err.println(message);
+ }
+
+ void printOut(String message) {
+ out.println(message);
+ }
+
+ OzoneConfiguration getConf() {
+ return this.conf;
+ }
+
+ public static void main(String[] argv) {
+ LogManager.resetConfiguration();
+ Logger.getRootLogger().setLevel(Level.INFO);
+ Logger.getRootLogger()
+ .addAppender(new ConsoleAppender(new PatternLayout("%m%n")));
+ Logger.getLogger(NativeCodeLoader.class).setLevel(Level.ERROR);
+
+ OzoneConfiguration conf = new OzoneConfiguration();
+ conf.addResource(new OzoneConfiguration());
+ new OzoneGetConf(conf).run(argv);
+ }
+}
diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneManagersCommandHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneManagersCommandHandler.java
new file mode 100644
index 000000000000..763fecfd63ce
--- /dev/null
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/OzoneManagersCommandHandler.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.hadoop.ozone.conf;
+
+import java.util.concurrent.Callable;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.OmUtils;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Handler for ozone getconf ozonemanagers.
+ */
+@Command(name = "ozonemanagers",
+ description = "gets list of ozone storage container "
+ + "manager nodes in the cluster",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class OzoneManagersCommandHandler implements Callable {
+
+ @ParentCommand
+ private OzoneGetConf tool;
+
+ @Override
+ public Void call() throws Exception {
+ ConfigurationSource configSource =
+ OzoneConfiguration.of(tool.getConf());
+ if (OmUtils.isServiceIdsDefined(
+ configSource)) {
+ tool.printOut(OmUtils.getOmHAAddressesById(configSource).toString());
+ } else {
+ tool.printOut(OmUtils.getOmAddress(configSource).getHostName());
+ }
+ return null;
+ }
+}
diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java
new file mode 100644
index 000000000000..fe70ee401aba
--- /dev/null
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/PrintConfKeyCommandHandler.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.hadoop.ozone.conf;
+
+import java.util.concurrent.Callable;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Parameters;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Handler for ozone getconf confKey [key].
+ */
+@Command(name = "confKey",
+ description = "gets a specific key from the configuration",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class PrintConfKeyCommandHandler implements Callable {
+
+ @Parameters(arity = "1..1", description = "configuration key")
+ private String confKey;
+
+ @ParentCommand
+ private OzoneGetConf tool;
+
+ @Override
+ public Void call() throws Exception {
+ String value = tool.getConf().getTrimmed(confKey);
+ if (value != null) {
+ tool.printOut(value);
+ }
+ tool.printError("Configuration " + confKey + " is missing.");
+ return null;
+ }
+}
diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/StorageContainerManagersCommandHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/StorageContainerManagersCommandHandler.java
new file mode 100644
index 000000000000..bded94f5fb2a
--- /dev/null
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/StorageContainerManagersCommandHandler.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.hadoop.ozone.conf;
+
+import java.net.InetSocketAddress;
+import java.util.Collection;
+import java.util.concurrent.Callable;
+import org.apache.hadoop.hdds.HddsUtils;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Handler for ozone getconf storagecontainermanagers.
+ */
+@Command(name = "storagecontainermanagers",
+ description = "gets list of ozone storage container "
+ + "manager nodes in the cluster",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class StorageContainerManagersCommandHandler implements Callable {
+
+ @ParentCommand
+ private OzoneGetConf tool;
+
+ @Override
+ public Void call() throws Exception {
+ Collection addresses = HddsUtils
+ .getSCMAddresses(OzoneConfiguration.of(tool.getConf()));
+
+ for (InetSocketAddress addr : addresses) {
+ tool.printOut(addr.getHostName());
+ }
+ return null;
+ }
+}
diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/package-info.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/package-info.java
new file mode 100644
index 000000000000..2c950510eb81
--- /dev/null
+++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/conf/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * Classes related to Ozone get conf tool.
+ */
+package org.apache.hadoop.ozone.conf;