Skip to content

HDDS-15881. Support setting storagePolicy via SetBucketProperty - #11232

Open
anuragp010 wants to merge 1 commit into
apache:HDDS-11233from
anuragp010:HDDS-15881
Open

anuragp010 wants to merge 1 commit into
apache:HDDS-11233from
anuragp010:HDDS-15881

Conversation

@anuragp010

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds client-facing support for managing a bucket's storage policy. The ozone sh bucket create and bucket update commands now support --storage-policy/-s to set a storage policy and --allow-fallback-storage-policy/-a to enable or disable fallback. Passing --storage-policy null on bucket update indicates the storage policy should be unset, which required wiring from the client side through the proto layer to the server side. This patch represents patch-15 of the storage policy series and diverges from the original in its CLI flags, as picocli's style check now rejects the original -sp, -asp, and --allowFallBackStoragePolicy.

What is the link to the Apache JIRA

HDDS-15881

How was this patch tested?

  1. Newly added Unit Test and Integration Test

@anuragp010
anuragp010 marked this pull request as ready for review September 11, 2026 18:51

@sarvekshayr sarvekshayr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @anuragp010 for the patch. Please address the below inline comments.

}

@Test
@SuppressWarnings("methodlength")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Avoid @SuppressWarnings in new code. Also applies to test method testShUpdateBucketStoragePolicy.

Comment on lines +73 to +74
description = "Bucket StoragePolicy. Allowed values: HOT, WARM, COLD, null. Default: WARM.",
defaultValue = "WARM")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use the showDefaultValue attribute instead of adding default in description.

Suggested change
description = "Bucket StoragePolicy. Allowed values: HOT, WARM, COLD, null. Default: WARM.",
defaultValue = "WARM")
description = "Bucket StoragePolicy. Allowed values: HOT, WARM, COLD, null.",
defaultValue = "WARM",
showDefaultValue = CommandLine.Help.Visibility.ALWAYS)

description = "When true, allocation may fall back to the StoragePolicy's " +
"fallback tier if the creation tier is unavailable. Default: true.",
defaultValue = "true")
private String allowFallBackStoragePolicyStr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use boolean instead of String for allowFallBackStoragePolicy field?

Suggested change
private String allowFallBackStoragePolicyStr;
private boolean allowFallBackStoragePolicy;

Use the showDefaultValue attribute instead of adding default in description.

public static final String STORAGE_TYPE = "storageType";
public static final String STORAGE_POLICY = "storagePolicy";
public static final String ALLOW_FALLBACK_STORAGE_POLICY = "allowFallbackStoragePolicy";
public static final String UNSET_STORAGE_POLICY = "unSetStoragePolicy";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Let’s use unset as it reads better than unSet.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants