chungen0126 commented on code in PR #6989:
URL: https://github.com/apache/ozone/pull/6989#discussion_r2993177512


##########
hadoop-hdds/docs/content/design/storage-policy.md:
##########
@@ -19,379 +20,588 @@ status: draft
 
 # Terminology
 
-## Terminology
+## Definitions
 
 - Storage Policy: Defines where key data replicas should be stored in specific 
storage tiers.
-- Storage Type: The types of disks/Container replicas in a Datanode, storage 
type could include RAM_DISK, SSD, HDD, ARCHIVE, etc.
-- Storage Tier: A set of Container replicas in a cluster that satisfy the 
storage policy.
-- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode..
-- prefix: The prefix in this article, unless otherwise specified, refers to 
the prefix of the storage policy type, not the ACL prefix. The prefix of the 
storage policy type is used to configure the prefix of the storage policy for 
the specified prefix.
+- Storage Type: The type of each Datanode volume or container replica. Each 
Datanode volume can be configured with a
+  storage type, including SSD, DISK, and ARCHIVE.
+- Storage Tier: A specific storage tier is composed of all replicas of a 
container based on their storage type. For
+  example, a 3-replica SSD tier consists of 3 replicas of SSD type.
+- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode.
+- Key: In this document, a key refers to an object in Ozone, including entries 
in both the KeyTable and FileTable.
 
 ## Storage Policy vs Storage Type vs Storage Tier
 
 
![storage-policy](https://issues.apache.org/jira/secure/attachment/13070477/storage-policy.png)
 
-The relation of Storage Policy, Storage Type and Storage Tier
+The relationship between Storage Policy, Storage Type, and Storage Tier:
 
-- The storage policy is the property of key/bucket/ prefix (Managed by OM);
-- The storage tier is the property of Pipeline and Container (Managed by SCM);
-- The storage type is the property of volume and Container replicas (Managed 
by DN);
-- Only the storage policy can be modified by the user directly via ozone 
command;
+- The storage policy is the property of key/bucket (managed by OM).
+- The storage tier is the property of Pipeline and Container (managed by SCM).
+- The storage type is the property of volume and container replica (managed by 
DN).
+- Only the storage policy can be modified by the user directly via the ozone 
command.
 
 Example:
 
-For a keyA, its storage policy is Hot, its Container 1 tier is SSD tier, and 
Container 1 has three replicas, all of which are of the SSD storage type.
+For a keyA, its storage policy is Hot, Its Container tier is SSD tier, the 
Container has three replicas, all of which
+are of the SSD storage type.
 
 # User Scenarios
 
-- User A needs a bucket that supports high-performance IO, so create a bucket 
with the storage policy set to Hot. Data written by User A to bucket will 
automatically be distributed across the SSD disks in the cluster.
-- User B needs higher IO performance for the directory/prefix 
/project/metadata, so set the storage policy for the prefix /project/metadata 
to Hot. Subsequently, data written to /project/metadata will be automatically 
distributed across the SSD disks in the cluster.
-- User C has already written key1 to the cluster and requires better IO 
performance. The storage policy for key1 can be set to Hot, and then a 
migration can be triggered to move key1 to the SSD disks.
-- Use D use command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class XXX` upload a file the Ozone SSD tier
+- User A needs a bucket that supports high-performance IO, so they create a 
bucket with the storage policy set to Hot.
+  Data written by User A to the bucket will automatically be distributed 
across SSD disks in the cluster.
+- User B needs higher IO performance for a specific key. They write a key with 
the storage policy set to Hot. The
+  key's data will be distributed across SSD disks in the cluster.
+- User C uses the command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class STANDARD` to upload a file
+  to the Ozone SSD tier. The key's data will be distributed across SSD disks 
in the cluster.
+
+# Goals
+
+- Storage Policy: Introduce storage policy and related concepts. Define 
multiple storage policies and support S3
+  storage class.
+- Storage Policy Writing: Allow writing keys/files to specified storage tiers 
based on storage policy. Support S3,
+  API, and shell command interfaces.
+- Storage Policy Update: Enable setting and unsetting storage policies for 
buckets, and setting storage tiers for
+  containers.
+- Storage Policy Display: Support displaying the storage policy attribute of 
buckets and keys. Support displaying the
+  storage tier of SCM containers and pipelines. Support displaying Datanode 
storage type usage information. Support
+  checking whether the key storage policy is satisfied.
+- Container Balancer: Support migrating container replicas between Datanodes 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+- ReplicationManager: Support managing the storage type of container replicas 
to ensure that container replicas on
+  Datanodes reside on the correct volumes. Ensure that the storage types of 
container replicas forming a storage
+  tier are correct. For example, a 3-replica SSD storage tier container in SCM 
should consist of 3 SSD type container
+  replicas, and each container replica should reside on an SSD type volume.
+- DiskBalancerService: Support migrating container replicas within a Datanode 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+
+# Design
+
+## Supported Storage Policies
+
+- Supported storage policies: Hot / Warm / Cold
+- Supported storage tiers: SSD / DISK / ARCHIVE / EMPTY
+- Supported storage types: SSD / DISK / ARCHIVE
+- Supported bucket layouts: FILE_SYSTEM_OPTIMIZED, OBJECT_STORE, LEGACY
+- S3 storage classes: STANDARD / STANDARD_IA / GLACIER
+
+### Storage Policy Map to Storage Tier
 
-# Current Status
+| Storage Policy | Storage Tier for Write | Fallback Tier for Write |
+|----------------|------------------------|-------------------------|
+| Hot            | SSD                    | DISK                    |
+| Warm           | DISK                   | EMPTY                   |
+| Cold           | ARCHIVE                | EMPTY                   |
 
-- Ozone currently has some support for tiered storage such as storage type, 
and some parts of this article may already be implemented.
-- Currently, in Ozone, when a key is created, the key's Block can appear on 
any volume of a Datanode. When a key is created, SCM first needs to allocate a 
Block for the key through Pipelines. The Client then writes the Block to the 
corresponding Datanode based on the Pipeline information. In this process, the 
smallest element managed by the SCM Pipeline is the Datanode, and when the 
Datanode creates a Container, the Container may appear on any volume with 
enough remaining space. Under the current architecture, Ozone does not support 
writing data to specific disks
+- Storage Tier for Write: The primary storage tier where data is written when 
a storage policy is specified.
+- Fallback Tier for Write: If the specified storage policy cannot be satisfied 
with the primary storage tier, SCM
+  will attempt to use this fallback tier to meet the policy requirements. 
EMPTY means no fallback is available.
 
-# Goal Requirements Specification
+### Storage Tier Map to Storage Type
 
-### **Support for Storage Policy Writing and Management**
+| Tier    | Storage Type of Pipeline | One Replica Container Storage Type | 
Three Replica Container Storage Type | EC Container Replicas Storage Type |
+|---------|--------------------------|-------------------------------------|--------------------------------------|-------------------------------------|
+| SSD     | SSD                      | SSD                                 | 3 
SSD                                | n SSD                               |
+| DISK    | DISK                     | DISK                                | 3 
DISK                               | n DISK                              |
+| ARCHIVE | ARCHIVE                  | ARCHIVE                             | 3 
ARCHIVE                            | n ARCHIVE                           |
+| EMPTY   | -                        | -                                   | - 
                                   | -                                   |
 
-- **Writing keys**: Allow keys to be written to specified storage tiers based 
on storage policies.
-- **Policy Management**: Enable setting, unsetting, and inheriting storage 
policies for keys, prefixes, and buckets. Inherit policies based on the longest 
matching prefix or bucket if no specific policy is set.
+### Fallback Storage Type for Container Replica Replication/Migration
 
-### **Support for Data Migration Across Different Storage Policies**
+| Container Replica Storage Type | Fallback Storage Types (ordered) [1] |
+|--------------------------------|--------------------------------------|
+| SSD                            | DISK, ARCHIVE                        |
+| DISK                           | ARCHIVE                              |
+| ARCHIVE                        | none                                 |
 
-- **Data Migration**: Support data migration across different storage policies 
via manual triggers, ensuring data is moved to the appropriate storage tiers.
+- Fallback Storage Type: During the container replica replication or migration 
process, if SCM cannot find a suitable

Review Comment:
   During the container replica replication or migration process, I think we 
should prioritize migrating those fallbacked data back to their storage type 
once there is enough space.



##########
hadoop-hdds/docs/content/design/storage-policy.md:
##########
@@ -19,379 +20,588 @@ status: draft
 
 # Terminology
 
-## Terminology
+## Definitions
 
 - Storage Policy: Defines where key data replicas should be stored in specific 
storage tiers.
-- Storage Type: The types of disks/Container replicas in a Datanode, storage 
type could include RAM_DISK, SSD, HDD, ARCHIVE, etc.
-- Storage Tier: A set of Container replicas in a cluster that satisfy the 
storage policy.
-- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode..
-- prefix: The prefix in this article, unless otherwise specified, refers to 
the prefix of the storage policy type, not the ACL prefix. The prefix of the 
storage policy type is used to configure the prefix of the storage policy for 
the specified prefix.
+- Storage Type: The type of each Datanode volume or container replica. Each 
Datanode volume can be configured with a
+  storage type, including SSD, DISK, and ARCHIVE.
+- Storage Tier: A specific storage tier is composed of all replicas of a 
container based on their storage type. For
+  example, a 3-replica SSD tier consists of 3 replicas of SSD type.
+- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode.
+- Key: In this document, a key refers to an object in Ozone, including entries 
in both the KeyTable and FileTable.
 
 ## Storage Policy vs Storage Type vs Storage Tier
 
 
![storage-policy](https://issues.apache.org/jira/secure/attachment/13070477/storage-policy.png)
 
-The relation of Storage Policy, Storage Type and Storage Tier
+The relationship between Storage Policy, Storage Type, and Storage Tier:
 
-- The storage policy is the property of key/bucket/ prefix (Managed by OM);
-- The storage tier is the property of Pipeline and Container (Managed by SCM);
-- The storage type is the property of volume and Container replicas (Managed 
by DN);
-- Only the storage policy can be modified by the user directly via ozone 
command;
+- The storage policy is the property of key/bucket (managed by OM).
+- The storage tier is the property of Pipeline and Container (managed by SCM).
+- The storage type is the property of volume and container replica (managed by 
DN).
+- Only the storage policy can be modified by the user directly via the ozone 
command.
 
 Example:
 
-For a keyA, its storage policy is Hot, its Container 1 tier is SSD tier, and 
Container 1 has three replicas, all of which are of the SSD storage type.
+For a keyA, its storage policy is Hot, Its Container tier is SSD tier, the 
Container has three replicas, all of which
+are of the SSD storage type.
 
 # User Scenarios
 
-- User A needs a bucket that supports high-performance IO, so create a bucket 
with the storage policy set to Hot. Data written by User A to bucket will 
automatically be distributed across the SSD disks in the cluster.
-- User B needs higher IO performance for the directory/prefix 
/project/metadata, so set the storage policy for the prefix /project/metadata 
to Hot. Subsequently, data written to /project/metadata will be automatically 
distributed across the SSD disks in the cluster.
-- User C has already written key1 to the cluster and requires better IO 
performance. The storage policy for key1 can be set to Hot, and then a 
migration can be triggered to move key1 to the SSD disks.
-- Use D use command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class XXX` upload a file the Ozone SSD tier
+- User A needs a bucket that supports high-performance IO, so they create a 
bucket with the storage policy set to Hot.
+  Data written by User A to the bucket will automatically be distributed 
across SSD disks in the cluster.
+- User B needs higher IO performance for a specific key. They write a key with 
the storage policy set to Hot. The
+  key's data will be distributed across SSD disks in the cluster.
+- User C uses the command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class STANDARD` to upload a file
+  to the Ozone SSD tier. The key's data will be distributed across SSD disks 
in the cluster.
+
+# Goals
+
+- Storage Policy: Introduce storage policy and related concepts. Define 
multiple storage policies and support S3
+  storage class.
+- Storage Policy Writing: Allow writing keys/files to specified storage tiers 
based on storage policy. Support S3,
+  API, and shell command interfaces.
+- Storage Policy Update: Enable setting and unsetting storage policies for 
buckets, and setting storage tiers for
+  containers.
+- Storage Policy Display: Support displaying the storage policy attribute of 
buckets and keys. Support displaying the
+  storage tier of SCM containers and pipelines. Support displaying Datanode 
storage type usage information. Support
+  checking whether the key storage policy is satisfied.
+- Container Balancer: Support migrating container replicas between Datanodes 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+- ReplicationManager: Support managing the storage type of container replicas 
to ensure that container replicas on
+  Datanodes reside on the correct volumes. Ensure that the storage types of 
container replicas forming a storage
+  tier are correct. For example, a 3-replica SSD storage tier container in SCM 
should consist of 3 SSD type container
+  replicas, and each container replica should reside on an SSD type volume.
+- DiskBalancerService: Support migrating container replicas within a Datanode 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+
+# Design
+
+## Supported Storage Policies
+
+- Supported storage policies: Hot / Warm / Cold
+- Supported storage tiers: SSD / DISK / ARCHIVE / EMPTY
+- Supported storage types: SSD / DISK / ARCHIVE
+- Supported bucket layouts: FILE_SYSTEM_OPTIMIZED, OBJECT_STORE, LEGACY
+- S3 storage classes: STANDARD / STANDARD_IA / GLACIER
+
+### Storage Policy Map to Storage Tier
 
-# Current Status
+| Storage Policy | Storage Tier for Write | Fallback Tier for Write |
+|----------------|------------------------|-------------------------|
+| Hot            | SSD                    | DISK                    |
+| Warm           | DISK                   | EMPTY                   |
+| Cold           | ARCHIVE                | EMPTY                   |
 
-- Ozone currently has some support for tiered storage such as storage type, 
and some parts of this article may already be implemented.
-- Currently, in Ozone, when a key is created, the key's Block can appear on 
any volume of a Datanode. When a key is created, SCM first needs to allocate a 
Block for the key through Pipelines. The Client then writes the Block to the 
corresponding Datanode based on the Pipeline information. In this process, the 
smallest element managed by the SCM Pipeline is the Datanode, and when the 
Datanode creates a Container, the Container may appear on any volume with 
enough remaining space. Under the current architecture, Ozone does not support 
writing data to specific disks
+- Storage Tier for Write: The primary storage tier where data is written when 
a storage policy is specified.
+- Fallback Tier for Write: If the specified storage policy cannot be satisfied 
with the primary storage tier, SCM
+  will attempt to use this fallback tier to meet the policy requirements. 
EMPTY means no fallback is available.
 
-# Goal Requirements Specification
+### Storage Tier Map to Storage Type
 
-### **Support for Storage Policy Writing and Management**
+| Tier    | Storage Type of Pipeline | One Replica Container Storage Type | 
Three Replica Container Storage Type | EC Container Replicas Storage Type |
+|---------|--------------------------|-------------------------------------|--------------------------------------|-------------------------------------|
+| SSD     | SSD                      | SSD                                 | 3 
SSD                                | n SSD                               |
+| DISK    | DISK                     | DISK                                | 3 
DISK                               | n DISK                              |
+| ARCHIVE | ARCHIVE                  | ARCHIVE                             | 3 
ARCHIVE                            | n ARCHIVE                           |
+| EMPTY   | -                        | -                                   | - 
                                   | -                                   |
 
-- **Writing keys**: Allow keys to be written to specified storage tiers based 
on storage policies.
-- **Policy Management**: Enable setting, unsetting, and inheriting storage 
policies for keys, prefixes, and buckets. Inherit policies based on the longest 
matching prefix or bucket if no specific policy is set.
+### Fallback Storage Type for Container Replica Replication/Migration
 
-### **Support for Data Migration Across Different Storage Policies**
+| Container Replica Storage Type | Fallback Storage Types (ordered) [1] |
+|--------------------------------|--------------------------------------|
+| SSD                            | DISK, ARCHIVE                        |
+| DISK                           | ARCHIVE                              |
+| ARCHIVE                        | none                                 |
 
-- **Data Migration**: Support data migration across different storage policies 
via manual triggers, ensuring data is moved to the appropriate storage tiers.
+- Fallback Storage Type: During the container replica replication or migration 
process, if SCM cannot find a suitable
+  volume type that matches the original container replica's storage type, it 
will attempt to use the fallback storage
+  types in order.
 
-### **Adaptation of AWS S3 StorageClass**
+[1] A container replica does not know the storage policy of the key or the 
storage tier of the SCM container it belongs
+to. The container replica only knows its own expected storage type, which is 
why the column name is "Fallback Storage
+Types" rather than "Fallback Storage Tier".
 
-- **S3 StorageClass Mapping**: Map AWS S3 storage classes to Ozone storage 
policies, supporting related API operations (PutObject, CopyObject, Multipart 
Upload, GetObject, HeadObject, ListObjects).
+### AWS S3 StorageClass
 
-### **Management and Monitoring Tools**
+| AWS S3 StorageClass | Ozone Storage Policy |
+|---------------------|----------------------|
+| STANDARD [1]        | Hot                  |
+| STANDARD_IA         | Warm                 |
+| GLACIER             | Cold                 |
+| DEEP_ARCHIVE        | Warm                 |
 
-- **Storage Policy Commands**: Provide tools to view storage policies of 
containers, datanode usage, and pipeline information.
-- **Metrics and Monitoring**: Enable visibility into storage policy 
compliance, container storage types, and space information across different 
storage policies.
+> AWS StorageClass Valid Values: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | 
ONEZONE_IA | INTELLIGENT_TIERING |
+> GLACIER | DEEP_ARCHIVE | OUTPOSTS | GLACIER_IR | SNOW | EXPRESS_ONEZONE
+> According to AWS S3 documentation, STANDARD is the highest performance S3 
StorageClass, but its name is STANDARD,
+> which is not straightforward to map to the Ozone SSD tier.
 
-### **Future Enhancements**
+[1] The field names here reuse the AWS S3 field names, but the actual 
semantics differ from AWS S3. For example, in
+Ozone, STANDARD represents the Hot storage policy, while in AWS S3, STANDARD 
has different semantics.
 
-- **Intelligent Storage Policies**: Plan to support automatic data migration 
based on access frequency, similar to S3 Intelligent-Tiering.
-- **Bucket StorageClass Lifecycle Rules: Support setting storage policies 
Lifecycle Rules at the bucket level.**
-- **Recon Support**: Enhance Recon to display relevant storage tier 
information.
+## Component Changes
 
-# Detailed Requirements Specification
+### Datanode Container Replica
 
-## Storage Policy and Storage Types
+A storage type field is added to container replicas on Datanodes, which is 
persisted in the container's metadata YAML
+file.
 
-### Supported Storage Types
+### Bucket, Key
 
-- Specify the Storage Type for each volume through configuration. If no 
Storage Type is specified, the default value will be DISK.
-- Support Storage Type:SSD / DISK / ARCHIVE / RAM_DISK
+A storage policy attribute is added to buckets and keys on OM.
 
-### Supported Storage Policies
+### SCM Container, Pipeline
 
-Support storage policy: Hot , Warm, Cold
+A storage tier attribute is added to containers and pipelines on SCM. A 
pipeline can support multiple storage tiers.
+For example, if all Datanodes in a pipeline have both SSD and DISK type 
volumes, the pipeline's supported storage tier
+attributes will include both SSD and DISK.
 
-### Storage Policies Map To Storage Tiers
+## Datanode Volume Storage Type
 
-| Storage Policy | Storage Tier for Write | Fallback Tier for Write |
-| --- | --- | --- |
-| Hot | SSD | DISK |
-| Warm | DISK | none |
-| Cold | ARCHIVE | none |
-- **Storage Tier For Write**: The priority storage tier where data is written 
when storage policy is specified.
-- **Fallback Tier for Write**: If the specified storage policy cannot be 
satisfied with the priority storage tier, the SCM will attempt to use this 
fallback tier to meet the policy requirements.
+- Referencing HDFS [1], use configuration to define the storage type of each 
volume. If no storage type information is
+  configured for a volume, the storage type will be DISK.
+  - For example:
+    ```xml
+    <property>
+      <name>hdds.datanode.dir</name>
+      <value>[SSD]/mnt/disk/0/ozone,[DISK]/mnt/disk/1/ozone</value>
+    </property>
+    ```
+    Volume /mnt/disk/0/ozone will be SSD storage type, and Volume 
/mnt/disk/1/ozone will be DISK storage type.
 
-### Storage Tier Map To Storage Type
+[1] Refer to 
https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/ArchivalStorage.html
 section
+Configuration.
 
-| Tier | StorageType of Pipeline | One Replication 
-Container Replicas Storage Type | Three replication
-Container Replicas Storage Type | EC
-Container Replicas Storage Type |
-| --- | --- | --- | --- | --- |
-| SSD | SSD | SSD | 3 SSD | n SSD |
-| DISK | DISK | DISK | 3 DISK | n DISK |
-| ARCHIVE | ARCHIVE | ARCHIVE | 3 ARCHIVE | n ARCHIVE |
+## Writing Keys with Storage Policy
 
-### Fallback Storage Type For Container replicas Replication/Migration
+### Ozone Filesystem
 
-| Container Replicas Type | Container Replicas Fallback Storage Type [1] |
-| --- | --- |
-| SSD | DISK |
-| DISK | none |
-| ARCHIVE | none |
-- Container Replicas Fallback Storage Type: During the Container replicas 
replication or migration process, if the SCM cannot find a suitable volume type 
that matches the original Container replica's storage type, it will attempt to 
use this fallback storage tier.
+- Support specifying a storage policy when writing a key.
+  - If a storage policy is specified when writing a key, the key storage 
policy is the specified storage policy.
+  - If a storage policy is not specified when writing a key, the storage 
policy of the key will depend on the bucket.
+    If the bucket does not have a storage policy set, the default storage 
policy is determined by the configuration
+    `ozone.default.storagepolicy`, the default value is WARM.
 
-[1] For a Container replicas, it will not know the Storage Policy of the 
Container’s key or the tier of the SCM Container located, the Container 
replicas just know its own expected storage type, So column name is “Fallback 
Storage Type”
+- Fallback strategy:
+  - When writing a key, if data cannot be written to the specified storage 
tier, it can be written to the fallback
+    storage tier, provided the fallback storage tier is not EMPTY and fallback 
is allowed.
+  - Fallback control: Fallback can be controlled at the bucket granularity. If 
allowed, the key will attempt to write
+    to the fallback storage tier. The default is to allow fallback.
 
-## Support for Ozone Storage Policy Writing and Management
+### S3
 
-### Support storage policy writing
+- If StorageClass is specified in the request, the storage policy is derived 
from the StorageClass in the request.
+- If StorageClass is not specified in the request, the storage policy of the 
bucket is used.
+- If the storage policy of the bucket is null, the storage policy is 
determined by the configuration
+  `ozone.s3.default.storagepolicy`, the default value is STANDARD_IA, which 
maps to Ozone storage policy WARM.
 
-- Support specifying a storage policy when writing a key.
-    - If a storage policy is specified when writing a key, the key storage 
policy is the specified storage policy.
-    - If no storage policy is specified, the default behavior refers to the 
"Inheritance of storage policy" section.
-    - If a key neither inheriting any storage policy nor specified a storage 
policy when writing a key, then the key storage policy will be default storage 
policy (can refers to the "default storage policy" section)
-    - If the priority storage policy is not satisfied, support writing to the 
fallback tier if the fallbackStrategy is “allow”
+### Supported APIs
 
-### Support fallback strategy configuration
+#### Ozone Filesystem
 
-- fallbackStrategy
-    - Allow (default): In this case, the behavior is similar to HDFS, with 
automatic fallback, and it does not trigger errors or additional alerts;
-    - Prohibit: Prohibit fallback; if a tier that satisfies the storage policy 
cannot be found, the write operation fails directly.
+- createKey
+- createStreamKey
+- createFile
+- createStreamFile
+- initiateMultipartUpload
 
-### Inheritance of storage policies
+#### S3 Request
 
-- If no storage policy is specified (undefined storage policy) when writing a 
key, the key's storage policy inherits the longest matching prefix. If there is 
no matching prefix, it inherits the storage policy of the bucket. If the bucket 
has no effective storage policy [1], the key's storage policy will be the 
default storage policy .
-- If a key is created with an effective storage policy, the storage policy of 
the key will not change with the storage policy changing of the bucket or 
prefix.
+Refer to
+[Using Amazon S3 storage classes - Amazon Simple Storage 
Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html)
 
-[1] Effective storage policy means a non-empty storage policy.
+- PutObject:
+  - Support specifying the StorageClass parameter in the PutObject request to 
determine the storage policy for the
+    object.
+- CopyObject:
+  - Support specifying a new storage policy (StorageClass) in the CopyObject 
request and applying the new storage
+    policy when copying the object from the source location to the target 
location. If no new storage policy is
+    specified, inherit the storage policy of the source object.
+- Multipart Upload:
+  - Support specifying the StorageClass parameter in the CreateMultipartUpload 
request and following the StorageClass
+    parameter of CreateMultipartUpload in UploadPart.
+- GetObject:
+  - Return the current storage policy of the object in the GetObject response.
+- HeadObject:
+  - Return the metadata of the object, including its storage policy 
(StorageClass).
+- ListObjects:
+  - Include the storage policy (StorageClass) information of each object in 
the ListObjects response.
 
-### undefined storage policy
+### Write Key Process
 
-- If the user does not specify any storage policy when creating a key, the 
user's storage policy is undefined storage policy.
-- Even if the user's key inherits the storage policy of the bucket/prefix, the 
user's storage policy is still undefined storage policy.
-- Undefined storage policy does not mean the key no storage policy. if the key 
inherits a storage policy, the key actual storage policy is the inherited 
storage policy.
-- The undefined storage policy will change as the changing of the 
prefix/bucket storage policy, including when the key is renamed to a prefix 
with a different storage policy.
+#### Normal Write (No Fallback)
 
-### default storage policy
+![create-key-with-storage-policy](https://issues.apache.org/jira/secure/attachment/13081145/create-key-with-storage-policy.png)
 
-- If a key neither inheriting any storage policy nor specified a storage 
policy when writing a key, then the key storage policy will be default storage 
policy
-- The default storage policy is the storage policy for existing keys before 
the storage policy feature is launched. That is, all keys have at least the 
default storage policy, even if the key was created before the storage policy 
feature was launched.
-- If the user has not configured a default storage policy, the default storage 
policy should be Warm.
-- The default storage policy can be configured.
+- Client sends CreateKey request to OM with storage policy Hot.
+- OM requests SCM to allocate a container with storage policy Hot.
+- SCM allocates a container and pipeline with storage tier SSD according to 
storage policy Hot.
+- Client determines the storage type of the chunk to be SSD according to the 
storage tier SSD.
+- DN creates the container or writes the chunk on the specified storage medium 
according to the storage type.
 
-## Storage policy management
+#### Fallback Write
 
-### key storage policy
+![fallback-create-key-with-storage-policy](https://issues.apache.org/jira/secure/attachment/13081146/fallback-create-key-with-storage-policy.png)
 
-- Support setting and unsetting the storage policy for keys.
-    - After unsetting the storage policy, the actual storage policy of the key 
refers to the "Inheritance of storage policy" section, or is the default 
storage policy if key do not inherit any storage policy.
-- Support displaying the storage policy in the key list/info results(Include 
whether the storage policy is the default storage policy).
+- Client sends CreateKey request to OM with storage policy Hot.
+- OM requests SCM to allocate a container with storage policy Hot.
+- SCM attempts to allocate a container and pipeline with storage tier SSD 
according to storage policy Hot, but finds
+  that there are no available containers or pipelines with SSD tier. SCM then 
selects the fallback tier DISK.
+- Client determines the storage type of the chunk to be DISK according to the 
fallback storage tier DISK.
+- DN creates the container or writes the chunk on the specified storage medium 
according to the storage type.
 
-### Bucket storage policy management
+### Datanode Container Replica Creation
 
-- Support setting and unsetting storage policies for buckets.
-    - After unsetting the storage policy, the storage policy is the default 
storage policy.
-- Support specifying a storage policy when creating a bucket.
-    - If no storage policy is specified, the storage policy is the default 
storage policy.
-- Support displaying the storage policy in the bucket list/info results 
(Include whether the storage policy is the default storage policy).
+- When the Ozone client writes data to a container replica on a Datanode, the 
storage type is included in the request.
+- When the Datanode receives a write request for a container replica and the 
container does not exist, the Datanode
+  creates the container by selecting an appropriate volume 
(VolumeChoosingPolicy) based on the storage type in the
+  request.
+- If the storage type is not specified when creating a container replica on 
the Datanode, the container replica will be
+  created on a volume of the storage type specified by the configuration 
`hdds.datanode.default.storagetype` (default
+  is DISK). This typically only occurs when a client from an older version 
that does not support the storage policy
+  feature writes data to the Datanode.
+- The Datanode does not perform fallback when creating container replicas. If 
a volume of the storage type specified in
+  the client's write request cannot be found, an exception will be thrown. 
Since SCM selects appropriate Datanodes to
+  create pipelines and allocate containers based on Datanode reports, this 
situation should not occur during normal
+  operation.
 
-### Prefix management
+### SCM Pipeline Creation and Selection
 
-- Support creating, deleting, setting, getting, and listing prefixes.
-- The display of the prefix storage policy should display whether the storage 
policy is the default storage policy
-- A prefix can only have one type of policy.
-- Prefixes do not support unsetting storage policies; deleting a prefix is 
equivalent to unsetting the storage policy.
+- Datanodes report their storage space information to SCM through 
StorageReportProto, including the space usage and
+  storage type of all volumes (the default storage type for a Datanode volume 
is DISK).
+- SCM calculates the supported volume types and capacities for each Datanode 
based on StorageReportProto.
+- When creating a container, SCM selects appropriate Datanodes to create a 
pipeline based on the storage tier
+  corresponding to the storage policy in the request.
+  - For example, the Hot storage policy corresponds to the SSD storage tier. 
For a 3-replica SSD storage tier, the
+    pipeline will consist of 3 Datanodes that have SSD type volumes.
+  - For the Hot storage policy with EC 6+3 replication, the pipeline will 
consist of 9 Datanodes that have SSD
+    type volumes.
+- If SCM cannot find enough suitable Datanodes to create a pipeline, it will 
try to create a pipeline using the
+  fallback tier of the storage policy. If the fallback tier is EMPTY, or the 
fallback tier also cannot find enough
+  suitable Datanodes, the creation fails.
+- SCM does not mix storage types within a storage tier. An SSD storage tier 
pipeline will only consist of Datanodes
+  with SSD type volumes, and will not include Datanodes with only DISK type 
volumes.
+- The storage tier is an attribute of the pipeline, indicating the storage 
tiers supported by that pipeline. A pipeline
+  can support multiple storage tiers. For example, if Datanodes all have both 
SSD and DISK type volumes, the pipeline
+  created on these Datanodes will have supported storage tier attributes of 
both SSD and DISK.
+- When allocating a container through an existing pipeline, SCM filters 
matching pipelines based on their supported
+  storage tiers.
 
-### Support for persistent storage of storage policy changes:
 
-- Use ozone admin storagepolicies satisfyStoragePolicy to trigger the 
migration of corresponding changes, and mark the corresponding storage policy 
changes as completed.
+- BackgroundPipelineCreator will attempt to create pipelines for all storage 
tiers. If the Datanodes in the cluster
+  can support a certain storage tier, BackgroundPipelineCreator will 
automatically create pipelines for that tier.
+- The pipeline count limit is calculated independently for each storage tier.
 
-### FSO type buckets:
+## Storage Policy Update
 
-- Use prefixes to implement directory-level storage policy management, not 
directly support setting storage policies for directories.
-- Do not support setting storage policies for directory-type keys.
+Setting the bucket storage policy is supported. Existing buckets can be 
updated with a new storage policy.
 
-## Adaptation of AWS S3
+- `ozone sh bucket update --storagepolicy <storagePolicyStr>`
+  Allowed values: HOT, WARM, COLD, or null to unset.
 
-### Adaptation of AWS S3 StorageClass
+Setting the SCM container storage tier attribute is supported. This is mainly 
used to update existing containers in the
+cluster so that they have the specified storage tier attribute.
 
-Not all the StorageClass will be support by the Ozone
+- `ozone admin container setstoragetier --storage-tier=<storageTierStr>`
+  Allowed values: SSD, DISK, ARCHIVE, or null to unset.
 
-A possible solution
+## Storage Policy Display
 
-| AWS S3 StorageClass | Ozone StoragePolicy |
-| --- | --- |
-| STANDARD | Hot |
-| STANDARD_IA | Warm |
-| GLACIER | COLD |
+Display the bucket storage policy attribute:
 
-> According to AWS S3 documentation, STANDARD is the highest performance S3 
StorageClass, but its name is STANDARD, which is not easy to convert it to 
OZONE SSD
+- `ozone sh bucket info`
 
-> AWS StorageClass Valid Values: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | 
ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | DEEP_ARCHIVE | OUTPOSTS | 
GLACIER_IR | SNOW | EXPRESS_ONEZONE
+Display the key storage policy attribute:
 
-### Adaptation of AWS S3 Related API
+- `ozone sh key info`
 
-refer to
-[Using Amazon S3 storage classes - Amazon Simple Storage 
Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html)
+Display the container storage tier, the storage type of its replicas, and the 
storage type of the volumes where the
+replicas reside:
 
-- PutObject:
-    - Support specifying the StorageClass parameter in the PutObject request 
to determine the storage policy for the object.
-- CopyObject:
-    - Support specifying a new storage policy (StorageClass) in the CopyObject 
request and applying the new storage policy when migrating the object from the 
source location to the target location. If no new storage policy is specified, 
inherit the storage policy of the source object.
-- Multipart Upload
-    - Support specifying the StorageClass parameter in the 
CreateMultipartUpload request and following the StorageClass parameter of 
CreateMultipartUpload in UploadPart.
-- GetObject operation:
-    - Return the current storage policy of the object in the GetObject 
response.
-- HeadObject:
-    - Support the HeadObject request to return the metadata of the object, 
including its storage policy (StorageClass).
-- ListObjects:
-    - Include the storage policy (StorageClass) information of each object in 
the ListObjects response.
-- Bucket StorageClass Lifecycle Rules:
-    - Support setting storage policies Lifecycle Rules at the bucket level and 
automatically managing the storage policy conversion of objects through 
policies and lifecycle rules. For example, automatically transfer objects from 
SSD to HDD or from HDD to NVMe SSD based on the object's age or access 
frequency.
-- ~~RestoreObject operation: [Not Supported]~~
+- `ozone admin container info`
 
-## Support for Storage Policy Management Commands/Metrics
+List containers filtered by storage tier:
 
-Lists commands that need to be added/adapted to storage policies, but may not 
be all commands
+- `ozone admin container list --storage-tier=<storageTierStr>`
 
-- Storage policy management
-    - `ozone admin storagepolicies list`, lists all supported policies in the 
current cluster.
-    - `ozone admin storagepolicies get ${key}`, get the key storage policy 
(include the inherited storage policy)
-    - `ozone admin storagepolicies check ${key}`, check whether the key 
storage policy is satisfied
-    - `ozone admin storagepolicies satisfyStoragePolicy -bucket / -prefix / 
-key`, triggers migrations to satisfy the corresponding data's storage policy.
-    - `ozone admin storagepolicies satisfyStoragePolicy status -bucket / 
-prefix / -key`, checks the migration status of the storage policy.
-    - `ozone admin storagepolicies checkSatisfyStoragePolicy -bucket / -prefix 
/ -key`, checks whether the specified resource's storage policy is satisfied.
-        - Containers may be migrated to a fallback tier. At this time, the 
storage policy of the corresponding resource is not satisfied.
-- `ozone admin container info`, supports displaying the storage policy of 
Containers.
-- `ozone admin datanode usageinfo`, supports displaying space information 
according to different storage policies.
-- `ozone admin pipeline list`, supports displaying the storage tier supported 
by Pipelines.
-- `ozone admin pipeline create`, supports creating Pipelines that support 
specified storage tier.
-- Datanode volume related Metrics support displaying the storage policies of 
volumes.
-- SCM supports displaying the data space information of different storage 
policies in the cluster.
+Display the storage tiers supported by pipelines associated with Datanodes:
 
-## Storage Policy Satisfier Service
+- `ozone admin datanode list`
 
-- Support data migration across different storage policies.
-    - Storage policy migrations are triggered by ozone admin storagepolicies 
satisfyStoragePolicy. Modifying the storage policy of a bucket/prefix/key does 
not directly trigger storage policy migrations.
-- Support manually setting storage policies for buckets/prefixes/keys and 
implementing asynchronous migrations.
-- Responsible for managing storage policy-related migration work.
-- Responsible for responding to user requests and checking whether the 
specified resources satisfy the storage policy.
+Display Datanode usage information by storage type:
 
-## Permissions Management
+- `ozone admin datanode usageinfo`
 
-- Changing the storage policy of buckets/prefixes/keys requires administrator 
permissions.
+Display cluster-wide space usage information by storage type:
 
-## Storage Policy Supported Replicas Types
+- `ozone admin storagepolicy usageinfo`
 
-- Support replica type storage policies.
-- Support EC type storage policies.
-    - EC types cannot support some storage policies that mix different storage 
media.
+Check whether a key's storage policy is satisfied:
 
-## Storage Policy Supported Bucket Types
+- `ozone admin storagepolicy check`
 
-- Support all types of buckets.
+## Container Balancer
 
-## Compatible HDFS Commands
+- Datanodes report the status information of all containers to SCM through 
ContainerReplicaProto, including the
+  storage type of the container replica itself and the storage type of the 
volume where it resides.
+- Container Balancer supports balancing based on the space usage of each 
storage type. Each storage type is calculated
+  independently. Container replicas are migrated to volumes of the matching 
storage type based on the container
+  replica's storage type.
+- Container Balancer does not perform fallback during migration. It will not 
migrate a container replica to a volume
+  of a different storage type.
 
-HDFS storage policy-related commands are not supported.
+## ReplicationManager
 
-Do not support specified storage policy when creating a file using HDFS 
Filesystem interface, the Hadoop FileSystem (org.apache.hadoop.fs.FileSystem) 
does not support passing the storage policy by Create method.
+- Datanodes report the status information of all containers to SCM through 
ContainerReplicaProto, including the
+  storage type of the container replica itself and the storage type of the 
volume where it resides.
+- Datanodes report their storage space information to SCM through 
StorageReportProto, including the space usage and
+  storage type of all volumes (the default storage type for a Datanode volume 
is DISK).
+- ReplicationManager introduces two new container health states: 
MIS_STORAGE_TYPE_WITH_VOLUME and
+  MIS_STORAGE_TYPE_WITH_CONTAINER.
+  - MIS_STORAGE_TYPE_WITH_VOLUME: Container replica whose storage type 
mismatches its volume's storage type.
+    - ReplicationManager will select a matching volume and migrate the 
container replica for this health state.
+  - MIS_STORAGE_TYPE_WITH_CONTAINER: Container replica whose storage type 
mismatches the container's storage tier.
+    - ReplicationManager will send a command to update the storage type of the 
container replica on the Datanode.
+  - ReplicationManager will first handle MIS_STORAGE_TYPE_WITH_CONTAINER and 
then handle
+    MIS_STORAGE_TYPE_WITH_VOLUME.
+- ReplicationManager uses the SCM container's storage tier as the source of 
truth to check whether the container
+  replicas and the volumes where replicas reside match the storage tier.
+  - If the SCM container's storage tier is null, no storage tier checks will 
be performed. Containers created before
+    the storage policy feature was introduced will have a null storage tier.
+  - To manage existing containers' replicas (e.g., to prevent these container 
replicas from occupying SSD type
+    volume space), the container storage tier needs to be set. Once set, 
ReplicationManager will manage the
+    container replicas based on the storage tier. Otherwise, container 
replicas may reside on volumes of any
+    storage type.
+- When ReplicationManager replicates, migrates, or reconstructs container 
replicas (e.g., for UNDER_REPLICATED or
+  MIS_REPLICATED containers), it selects matching Datanodes based on the 
storage type corresponding to the SCM
+  container's storage tier.
+- When ReplicationManager replicates, migrates, or reconstructs container 
replicas, if it cannot find a matching
+  Datanode, it will try to use the fallback storage types defined by the SCM 
container's storage tier. If the storage
+  tier has no defined fallback storage types, or no Datanodes matching the 
fallback storage types can be found, the
+  operation fails.
 
-- Ozone needs to record the access frequency of keys/buckets.
+## DiskBalancerService
 
-## Recon Side Feature
+- DiskBalancerService calculates space usage and migrates containers between 
volumes of the same storage type within a
+  Datanode.
 
-Support displaying relevant storage tier information in Recon. Need to design 
more detailed. // TODO
+# Configurations
 
-# Architecture Design
+New configuration keys introduced by the storage policy feature:
 
-This section aims to describe the architecture and design concepts of the 
system without delving into specific implementation details. Its purpose is to 
validate the feasibility and rationality of the technical route, as well as to 
assess the workload and technical dependencies of related tasks.
+- `ozone.default.storagepolicy`
+  Default value: WARM. The default storage policy for writing keys when 
neither the key nor the bucket has a storage
+  policy set.
 
-## Writing Key Process
+- `ozone.default.storageTier`
+  Default value: DISK. The default storage tier.
 
-Writing data to the specified tier:
+- `ozone.s3.default.storagepolicy`
+  Default value: STANDARD_IA. The default S3 storage class when StorageClass 
is not specified in the S3 request and
+  the bucket does not have a storage policy set. STANDARD_IA maps to Ozone 
storage policy WARM.
 
-- When a user creates a key, they set the storage policy and fallbackStrategy 
parameters and send the request to the OM:
-    - CreateKey
-    - CreateFile
-    - CreateMultipartKey
-- Community Ozone:
-    - CreateStreamKey
-    - CreateStreamFile
-    - CreateMultipartStreamKey
-- OM adds the storage policy information to the allocateBlock request sent to 
the SCM. The actual storage strategy should be calculated based on the storage 
strategy requirements above.
-- SCM, upon receiving the request, selects the Pipeline based on the storage 
policy and allocates a Container.
-    - The storage type of each Container replicas should be added to for the 
Datanodes in the Pipeline, just like the replicaIndex for the EC key.
-    - If the expected storage tier Pipeline cannot be found, attempt to find 
the fallback tier defined by the storage policy if the fallbackStrategy is 
allowed. If it cannot be found, the creation process fails.
-    - If the SCM needs to create a new Container for a specific storage tier, 
SCM needs to record the Container’s storage tier for the Container. So the 
ContainerData should add a storage tier field.
-- After receiving the Pipeline with the specified storage type information, 
the client writes the Chunk replica with the storage type information.
-- Datanode writes data to the specified Container replica or creates a 
Container replica in the specified volume based on the storage type .
-- OMKeyInfo needs to persist in the storage policy field, if the storage 
policy does not be specified, the storage policy should be null.
+- `hdds.datanode.default.storagetype`
+  Default value: DISK. The default storage type used when creating a container 
replica on a Datanode without a
+  specified storage type. This typically applies to write requests from older 
clients that do not support the storage
+  policy feature.
 
-## DN Container Replica Creation
+- `ozone.scm.container.allow.null.storage.tier`
+  Default value: false. Whether to allow selecting containers with a null 
storage tier during container allocation.
+  This can be used during the upgrade period to allow new keys to be written 
to existing containers that do not yet

Review Comment:
   Could you please clarify this configuration.  I don't understand why we need 
it during the upgrade period. 



##########
hadoop-hdds/docs/content/design/storage-policy.md:
##########
@@ -19,379 +20,588 @@ status: draft
 
 # Terminology
 
-## Terminology
+## Definitions
 
 - Storage Policy: Defines where key data replicas should be stored in specific 
storage tiers.
-- Storage Type: The types of disks/Container replicas in a Datanode, storage 
type could include RAM_DISK, SSD, HDD, ARCHIVE, etc.
-- Storage Tier: A set of Container replicas in a cluster that satisfy the 
storage policy.
-- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode..
-- prefix: The prefix in this article, unless otherwise specified, refers to 
the prefix of the storage policy type, not the ACL prefix. The prefix of the 
storage policy type is used to configure the prefix of the storage policy for 
the specified prefix.
+- Storage Type: The type of each Datanode volume or container replica. Each 
Datanode volume can be configured with a
+  storage type, including SSD, DISK, and ARCHIVE.
+- Storage Tier: A specific storage tier is composed of all replicas of a 
container based on their storage type. For
+  example, a 3-replica SSD tier consists of 3 replicas of SSD type.
+- Volume: In this document, unless otherwise specified, a volume refers to the 
volume of a Datanode.
+- Key: In this document, a key refers to an object in Ozone, including entries 
in both the KeyTable and FileTable.
 
 ## Storage Policy vs Storage Type vs Storage Tier
 
 
![storage-policy](https://issues.apache.org/jira/secure/attachment/13070477/storage-policy.png)
 
-The relation of Storage Policy, Storage Type and Storage Tier
+The relationship between Storage Policy, Storage Type, and Storage Tier:
 
-- The storage policy is the property of key/bucket/ prefix (Managed by OM);
-- The storage tier is the property of Pipeline and Container (Managed by SCM);
-- The storage type is the property of volume and Container replicas (Managed 
by DN);
-- Only the storage policy can be modified by the user directly via ozone 
command;
+- The storage policy is the property of key/bucket (managed by OM).
+- The storage tier is the property of Pipeline and Container (managed by SCM).
+- The storage type is the property of volume and container replica (managed by 
DN).
+- Only the storage policy can be modified by the user directly via the ozone 
command.
 
 Example:
 
-For a keyA, its storage policy is Hot, its Container 1 tier is SSD tier, and 
Container 1 has three replicas, all of which are of the SSD storage type.
+For a keyA, its storage policy is Hot, Its Container tier is SSD tier, the 
Container has three replicas, all of which
+are of the SSD storage type.
 
 # User Scenarios
 
-- User A needs a bucket that supports high-performance IO, so create a bucket 
with the storage policy set to Hot. Data written by User A to bucket will 
automatically be distributed across the SSD disks in the cluster.
-- User B needs higher IO performance for the directory/prefix 
/project/metadata, so set the storage policy for the prefix /project/metadata 
to Hot. Subsequently, data written to /project/metadata will be automatically 
distributed across the SSD disks in the cluster.
-- User C has already written key1 to the cluster and requires better IO 
performance. The storage policy for key1 can be set to Hot, and then a 
migration can be triggered to move key1 to the SSD disks.
-- Use D use command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class XXX` upload a file the Ozone SSD tier
+- User A needs a bucket that supports high-performance IO, so they create a 
bucket with the storage policy set to Hot.
+  Data written by User A to the bucket will automatically be distributed 
across SSD disks in the cluster.
+- User B needs higher IO performance for a specific key. They write a key with 
the storage policy set to Hot. The
+  key's data will be distributed across SSD disks in the cluster.
+- User C uses the command `aws s3 cp myfile.txt s3://my-bucket/myfile.txt 
--storage-class STANDARD` to upload a file
+  to the Ozone SSD tier. The key's data will be distributed across SSD disks 
in the cluster.
+
+# Goals
+
+- Storage Policy: Introduce storage policy and related concepts. Define 
multiple storage policies and support S3
+  storage class.
+- Storage Policy Writing: Allow writing keys/files to specified storage tiers 
based on storage policy. Support S3,
+  API, and shell command interfaces.
+- Storage Policy Update: Enable setting and unsetting storage policies for 
buckets, and setting storage tiers for
+  containers.
+- Storage Policy Display: Support displaying the storage policy attribute of 
buckets and keys. Support displaying the
+  storage tier of SCM containers and pipelines. Support displaying Datanode 
storage type usage information. Support
+  checking whether the key storage policy is satisfied.
+- Container Balancer: Support migrating container replicas between Datanodes 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+- ReplicationManager: Support managing the storage type of container replicas 
to ensure that container replicas on
+  Datanodes reside on the correct volumes. Ensure that the storage types of 
container replicas forming a storage
+  tier are correct. For example, a 3-replica SSD storage tier container in SCM 
should consist of 3 SSD type container
+  replicas, and each container replica should reside on an SSD type volume.
+- DiskBalancerService: Support migrating container replicas within a Datanode 
to volumes of the matching storage type.
+  For example, SSD type container replicas will be migrated to SSD type 
volumes, and will not be migrated to DISK
+  type volumes.
+
+# Design
+
+## Supported Storage Policies
+
+- Supported storage policies: Hot / Warm / Cold
+- Supported storage tiers: SSD / DISK / ARCHIVE / EMPTY
+- Supported storage types: SSD / DISK / ARCHIVE
+- Supported bucket layouts: FILE_SYSTEM_OPTIMIZED, OBJECT_STORE, LEGACY
+- S3 storage classes: STANDARD / STANDARD_IA / GLACIER
+
+### Storage Policy Map to Storage Tier
 
-# Current Status
+| Storage Policy | Storage Tier for Write | Fallback Tier for Write |
+|----------------|------------------------|-------------------------|
+| Hot            | SSD                    | DISK                    |
+| Warm           | DISK                   | EMPTY                   |
+| Cold           | ARCHIVE                | EMPTY                   |
 
-- Ozone currently has some support for tiered storage such as storage type, 
and some parts of this article may already be implemented.
-- Currently, in Ozone, when a key is created, the key's Block can appear on 
any volume of a Datanode. When a key is created, SCM first needs to allocate a 
Block for the key through Pipelines. The Client then writes the Block to the 
corresponding Datanode based on the Pipeline information. In this process, the 
smallest element managed by the SCM Pipeline is the Datanode, and when the 
Datanode creates a Container, the Container may appear on any volume with 
enough remaining space. Under the current architecture, Ozone does not support 
writing data to specific disks
+- Storage Tier for Write: The primary storage tier where data is written when 
a storage policy is specified.
+- Fallback Tier for Write: If the specified storage policy cannot be satisfied 
with the primary storage tier, SCM
+  will attempt to use this fallback tier to meet the policy requirements. 
EMPTY means no fallback is available.
 
-# Goal Requirements Specification
+### Storage Tier Map to Storage Type
 
-### **Support for Storage Policy Writing and Management**
+| Tier    | Storage Type of Pipeline | One Replica Container Storage Type | 
Three Replica Container Storage Type | EC Container Replicas Storage Type |
+|---------|--------------------------|-------------------------------------|--------------------------------------|-------------------------------------|
+| SSD     | SSD                      | SSD                                 | 3 
SSD                                | n SSD                               |
+| DISK    | DISK                     | DISK                                | 3 
DISK                               | n DISK                              |
+| ARCHIVE | ARCHIVE                  | ARCHIVE                             | 3 
ARCHIVE                            | n ARCHIVE                           |
+| EMPTY   | -                        | -                                   | - 
                                   | -                                   |
 
-- **Writing keys**: Allow keys to be written to specified storage tiers based 
on storage policies.
-- **Policy Management**: Enable setting, unsetting, and inheriting storage 
policies for keys, prefixes, and buckets. Inherit policies based on the longest 
matching prefix or bucket if no specific policy is set.
+### Fallback Storage Type for Container Replica Replication/Migration
 
-### **Support for Data Migration Across Different Storage Policies**
+| Container Replica Storage Type | Fallback Storage Types (ordered) [1] |
+|--------------------------------|--------------------------------------|
+| SSD                            | DISK, ARCHIVE                        |
+| DISK                           | ARCHIVE                              |
+| ARCHIVE                        | none                                 |
 
-- **Data Migration**: Support data migration across different storage policies 
via manual triggers, ensuring data is moved to the appropriate storage tiers.
+- Fallback Storage Type: During the container replica replication or migration 
process, if SCM cannot find a suitable
+  volume type that matches the original container replica's storage type, it 
will attempt to use the fallback storage
+  types in order.
 
-### **Adaptation of AWS S3 StorageClass**
+[1] A container replica does not know the storage policy of the key or the 
storage tier of the SCM container it belongs
+to. The container replica only knows its own expected storage type, which is 
why the column name is "Fallback Storage
+Types" rather than "Fallback Storage Tier".
 
-- **S3 StorageClass Mapping**: Map AWS S3 storage classes to Ozone storage 
policies, supporting related API operations (PutObject, CopyObject, Multipart 
Upload, GetObject, HeadObject, ListObjects).
+### AWS S3 StorageClass
 
-### **Management and Monitoring Tools**
+| AWS S3 StorageClass | Ozone Storage Policy |
+|---------------------|----------------------|
+| STANDARD [1]        | Hot                  |
+| STANDARD_IA         | Warm                 |
+| GLACIER             | Cold                 |
+| DEEP_ARCHIVE        | Warm                 |
 
-- **Storage Policy Commands**: Provide tools to view storage policies of 
containers, datanode usage, and pipeline information.
-- **Metrics and Monitoring**: Enable visibility into storage policy 
compliance, container storage types, and space information across different 
storage policies.
+> AWS StorageClass Valid Values: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | 
ONEZONE_IA | INTELLIGENT_TIERING |
+> GLACIER | DEEP_ARCHIVE | OUTPOSTS | GLACIER_IR | SNOW | EXPRESS_ONEZONE
+> According to AWS S3 documentation, STANDARD is the highest performance S3 
StorageClass, but its name is STANDARD,
+> which is not straightforward to map to the Ozone SSD tier.
 
-### **Future Enhancements**
+[1] The field names here reuse the AWS S3 field names, but the actual 
semantics differ from AWS S3. For example, in
+Ozone, STANDARD represents the Hot storage policy, while in AWS S3, STANDARD 
has different semantics.
 
-- **Intelligent Storage Policies**: Plan to support automatic data migration 
based on access frequency, similar to S3 Intelligent-Tiering.
-- **Bucket StorageClass Lifecycle Rules: Support setting storage policies 
Lifecycle Rules at the bucket level.**
-- **Recon Support**: Enhance Recon to display relevant storage tier 
information.
+## Component Changes
 
-# Detailed Requirements Specification
+### Datanode Container Replica
 
-## Storage Policy and Storage Types
+A storage type field is added to container replicas on Datanodes, which is 
persisted in the container's metadata YAML
+file.
 
-### Supported Storage Types
+### Bucket, Key
 
-- Specify the Storage Type for each volume through configuration. If no 
Storage Type is specified, the default value will be DISK.
-- Support Storage Type:SSD / DISK / ARCHIVE / RAM_DISK
+A storage policy attribute is added to buckets and keys on OM.
 
-### Supported Storage Policies
+### SCM Container, Pipeline
 
-Support storage policy: Hot , Warm, Cold
+A storage tier attribute is added to containers and pipelines on SCM. A 
pipeline can support multiple storage tiers.
+For example, if all Datanodes in a pipeline have both SSD and DISK type 
volumes, the pipeline's supported storage tier
+attributes will include both SSD and DISK.
 
-### Storage Policies Map To Storage Tiers
+## Datanode Volume Storage Type
 
-| Storage Policy | Storage Tier for Write | Fallback Tier for Write |
-| --- | --- | --- |
-| Hot | SSD | DISK |
-| Warm | DISK | none |
-| Cold | ARCHIVE | none |
-- **Storage Tier For Write**: The priority storage tier where data is written 
when storage policy is specified.
-- **Fallback Tier for Write**: If the specified storage policy cannot be 
satisfied with the priority storage tier, the SCM will attempt to use this 
fallback tier to meet the policy requirements.
+- Referencing HDFS [1], use configuration to define the storage type of each 
volume. If no storage type information is
+  configured for a volume, the storage type will be DISK.
+  - For example:
+    ```xml
+    <property>
+      <name>hdds.datanode.dir</name>
+      <value>[SSD]/mnt/disk/0/ozone,[DISK]/mnt/disk/1/ozone</value>
+    </property>
+    ```
+    Volume /mnt/disk/0/ozone will be SSD storage type, and Volume 
/mnt/disk/1/ozone will be DISK storage type.
 
-### Storage Tier Map To Storage Type
+[1] Refer to 
https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/ArchivalStorage.html
 section
+Configuration.
 
-| Tier | StorageType of Pipeline | One Replication 
-Container Replicas Storage Type | Three replication
-Container Replicas Storage Type | EC
-Container Replicas Storage Type |
-| --- | --- | --- | --- | --- |
-| SSD | SSD | SSD | 3 SSD | n SSD |
-| DISK | DISK | DISK | 3 DISK | n DISK |
-| ARCHIVE | ARCHIVE | ARCHIVE | 3 ARCHIVE | n ARCHIVE |
+## Writing Keys with Storage Policy
 
-### Fallback Storage Type For Container replicas Replication/Migration
+### Ozone Filesystem
 
-| Container Replicas Type | Container Replicas Fallback Storage Type [1] |
-| --- | --- |
-| SSD | DISK |
-| DISK | none |
-| ARCHIVE | none |
-- Container Replicas Fallback Storage Type: During the Container replicas 
replication or migration process, if the SCM cannot find a suitable volume type 
that matches the original Container replica's storage type, it will attempt to 
use this fallback storage tier.
+- Support specifying a storage policy when writing a key.
+  - If a storage policy is specified when writing a key, the key storage 
policy is the specified storage policy.
+  - If a storage policy is not specified when writing a key, the storage 
policy of the key will depend on the bucket.
+    If the bucket does not have a storage policy set, the default storage 
policy is determined by the configuration
+    `ozone.default.storagepolicy`, the default value is WARM.
 
-[1] For a Container replicas, it will not know the Storage Policy of the 
Container’s key or the tier of the SCM Container located, the Container 
replicas just know its own expected storage type, So column name is “Fallback 
Storage Type”
+- Fallback strategy:
+  - When writing a key, if data cannot be written to the specified storage 
tier, it can be written to the fallback
+    storage tier, provided the fallback storage tier is not EMPTY and fallback 
is allowed.
+  - Fallback control: Fallback can be controlled at the bucket granularity. If 
allowed, the key will attempt to write
+    to the fallback storage tier. The default is to allow fallback.
 
-## Support for Ozone Storage Policy Writing and Management
+### S3
 
-### Support storage policy writing
+- If StorageClass is specified in the request, the storage policy is derived 
from the StorageClass in the request.
+- If StorageClass is not specified in the request, the storage policy of the 
bucket is used.
+- If the storage policy of the bucket is null, the storage policy is 
determined by the configuration
+  `ozone.s3.default.storagepolicy`, the default value is STANDARD_IA, which 
maps to Ozone storage policy WARM.
 
-- Support specifying a storage policy when writing a key.
-    - If a storage policy is specified when writing a key, the key storage 
policy is the specified storage policy.
-    - If no storage policy is specified, the default behavior refers to the 
"Inheritance of storage policy" section.
-    - If a key neither inheriting any storage policy nor specified a storage 
policy when writing a key, then the key storage policy will be default storage 
policy (can refers to the "default storage policy" section)
-    - If the priority storage policy is not satisfied, support writing to the 
fallback tier if the fallbackStrategy is “allow”
+### Supported APIs
 
-### Support fallback strategy configuration
+#### Ozone Filesystem
 
-- fallbackStrategy
-    - Allow (default): In this case, the behavior is similar to HDFS, with 
automatic fallback, and it does not trigger errors or additional alerts;
-    - Prohibit: Prohibit fallback; if a tier that satisfies the storage policy 
cannot be found, the write operation fails directly.
+- createKey
+- createStreamKey
+- createFile
+- createStreamFile
+- initiateMultipartUpload
 
-### Inheritance of storage policies
+#### S3 Request
 
-- If no storage policy is specified (undefined storage policy) when writing a 
key, the key's storage policy inherits the longest matching prefix. If there is 
no matching prefix, it inherits the storage policy of the bucket. If the bucket 
has no effective storage policy [1], the key's storage policy will be the 
default storage policy .
-- If a key is created with an effective storage policy, the storage policy of 
the key will not change with the storage policy changing of the bucket or 
prefix.
+Refer to
+[Using Amazon S3 storage classes - Amazon Simple Storage 
Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html)
 
-[1] Effective storage policy means a non-empty storage policy.
+- PutObject:
+  - Support specifying the StorageClass parameter in the PutObject request to 
determine the storage policy for the
+    object.
+- CopyObject:
+  - Support specifying a new storage policy (StorageClass) in the CopyObject 
request and applying the new storage
+    policy when copying the object from the source location to the target 
location. If no new storage policy is
+    specified, inherit the storage policy of the source object.
+- Multipart Upload:
+  - Support specifying the StorageClass parameter in the CreateMultipartUpload 
request and following the StorageClass
+    parameter of CreateMultipartUpload in UploadPart.
+- GetObject:
+  - Return the current storage policy of the object in the GetObject response.
+- HeadObject:
+  - Return the metadata of the object, including its storage policy 
(StorageClass).
+- ListObjects:
+  - Include the storage policy (StorageClass) information of each object in 
the ListObjects response.
 
-### undefined storage policy
+### Write Key Process
 
-- If the user does not specify any storage policy when creating a key, the 
user's storage policy is undefined storage policy.
-- Even if the user's key inherits the storage policy of the bucket/prefix, the 
user's storage policy is still undefined storage policy.
-- Undefined storage policy does not mean the key no storage policy. if the key 
inherits a storage policy, the key actual storage policy is the inherited 
storage policy.
-- The undefined storage policy will change as the changing of the 
prefix/bucket storage policy, including when the key is renamed to a prefix 
with a different storage policy.
+#### Normal Write (No Fallback)
 
-### default storage policy
+![create-key-with-storage-policy](https://issues.apache.org/jira/secure/attachment/13081145/create-key-with-storage-policy.png)
 
-- If a key neither inheriting any storage policy nor specified a storage 
policy when writing a key, then the key storage policy will be default storage 
policy
-- The default storage policy is the storage policy for existing keys before 
the storage policy feature is launched. That is, all keys have at least the 
default storage policy, even if the key was created before the storage policy 
feature was launched.
-- If the user has not configured a default storage policy, the default storage 
policy should be Warm.
-- The default storage policy can be configured.
+- Client sends CreateKey request to OM with storage policy Hot.
+- OM requests SCM to allocate a container with storage policy Hot.
+- SCM allocates a container and pipeline with storage tier SSD according to 
storage policy Hot.
+- Client determines the storage type of the chunk to be SSD according to the 
storage tier SSD.
+- DN creates the container or writes the chunk on the specified storage medium 
according to the storage type.
 
-## Storage policy management
+#### Fallback Write
 
-### key storage policy
+![fallback-create-key-with-storage-policy](https://issues.apache.org/jira/secure/attachment/13081146/fallback-create-key-with-storage-policy.png)
 
-- Support setting and unsetting the storage policy for keys.
-    - After unsetting the storage policy, the actual storage policy of the key 
refers to the "Inheritance of storage policy" section, or is the default 
storage policy if key do not inherit any storage policy.
-- Support displaying the storage policy in the key list/info results(Include 
whether the storage policy is the default storage policy).
+- Client sends CreateKey request to OM with storage policy Hot.
+- OM requests SCM to allocate a container with storage policy Hot.
+- SCM attempts to allocate a container and pipeline with storage tier SSD 
according to storage policy Hot, but finds
+  that there are no available containers or pipelines with SSD tier. SCM then 
selects the fallback tier DISK.
+- Client determines the storage type of the chunk to be DISK according to the 
fallback storage tier DISK.
+- DN creates the container or writes the chunk on the specified storage medium 
according to the storage type.
 
-### Bucket storage policy management
+### Datanode Container Replica Creation
 
-- Support setting and unsetting storage policies for buckets.
-    - After unsetting the storage policy, the storage policy is the default 
storage policy.
-- Support specifying a storage policy when creating a bucket.
-    - If no storage policy is specified, the storage policy is the default 
storage policy.
-- Support displaying the storage policy in the bucket list/info results 
(Include whether the storage policy is the default storage policy).
+- When the Ozone client writes data to a container replica on a Datanode, the 
storage type is included in the request.
+- When the Datanode receives a write request for a container replica and the 
container does not exist, the Datanode
+  creates the container by selecting an appropriate volume 
(VolumeChoosingPolicy) based on the storage type in the
+  request.
+- If the storage type is not specified when creating a container replica on 
the Datanode, the container replica will be
+  created on a volume of the storage type specified by the configuration 
`hdds.datanode.default.storagetype` (default
+  is DISK). This typically only occurs when a client from an older version 
that does not support the storage policy
+  feature writes data to the Datanode.
+- The Datanode does not perform fallback when creating container replicas. If 
a volume of the storage type specified in
+  the client's write request cannot be found, an exception will be thrown. 
Since SCM selects appropriate Datanodes to
+  create pipelines and allocate containers based on Datanode reports, this 
situation should not occur during normal
+  operation.
 
-### Prefix management
+### SCM Pipeline Creation and Selection
 
-- Support creating, deleting, setting, getting, and listing prefixes.
-- The display of the prefix storage policy should display whether the storage 
policy is the default storage policy
-- A prefix can only have one type of policy.
-- Prefixes do not support unsetting storage policies; deleting a prefix is 
equivalent to unsetting the storage policy.
+- Datanodes report their storage space information to SCM through 
StorageReportProto, including the space usage and
+  storage type of all volumes (the default storage type for a Datanode volume 
is DISK).
+- SCM calculates the supported volume types and capacities for each Datanode 
based on StorageReportProto.
+- When creating a container, SCM selects appropriate Datanodes to create a 
pipeline based on the storage tier
+  corresponding to the storage policy in the request.
+  - For example, the Hot storage policy corresponds to the SSD storage tier. 
For a 3-replica SSD storage tier, the
+    pipeline will consist of 3 Datanodes that have SSD type volumes.
+  - For the Hot storage policy with EC 6+3 replication, the pipeline will 
consist of 9 Datanodes that have SSD
+    type volumes.
+- If SCM cannot find enough suitable Datanodes to create a pipeline, it will 
try to create a pipeline using the
+  fallback tier of the storage policy. If the fallback tier is EMPTY, or the 
fallback tier also cannot find enough
+  suitable Datanodes, the creation fails.
+- SCM does not mix storage types within a storage tier. An SSD storage tier 
pipeline will only consist of Datanodes
+  with SSD type volumes, and will not include Datanodes with only DISK type 
volumes.
+- The storage tier is an attribute of the pipeline, indicating the storage 
tiers supported by that pipeline. A pipeline
+  can support multiple storage tiers. For example, if Datanodes all have both 
SSD and DISK type volumes, the pipeline
+  created on these Datanodes will have supported storage tier attributes of 
both SSD and DISK.
+- When allocating a container through an existing pipeline, SCM filters 
matching pipelines based on their supported
+  storage tiers.
 
-### Support for persistent storage of storage policy changes:
 
-- Use ozone admin storagepolicies satisfyStoragePolicy to trigger the 
migration of corresponding changes, and mark the corresponding storage policy 
changes as completed.
+- BackgroundPipelineCreator will attempt to create pipelines for all storage 
tiers. If the Datanodes in the cluster
+  can support a certain storage tier, BackgroundPipelineCreator will 
automatically create pipelines for that tier.
+- The pipeline count limit is calculated independently for each storage tier.
 
-### FSO type buckets:
+## Storage Policy Update
 
-- Use prefixes to implement directory-level storage policy management, not 
directly support setting storage policies for directories.
-- Do not support setting storage policies for directory-type keys.
+Setting the bucket storage policy is supported. Existing buckets can be 
updated with a new storage policy.
 
-## Adaptation of AWS S3
+- `ozone sh bucket update --storagepolicy <storagePolicyStr>`
+  Allowed values: HOT, WARM, COLD, or null to unset.
 
-### Adaptation of AWS S3 StorageClass
+Setting the SCM container storage tier attribute is supported. This is mainly 
used to update existing containers in the
+cluster so that they have the specified storage tier attribute.
 
-Not all the StorageClass will be support by the Ozone
+- `ozone admin container setstoragetier --storage-tier=<storageTierStr>`
+  Allowed values: SSD, DISK, ARCHIVE, or null to unset.
 
-A possible solution
+## Storage Policy Display
 
-| AWS S3 StorageClass | Ozone StoragePolicy |
-| --- | --- |
-| STANDARD | Hot |
-| STANDARD_IA | Warm |
-| GLACIER | COLD |
+Display the bucket storage policy attribute:
 
-> According to AWS S3 documentation, STANDARD is the highest performance S3 
StorageClass, but its name is STANDARD, which is not easy to convert it to 
OZONE SSD
+- `ozone sh bucket info`
 
-> AWS StorageClass Valid Values: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | 
ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | DEEP_ARCHIVE | OUTPOSTS | 
GLACIER_IR | SNOW | EXPRESS_ONEZONE
+Display the key storage policy attribute:
 
-### Adaptation of AWS S3 Related API
+- `ozone sh key info`
 
-refer to
-[Using Amazon S3 storage classes - Amazon Simple Storage 
Service](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html)
+Display the container storage tier, the storage type of its replicas, and the 
storage type of the volumes where the
+replicas reside:
 
-- PutObject:
-    - Support specifying the StorageClass parameter in the PutObject request 
to determine the storage policy for the object.
-- CopyObject:
-    - Support specifying a new storage policy (StorageClass) in the CopyObject 
request and applying the new storage policy when migrating the object from the 
source location to the target location. If no new storage policy is specified, 
inherit the storage policy of the source object.
-- Multipart Upload
-    - Support specifying the StorageClass parameter in the 
CreateMultipartUpload request and following the StorageClass parameter of 
CreateMultipartUpload in UploadPart.
-- GetObject operation:
-    - Return the current storage policy of the object in the GetObject 
response.
-- HeadObject:
-    - Support the HeadObject request to return the metadata of the object, 
including its storage policy (StorageClass).
-- ListObjects:
-    - Include the storage policy (StorageClass) information of each object in 
the ListObjects response.
-- Bucket StorageClass Lifecycle Rules:
-    - Support setting storage policies Lifecycle Rules at the bucket level and 
automatically managing the storage policy conversion of objects through 
policies and lifecycle rules. For example, automatically transfer objects from 
SSD to HDD or from HDD to NVMe SSD based on the object's age or access 
frequency.
-- ~~RestoreObject operation: [Not Supported]~~
+- `ozone admin container info`
 
-## Support for Storage Policy Management Commands/Metrics
+List containers filtered by storage tier:
 
-Lists commands that need to be added/adapted to storage policies, but may not 
be all commands
+- `ozone admin container list --storage-tier=<storageTierStr>`
 
-- Storage policy management
-    - `ozone admin storagepolicies list`, lists all supported policies in the 
current cluster.
-    - `ozone admin storagepolicies get ${key}`, get the key storage policy 
(include the inherited storage policy)
-    - `ozone admin storagepolicies check ${key}`, check whether the key 
storage policy is satisfied
-    - `ozone admin storagepolicies satisfyStoragePolicy -bucket / -prefix / 
-key`, triggers migrations to satisfy the corresponding data's storage policy.
-    - `ozone admin storagepolicies satisfyStoragePolicy status -bucket / 
-prefix / -key`, checks the migration status of the storage policy.
-    - `ozone admin storagepolicies checkSatisfyStoragePolicy -bucket / -prefix 
/ -key`, checks whether the specified resource's storage policy is satisfied.
-        - Containers may be migrated to a fallback tier. At this time, the 
storage policy of the corresponding resource is not satisfied.
-- `ozone admin container info`, supports displaying the storage policy of 
Containers.
-- `ozone admin datanode usageinfo`, supports displaying space information 
according to different storage policies.
-- `ozone admin pipeline list`, supports displaying the storage tier supported 
by Pipelines.
-- `ozone admin pipeline create`, supports creating Pipelines that support 
specified storage tier.
-- Datanode volume related Metrics support displaying the storage policies of 
volumes.
-- SCM supports displaying the data space information of different storage 
policies in the cluster.
+Display the storage tiers supported by pipelines associated with Datanodes:
 
-## Storage Policy Satisfier Service
+- `ozone admin datanode list`
 
-- Support data migration across different storage policies.
-    - Storage policy migrations are triggered by ozone admin storagepolicies 
satisfyStoragePolicy. Modifying the storage policy of a bucket/prefix/key does 
not directly trigger storage policy migrations.
-- Support manually setting storage policies for buckets/prefixes/keys and 
implementing asynchronous migrations.
-- Responsible for managing storage policy-related migration work.
-- Responsible for responding to user requests and checking whether the 
specified resources satisfy the storage policy.
+Display Datanode usage information by storage type:
 
-## Permissions Management
+- `ozone admin datanode usageinfo`
 
-- Changing the storage policy of buckets/prefixes/keys requires administrator 
permissions.
+Display cluster-wide space usage information by storage type:
 
-## Storage Policy Supported Replicas Types
+- `ozone admin storagepolicy usageinfo`
 
-- Support replica type storage policies.
-- Support EC type storage policies.
-    - EC types cannot support some storage policies that mix different storage 
media.
+Check whether a key's storage policy is satisfied:
 
-## Storage Policy Supported Bucket Types
+- `ozone admin storagepolicy check`
 
-- Support all types of buckets.
+## Container Balancer
 
-## Compatible HDFS Commands
+- Datanodes report the status information of all containers to SCM through 
ContainerReplicaProto, including the
+  storage type of the container replica itself and the storage type of the 
volume where it resides.
+- Container Balancer supports balancing based on the space usage of each 
storage type. Each storage type is calculated
+  independently. Container replicas are migrated to volumes of the matching 
storage type based on the container
+  replica's storage type.
+- Container Balancer does not perform fallback during migration. It will not 
migrate a container replica to a volume
+  of a different storage type.
 
-HDFS storage policy-related commands are not supported.
+## ReplicationManager
 
-Do not support specified storage policy when creating a file using HDFS 
Filesystem interface, the Hadoop FileSystem (org.apache.hadoop.fs.FileSystem) 
does not support passing the storage policy by Create method.
+- Datanodes report the status information of all containers to SCM through 
ContainerReplicaProto, including the
+  storage type of the container replica itself and the storage type of the 
volume where it resides.
+- Datanodes report their storage space information to SCM through 
StorageReportProto, including the space usage and
+  storage type of all volumes (the default storage type for a Datanode volume 
is DISK).
+- ReplicationManager introduces two new container health states: 
MIS_STORAGE_TYPE_WITH_VOLUME and
+  MIS_STORAGE_TYPE_WITH_CONTAINER.
+  - MIS_STORAGE_TYPE_WITH_VOLUME: Container replica whose storage type 
mismatches its volume's storage type.
+    - ReplicationManager will select a matching volume and migrate the 
container replica for this health state.
+  - MIS_STORAGE_TYPE_WITH_CONTAINER: Container replica whose storage type 
mismatches the container's storage tier.
+    - ReplicationManager will send a command to update the storage type of the 
container replica on the Datanode.
+  - ReplicationManager will first handle MIS_STORAGE_TYPE_WITH_CONTAINER and 
then handle
+    MIS_STORAGE_TYPE_WITH_VOLUME.
+- ReplicationManager uses the SCM container's storage tier as the source of 
truth to check whether the container
+  replicas and the volumes where replicas reside match the storage tier.
+  - If the SCM container's storage tier is null, no storage tier checks will 
be performed. Containers created before
+    the storage policy feature was introduced will have a null storage tier.
+  - To manage existing containers' replicas (e.g., to prevent these container 
replicas from occupying SSD type
+    volume space), the container storage tier needs to be set. Once set, 
ReplicationManager will manage the
+    container replicas based on the storage tier. Otherwise, container 
replicas may reside on volumes of any
+    storage type.
+- When ReplicationManager replicates, migrates, or reconstructs container 
replicas (e.g., for UNDER_REPLICATED or
+  MIS_REPLICATED containers), it selects matching Datanodes based on the 
storage type corresponding to the SCM
+  container's storage tier.
+- When ReplicationManager replicates, migrates, or reconstructs container 
replicas, if it cannot find a matching
+  Datanode, it will try to use the fallback storage types defined by the SCM 
container's storage tier. If the storage
+  tier has no defined fallback storage types, or no Datanodes matching the 
fallback storage types can be found, the
+  operation fails.
 
-- Ozone needs to record the access frequency of keys/buckets.
+## DiskBalancerService
 
-## Recon Side Feature
+- DiskBalancerService calculates space usage and migrates containers between 
volumes of the same storage type within a
+  Datanode.
 
-Support displaying relevant storage tier information in Recon. Need to design 
more detailed. // TODO
+# Configurations
 
-# Architecture Design
+New configuration keys introduced by the storage policy feature:
 
-This section aims to describe the architecture and design concepts of the 
system without delving into specific implementation details. Its purpose is to 
validate the feasibility and rationality of the technical route, as well as to 
assess the workload and technical dependencies of related tasks.
+- `ozone.default.storagepolicy`
+  Default value: WARM. The default storage policy for writing keys when 
neither the key nor the bucket has a storage
+  policy set.
 
-## Writing Key Process
+- `ozone.default.storageTier`
+  Default value: DISK. The default storage tier.
 
-Writing data to the specified tier:
+- `ozone.s3.default.storagepolicy`
+  Default value: STANDARD_IA. The default S3 storage class when StorageClass 
is not specified in the S3 request and
+  the bucket does not have a storage policy set. STANDARD_IA maps to Ozone 
storage policy WARM.
 
-- When a user creates a key, they set the storage policy and fallbackStrategy 
parameters and send the request to the OM:
-    - CreateKey
-    - CreateFile
-    - CreateMultipartKey
-- Community Ozone:
-    - CreateStreamKey
-    - CreateStreamFile
-    - CreateMultipartStreamKey
-- OM adds the storage policy information to the allocateBlock request sent to 
the SCM. The actual storage strategy should be calculated based on the storage 
strategy requirements above.
-- SCM, upon receiving the request, selects the Pipeline based on the storage 
policy and allocates a Container.
-    - The storage type of each Container replicas should be added to for the 
Datanodes in the Pipeline, just like the replicaIndex for the EC key.
-    - If the expected storage tier Pipeline cannot be found, attempt to find 
the fallback tier defined by the storage policy if the fallbackStrategy is 
allowed. If it cannot be found, the creation process fails.
-    - If the SCM needs to create a new Container for a specific storage tier, 
SCM needs to record the Container’s storage tier for the Container. So the 
ContainerData should add a storage tier field.
-- After receiving the Pipeline with the specified storage type information, 
the client writes the Chunk replica with the storage type information.
-- Datanode writes data to the specified Container replica or creates a 
Container replica in the specified volume based on the storage type .
-- OMKeyInfo needs to persist in the storage policy field, if the storage 
policy does not be specified, the storage policy should be null.
+- `hdds.datanode.default.storagetype`
+  Default value: DISK. The default storage type used when creating a container 
replica on a Datanode without a
+  specified storage type. This typically applies to write requests from older 
clients that do not support the storage
+  policy feature.
 
-## DN Container Replica Creation
+- `ozone.scm.container.allow.null.storage.tier`
+  Default value: false. Whether to allow selecting containers with a null 
storage tier during container allocation.
+  This can be used during the upgrade period to allow new keys to be written 
to existing containers that do not yet
+  have a storage tier set.
+
+For a pure SSD cluster (where all Datanode volumes are configured with SSD 
storage type), the following configurations
+should be updated accordingly:
+
+- `ozone.default.storagepolicy` should be set to HOT (Hot maps to SSD storage 
tier).
+- `ozone.default.storageTier` should be set to SSD.
+- `ozone.s3.default.storagepolicy` should be set to STANDARD (STANDARD maps to 
Hot storage policy).
+- `hdds.datanode.default.storagetype` should be set to SSD.
+
+Otherwise, when writing a key without specifying a storage policy, the system 
will default to the WARM storage policy,
+which corresponds to the DISK storage tier. Since WARM does not define a 
fallback tier (its fallback is EMPTY), SCM
+cannot fall back to another tier, and the write will fail because no DISK type 
volumes are available in the cluster.
+
+Note that this situation only occurs when the volumes are explicitly 
configured as SSD in the `hdds.datanode.dir`
+configuration (e.g., `[SSD]/mnt/disk/0/ozone`). Even if the underlying 
physical disks are SSDs, as long as the volume
+configuration does not specify a storage type, the Datanode will treat them as 
DISK type volumes by default, and no
+configuration changes are needed.
+
+# Protobuf Changes
+
+Major protobuf changes:
+
+hdds.proto
+
+```protobuf
+enum StorageType {
+  DISK_TYPE = 1;
+  SSD_TYPE = 2;
+  ARCHIVE_TYPE = 3;
+  RAM_DISK_TYPE = 4;
+  PROVIDED_TYPE = 5;
+}
+
+enum StorageTierProto {
+  UNKNOWN_TIER = 0;

Review Comment:
   Why do enums start at 0 by default? This differs from our current Protobuf 
implementation in Ozone. Is this a new standard?



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


Reply via email to