Skip to content

HDDS-15082. Add User facing Config Contract#10147

Open
henrybear327 wants to merge 2 commits intoapache:masterfrom
henrybear327:HDDS-15082
Open

HDDS-15082. Add User facing Config Contract#10147
henrybear327 wants to merge 2 commits intoapache:masterfrom
henrybear327:HDDS-15082

Conversation

@henrybear327
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an internal ozone local CLI surface and supporting configuration objects to define a user-facing configuration contract for spinning up a local single-node Ozone cluster.

Changes:

  • Introduces OzoneLocal (hidden) CLI with run subcommand and env/CLI-based config resolution into LocalOzoneClusterConfig.
  • Adds LocalOzoneClusterConfig and LocalOzoneRuntime as the local runtime contract/config model.
  • Adds unit tests covering command metadata/help visibility and config parsing/precedence/validation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java New internal CLI entry point and config resolution logic from flags/env vars.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneClusterConfig.java New config model + builder + FormatMode parsing for user-facing values.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneRuntime.java New runtime interface contract for local single-node runtimes.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/package-info.java New package documentation for the local runtime support package.
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/local/TestOzoneLocal.java Tests for CLI metadata, help behavior, and env/CLI precedence + validation errors.
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/local/TestLocalOzoneClusterConfig.java Tests for builder defaults/overrides and FormatMode parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

: parsePort(environment.get(ENV_S3G_PORT), ENV_S3G_PORT,
LocalOzoneClusterConfig.DEFAULT_PORT);

boolean resolvedS3gEnabled = withoutS3g ? false
Comment on lines +194 to +196
boolean resolvedEphemeral = ephemeral || parseBoolean(
environment.get(ENV_EPHEMERAL), ENV_EPHEMERAL,
LocalOzoneClusterConfig.DEFAULT_EPHEMERAL);
Comment on lines +154 to +158
public static FormatMode fromString(String value) {
String normalized = value.trim().toUpperCase(Locale.ROOT)
.replace('-', '_');
return valueOf(normalized);
}
Comment on lines +147 to +151
@Override
public Void call() {
resolveConfig(new OzoneConfiguration());
return null;
}
Comment on lines +87 to +89
@Option(names = "--format",
description = "Storage init mode: if-needed, always, never")
private String format;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +300 to +318
private static boolean parseBoolean(String rawValue, String source,
boolean fallback) {
if (isBlank(rawValue)) {
return fallback;
}
String value = rawValue.trim();
if ("true".equalsIgnoreCase(value)
|| "yes".equalsIgnoreCase(value)
|| "on".equalsIgnoreCase(value)) {
return true;
}
if ("false".equalsIgnoreCase(value)
|| "no".equalsIgnoreCase(value)
|| "off".equalsIgnoreCase(value)) {
return false;
}
throw new IllegalArgumentException("Unable to parse " + source
+ " as a boolean. Use true/false, yes/no, or on/off.");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please could you help me to look if there is any existing helper for this?

return parseFormat(rawValue, source);
}

private static int parseInt(String rawValue, String source, int fallback) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return parseDuration(rawValue, source, baseConfiguration);
}

private static Duration parseDuration(String rawValue, String source,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7ce1aa3#r3148108852
ditto
can use ai to scan all of these parsers

@ivandika3 ivandika3 added the ozone-local HDDS-14893 label Apr 28, 2026
@peterxcli
Copy link
Copy Markdown
Member

@henrybear327 please merge upstream master, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ozone-local HDDS-14893

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants