Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-10 Thread via GitHub


henrybear327 commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3215627066


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -44,9 +78,308 @@ public static void main(String[] args) {
   description = "Internal placeholder for a local Ozone runtime")
   static class RunCommand implements Callable {
 
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;
+
+@Option(names = "--datanodes",
+description = "Number of datanodes to start")
+private Integer datanodes;
+
+@Option(names = "--host",
+description = "Advertised host to write into local service addresses")
+private String host;
+
+@Option(names = "--bind-host",
+description = "Bind host for HTTP and RPC listeners")
+private String bindHost;
+
+@Option(names = "--scm-port",
+description = "SCM client RPC port (0 means auto-allocate)")
+private Integer scmPort;
+
+@Option(names = "--om-port",
+description = "OM RPC port (0 means auto-allocate)")
+private Integer omPort;
+
+@Option(names = "--s3g-port",
+description = "S3 Gateway HTTP port (0 means auto-allocate)")
+private Integer s3gPort;
+
+@Option(names = "--without-s3g",
+description = "Disable S3 Gateway")
+private boolean withoutS3g;
+
+@Option(names = "--ephemeral",
+description = "Delete the data directory on shutdown")
+private boolean ephemeral;
+
+@Option(names = "--startup-timeout",
+description = "How long to wait for the local cluster to become ready")
+private String startupTimeout;
+
+@Option(names = "--s3-access-key",
+description = "Suggested local AWS access key to print on startup")
+private String s3AccessKey;
+
+@Option(names = "--s3-secret-key",
+description = "Suggested local AWS secret key to print on startup")
+private String s3SecretKey;
+
+@Option(names = "--s3-region",
+description = "Suggested local AWS region to print on startup")
+private String s3Region;
+
+RunCommand() {
+  this(System.getenv());
+}
+
+RunCommand(Map environment) {
+  this.environment = Objects.requireNonNull(environment, "environment");
+}
+
 @Override
 public Void call() {
+  resolveConfig(new OzoneConfiguration());
   return null;
 }
+
+LocalOzoneClusterConfig resolveConfig(
+OzoneConfiguration baseConfiguration) {
+  Path resolvedDataDir = resolvePath(dataDir, 
environment.get(ENV_DATA_DIR),
+  "--data-dir", ENV_DATA_DIR, 
LocalOzoneClusterConfig.DEFAULT_DATA_DIR);
+  LocalOzoneClusterConfig.FormatMode resolvedFormat = format != null
+  ? parseFormat(format, "--format")
+  : parseFormat(environment.get(ENV_FORMAT), ENV_FORMAT,
+  LocalOzoneClusterConfig.DEFAULT_FORMAT_MODE);
+  int resolvedDatanodes = datanodes != null
+  ? datanodes
+  : parseInt(environment.get(ENV_DATANODES), ENV_DATANODES,
+  LocalOzoneClusterConfig.DEFAULT_DATANODES);
+  if (resolvedDatanodes < 1) {
+throw new IllegalArgumentException(
+"Datanode count for "
++ (datanodes != null ? "--datanodes" : ENV_DATANODES)
++ " must be at least 1.");
+  }
+
+  String resolvedHost = firstNonBlank(host, environment.get(ENV_HOST),
+  LocalOzoneClusterConfig.DEFAULT_HOST);
+  String resolvedBindHost = firstNonBlank(bindHost,
+  environment.get(ENV_BIND_HOST),
+  LocalOzoneClusterConfig.DEFAULT_BIND_HOST);
+
+  int resolvedScmPort = scmPort != null
+  ? validatePort(scmPort, "--scm-port")
+  : parsePort(environment.get(ENV_SCM_PORT), ENV_SCM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedOmPort = omPort != null
+  ? validatePort(omPort, "--om-port")
+  : parsePort(environment.get(ENV_OM_PORT), ENV_OM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedS3gPort = s3gPort != null
+  ? validatePort(s3gPort, "--s3g-port")
+  : parsePort(environment.get(ENV_S3G_PORT), ENV_S3G_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+
+  boolean resolvedS3gEnabled = withoutS3g ? false
+  : parseBoolean(environment.get(ENV_S3G_ENABLED), ENV_S3G_ENABLED,
+  LocalOzoneClusterConfig.DEFAULT_S3G_ENABLED);
+  boolean resolvedEphemeral = ephemeral || parseBoolean(
+  environment.get(ENV_EPHEMERAL), ENV_EPHEMERAL,
+  LocalOzoneClusterConfig.DEFAULT_EPHEMERAL);
+
+  Duration resolvedStartupTimeout = startupTimeout != null
+  ? parseDur

Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-10 Thread via GitHub


henrybear327 commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3215626304


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -44,9 +78,308 @@ public static void main(String[] args) {
   description = "Internal placeholder for a local Ozone runtime")
   static class RunCommand implements Callable {
 
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;
+
+@Option(names = "--datanodes",
+description = "Number of datanodes to start")
+private Integer datanodes;
+
+@Option(names = "--host",
+description = "Advertised host to write into local service addresses")
+private String host;
+
+@Option(names = "--bind-host",
+description = "Bind host for HTTP and RPC listeners")
+private String bindHost;
+
+@Option(names = "--scm-port",
+description = "SCM client RPC port (0 means auto-allocate)")
+private Integer scmPort;
+
+@Option(names = "--om-port",
+description = "OM RPC port (0 means auto-allocate)")
+private Integer omPort;
+
+@Option(names = "--s3g-port",
+description = "S3 Gateway HTTP port (0 means auto-allocate)")
+private Integer s3gPort;
+
+@Option(names = "--without-s3g",
+description = "Disable S3 Gateway")
+private boolean withoutS3g;
+
+@Option(names = "--ephemeral",
+description = "Delete the data directory on shutdown")
+private boolean ephemeral;
+
+@Option(names = "--startup-timeout",
+description = "How long to wait for the local cluster to become ready")
+private String startupTimeout;
+
+@Option(names = "--s3-access-key",
+description = "Suggested local AWS access key to print on startup")
+private String s3AccessKey;
+
+@Option(names = "--s3-secret-key",
+description = "Suggested local AWS secret key to print on startup")
+private String s3SecretKey;
+
+@Option(names = "--s3-region",
+description = "Suggested local AWS region to print on startup")
+private String s3Region;
+
+RunCommand() {
+  this(System.getenv());
+}
+
+RunCommand(Map environment) {
+  this.environment = Objects.requireNonNull(environment, "environment");
+}
+
 @Override
 public Void call() {
+  resolveConfig(new OzoneConfiguration());
   return null;
 }
+
+LocalOzoneClusterConfig resolveConfig(
+OzoneConfiguration baseConfiguration) {
+  Path resolvedDataDir = resolvePath(dataDir, 
environment.get(ENV_DATA_DIR),
+  "--data-dir", ENV_DATA_DIR, 
LocalOzoneClusterConfig.DEFAULT_DATA_DIR);
+  LocalOzoneClusterConfig.FormatMode resolvedFormat = format != null
+  ? parseFormat(format, "--format")
+  : parseFormat(environment.get(ENV_FORMAT), ENV_FORMAT,
+  LocalOzoneClusterConfig.DEFAULT_FORMAT_MODE);
+  int resolvedDatanodes = datanodes != null
+  ? datanodes
+  : parseInt(environment.get(ENV_DATANODES), ENV_DATANODES,
+  LocalOzoneClusterConfig.DEFAULT_DATANODES);
+  if (resolvedDatanodes < 1) {
+throw new IllegalArgumentException(
+"Datanode count for "
++ (datanodes != null ? "--datanodes" : ENV_DATANODES)
++ " must be at least 1.");
+  }
+
+  String resolvedHost = firstNonBlank(host, environment.get(ENV_HOST),
+  LocalOzoneClusterConfig.DEFAULT_HOST);
+  String resolvedBindHost = firstNonBlank(bindHost,
+  environment.get(ENV_BIND_HOST),
+  LocalOzoneClusterConfig.DEFAULT_BIND_HOST);
+
+  int resolvedScmPort = scmPort != null
+  ? validatePort(scmPort, "--scm-port")
+  : parsePort(environment.get(ENV_SCM_PORT), ENV_SCM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedOmPort = omPort != null
+  ? validatePort(omPort, "--om-port")
+  : parsePort(environment.get(ENV_OM_PORT), ENV_OM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedS3gPort = s3gPort != null
+  ? validatePort(s3gPort, "--s3g-port")
+  : parsePort(environment.get(ENV_S3G_PORT), ENV_S3G_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+
+  boolean resolvedS3gEnabled = withoutS3g ? false
+  : parseBoolean(environment.get(ENV_S3G_ENABLED), ENV_S3G_ENABLED,
+  LocalOzoneClusterConfig.DEFAULT_S3G_ENABLED);
+  boolean resolvedEphemeral = ephemeral || parseBoolean(
+  environment.get(ENV_EPHEMERAL), ENV_EPHEMERAL,
+  LocalOzoneClusterConfig.DEFAULT_EPHEMERAL);
+
+  Duration resolvedStartupTimeout = startupTimeout != null
+  ? parseDur

Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-10 Thread via GitHub


henrybear327 commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3215624861


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -44,9 +78,308 @@ public static void main(String[] args) {
   description = "Internal placeholder for a local Ozone runtime")
   static class RunCommand implements Callable {
 
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;

Review Comment:
   Done! :)



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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-10 Thread via GitHub


henrybear327 commented on PR #10147:
URL: https://github.com/apache/ozone/pull/10147#issuecomment-4416513708

   > feel free to request me to for review if you think this is ready, thanks!
   
   Hi @peterxcli, PTAL :) Thank you!


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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-10 Thread via GitHub


henrybear327 commented on PR #10147:
URL: https://github.com/apache/ozone/pull/10147#issuecomment-4416512982

   > Thanks @henrybear327 for the patch.
   > 
   > Please consider leveraging PicoCLI's built-in environment variable support 
(e.g., @option(..., defaultValue = "${env:OZONE_LOCAL_DATANODES:-1}")). This 
automatically handles type binding and validation for us, which could help 
remove a lot of boilerplate code in resolveConfig. It might keep the code much 
cleaner and simpler. See https://picocli.info/#_variables_in_default_values.
   
   Thank you for the feedback! Addressed in the latest commit. 


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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-04 Thread via GitHub


chungen0126 commented on PR #10147:
URL: https://github.com/apache/ozone/pull/10147#issuecomment-4376914750

   Thanks @henrybear327 for the patch. 
   
   Please consider leveraging PicoCLI's built-in environment variable support 
(e.g., @Option(..., defaultValue = "${env:OZONE_LOCAL_DATANODES:-1}")). This 
automatically handles type binding and validation for us, which could help 
remove a lot of boilerplate code in resolveConfig. It might keep the code much 
cleaner and simpler. See https://picocli.info/#_variables_in_default_values.


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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-05-01 Thread via GitHub


peterxcli commented on PR #10147:
URL: https://github.com/apache/ozone/pull/10147#issuecomment-4362923193

   feel free to request me to for review if you think this is ready, thanks!


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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


peterxcli commented on PR #10147:
URL: https://github.com/apache/ozone/pull/10147#issuecomment-4332429444

   @henrybear327 please merge upstream master, thanks!


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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


peterxcli commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3148108852


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -44,9 +78,308 @@ public static void main(String[] args) {
   description = "Internal placeholder for a local Ozone runtime")
   static class RunCommand implements Callable {
 
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;
+
+@Option(names = "--datanodes",
+description = "Number of datanodes to start")
+private Integer datanodes;
+
+@Option(names = "--host",
+description = "Advertised host to write into local service addresses")
+private String host;
+
+@Option(names = "--bind-host",
+description = "Bind host for HTTP and RPC listeners")
+private String bindHost;
+
+@Option(names = "--scm-port",
+description = "SCM client RPC port (0 means auto-allocate)")
+private Integer scmPort;
+
+@Option(names = "--om-port",
+description = "OM RPC port (0 means auto-allocate)")
+private Integer omPort;
+
+@Option(names = "--s3g-port",
+description = "S3 Gateway HTTP port (0 means auto-allocate)")
+private Integer s3gPort;
+
+@Option(names = "--without-s3g",
+description = "Disable S3 Gateway")
+private boolean withoutS3g;
+
+@Option(names = "--ephemeral",
+description = "Delete the data directory on shutdown")
+private boolean ephemeral;
+
+@Option(names = "--startup-timeout",
+description = "How long to wait for the local cluster to become ready")
+private String startupTimeout;
+
+@Option(names = "--s3-access-key",
+description = "Suggested local AWS access key to print on startup")
+private String s3AccessKey;
+
+@Option(names = "--s3-secret-key",
+description = "Suggested local AWS secret key to print on startup")
+private String s3SecretKey;
+
+@Option(names = "--s3-region",
+description = "Suggested local AWS region to print on startup")
+private String s3Region;
+
+RunCommand() {
+  this(System.getenv());
+}
+
+RunCommand(Map environment) {
+  this.environment = Objects.requireNonNull(environment, "environment");
+}
+
 @Override
 public Void call() {
+  resolveConfig(new OzoneConfiguration());
   return null;
 }
+
+LocalOzoneClusterConfig resolveConfig(
+OzoneConfiguration baseConfiguration) {
+  Path resolvedDataDir = resolvePath(dataDir, 
environment.get(ENV_DATA_DIR),
+  "--data-dir", ENV_DATA_DIR, 
LocalOzoneClusterConfig.DEFAULT_DATA_DIR);
+  LocalOzoneClusterConfig.FormatMode resolvedFormat = format != null
+  ? parseFormat(format, "--format")
+  : parseFormat(environment.get(ENV_FORMAT), ENV_FORMAT,
+  LocalOzoneClusterConfig.DEFAULT_FORMAT_MODE);
+  int resolvedDatanodes = datanodes != null
+  ? datanodes
+  : parseInt(environment.get(ENV_DATANODES), ENV_DATANODES,
+  LocalOzoneClusterConfig.DEFAULT_DATANODES);
+  if (resolvedDatanodes < 1) {
+throw new IllegalArgumentException(
+"Datanode count for "
++ (datanodes != null ? "--datanodes" : ENV_DATANODES)
++ " must be at least 1.");
+  }
+
+  String resolvedHost = firstNonBlank(host, environment.get(ENV_HOST),
+  LocalOzoneClusterConfig.DEFAULT_HOST);
+  String resolvedBindHost = firstNonBlank(bindHost,
+  environment.get(ENV_BIND_HOST),
+  LocalOzoneClusterConfig.DEFAULT_BIND_HOST);
+
+  int resolvedScmPort = scmPort != null
+  ? validatePort(scmPort, "--scm-port")
+  : parsePort(environment.get(ENV_SCM_PORT), ENV_SCM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedOmPort = omPort != null
+  ? validatePort(omPort, "--om-port")
+  : parsePort(environment.get(ENV_OM_PORT), ENV_OM_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+  int resolvedS3gPort = s3gPort != null
+  ? validatePort(s3gPort, "--s3g-port")
+  : parsePort(environment.get(ENV_S3G_PORT), ENV_S3G_PORT,
+  LocalOzoneClusterConfig.DEFAULT_PORT);
+
+  boolean resolvedS3gEnabled = withoutS3g ? false
+  : parseBoolean(environment.get(ENV_S3G_ENABLED), ENV_S3G_ENABLED,
+  LocalOzoneClusterConfig.DEFAULT_S3G_ENABLED);
+  boolean resolvedEphemeral = ephemeral || parseBoolean(
+  environment.get(ENV_EPHEMERAL), ENV_EPHEMERAL,
+  LocalOzoneClusterConfig.DEFAULT_EPHEMERAL);
+
+  Duration resolvedStartupTimeout = startupTimeout != null
+  ? parseDurati

Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


peterxcli commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3148094153


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -44,9 +78,308 @@ public static void main(String[] args) {
   description = "Internal placeholder for a local Ozone runtime")
   static class RunCommand implements Callable {
 
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;

Review Comment:
   could we use enum? not sure if other similar cases do the same thing.



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



Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


Copilot commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3147982807


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -0,0 +1,385 @@
+/*
+ * 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.local;
+
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.time.format.DateTimeParseException;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Internal CLI entry point for local single-node Ozone commands.
+ */
+@Command(name = "ozone local",
+hidden = true,
+description = "Internal commands for local single-node Ozone",
+versionProvider = HddsVersionProvider.class,
+mixinStandardHelpOptions = true,
+subcommands = {
+OzoneLocal.RunCommand.class
+})
+public class OzoneLocal extends GenericCli {
+
+  static final String ENV_DATA_DIR = "OZONE_LOCAL_DATA_DIR";
+  static final String ENV_FORMAT = "OZONE_LOCAL_FORMAT";
+  static final String ENV_DATANODES = "OZONE_LOCAL_DATANODES";
+  static final String ENV_HOST = "OZONE_LOCAL_HOST";
+  static final String ENV_BIND_HOST = "OZONE_LOCAL_BIND_HOST";
+  static final String ENV_SCM_PORT = "OZONE_LOCAL_SCM_PORT";
+  static final String ENV_OM_PORT = "OZONE_LOCAL_OM_PORT";
+  static final String ENV_S3G_ENABLED = "OZONE_LOCAL_S3G_ENABLED";
+  static final String ENV_S3G_PORT = "OZONE_LOCAL_S3G_PORT";
+  static final String ENV_EPHEMERAL = "OZONE_LOCAL_EPHEMERAL";
+  static final String ENV_STARTUP_TIMEOUT = "OZONE_LOCAL_STARTUP_TIMEOUT";
+  static final String ENV_S3_ACCESS_KEY = "OZONE_LOCAL_S3_ACCESS_KEY";
+  static final String ENV_S3_SECRET_KEY = "OZONE_LOCAL_S3_SECRET_KEY";
+  static final String ENV_S3_REGION = "OZONE_LOCAL_S3_REGION";
+
+  public OzoneLocal() {
+super();
+  }
+
+  OzoneLocal(CommandLine.IFactory factory) {
+super(factory);
+  }
+
+  public static void main(String[] args) {
+new OzoneLocal().run(args);
+  }
+
+  @Command(name = "run",
+  hidden = true,
+  description = "Internal placeholder for a local Ozone runtime")
+  static class RunCommand implements Callable {
+
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;
+
+@Option(names = "--datanodes",
+description = "Number of datanodes to start")
+private Integer datanodes;
+
+@Option(names = "--host",
+description = "Advertised host to write into local service addresses")
+private String host;
+
+@Option(names = "--bind-host",
+description = "Bind host for HTTP and RPC listeners")
+private String bindHost;
+
+@Option(names = "--scm-port",
+description = "SCM client RPC port (0 means auto-allocate)")
+private Integer scmPort;
+
+@Option(names = "--om-port",
+description = "OM RPC port (0 means auto-allocate)")
+private Integer omPort;
+
+@Option(names = "--s3g-port",
+description = "S3 Gateway HTTP port (0 means auto-allocate)")
+private Integer s3gPort;
+
+@Option(names = "--without-s3g",
+description = "Disable S3 Gateway")
+private boolean withoutS3g;
+
+@Option(names = "--ephemeral",
+description = "Delete the data directory on shutdown")
+private boolean ephemeral;
+
+@Option(names = "--startup-timeout",
+description = "How long to wait for the local cluster to become ready")
+private String startupTimeout;
+
+@Option(names = "--s3-access-key",
+description = "Suggested local AWS access key to print on startup")
+private String

Re: [PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


Copilot commented on code in PR #10147:
URL: https://github.com/apache/ozone/pull/10147#discussion_r3147982740


##
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##
@@ -0,0 +1,385 @@
+/*
+ * 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.local;
+
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.time.format.DateTimeParseException;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Internal CLI entry point for local single-node Ozone commands.
+ */
+@Command(name = "ozone local",
+hidden = true,
+description = "Internal commands for local single-node Ozone",
+versionProvider = HddsVersionProvider.class,
+mixinStandardHelpOptions = true,
+subcommands = {
+OzoneLocal.RunCommand.class
+})
+public class OzoneLocal extends GenericCli {
+
+  static final String ENV_DATA_DIR = "OZONE_LOCAL_DATA_DIR";
+  static final String ENV_FORMAT = "OZONE_LOCAL_FORMAT";
+  static final String ENV_DATANODES = "OZONE_LOCAL_DATANODES";
+  static final String ENV_HOST = "OZONE_LOCAL_HOST";
+  static final String ENV_BIND_HOST = "OZONE_LOCAL_BIND_HOST";
+  static final String ENV_SCM_PORT = "OZONE_LOCAL_SCM_PORT";
+  static final String ENV_OM_PORT = "OZONE_LOCAL_OM_PORT";
+  static final String ENV_S3G_ENABLED = "OZONE_LOCAL_S3G_ENABLED";
+  static final String ENV_S3G_PORT = "OZONE_LOCAL_S3G_PORT";
+  static final String ENV_EPHEMERAL = "OZONE_LOCAL_EPHEMERAL";
+  static final String ENV_STARTUP_TIMEOUT = "OZONE_LOCAL_STARTUP_TIMEOUT";
+  static final String ENV_S3_ACCESS_KEY = "OZONE_LOCAL_S3_ACCESS_KEY";
+  static final String ENV_S3_SECRET_KEY = "OZONE_LOCAL_S3_SECRET_KEY";
+  static final String ENV_S3_REGION = "OZONE_LOCAL_S3_REGION";
+
+  public OzoneLocal() {
+super();
+  }
+
+  OzoneLocal(CommandLine.IFactory factory) {
+super(factory);
+  }
+
+  public static void main(String[] args) {
+new OzoneLocal().run(args);
+  }
+
+  @Command(name = "run",
+  hidden = true,
+  description = "Internal placeholder for a local Ozone runtime")
+  static class RunCommand implements Callable {
+
+private final Map environment;
+
+@Option(names = "--data-dir",
+description = "Persistent data directory for the local cluster")
+private String dataDir;
+
+@Option(names = "--format",
+description = "Storage init mode: if-needed, always, never")
+private String format;
+
+@Option(names = "--datanodes",
+description = "Number of datanodes to start")
+private Integer datanodes;
+
+@Option(names = "--host",
+description = "Advertised host to write into local service addresses")
+private String host;
+
+@Option(names = "--bind-host",
+description = "Bind host for HTTP and RPC listeners")
+private String bindHost;
+
+@Option(names = "--scm-port",
+description = "SCM client RPC port (0 means auto-allocate)")
+private Integer scmPort;
+
+@Option(names = "--om-port",
+description = "OM RPC port (0 means auto-allocate)")
+private Integer omPort;
+
+@Option(names = "--s3g-port",
+description = "S3 Gateway HTTP port (0 means auto-allocate)")
+private Integer s3gPort;
+
+@Option(names = "--without-s3g",
+description = "Disable S3 Gateway")
+private boolean withoutS3g;
+
+@Option(names = "--ephemeral",
+description = "Delete the data directory on shutdown")
+private boolean ephemeral;
+
+@Option(names = "--startup-timeout",
+description = "How long to wait for the local cluster to become ready")
+private String startupTimeout;
+
+@Option(names = "--s3-access-key",
+description = "Suggested local AWS access key to print on startup")
+private String

[PR] HDDS-15082. Add User facing Config Contract [ozone]

2026-04-27 Thread via GitHub


henrybear327 opened a new pull request, #10147:
URL: https://github.com/apache/ozone/pull/10147

   ## What changes were proposed in this pull request?
   
   Introduce user-facing paremeters for local ozone cluster spin up.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15082
   
   ## How was this patch tested?
   
   Unit tests.
   


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