Gargi-jais11 opened a new pull request, #10755:
URL: https://github.com/apache/ozone/pull/10755

   ## What changes were proposed in this pull request?
   ozone admin datanode diskbalancer status command fails when passing DataNode 
ID instead of address
   
   Minor (Usability / CLI Consistency)
   
   The ozone admin datanode diskbalancer status command currently only accepts 
a DataNode's network address/host string. If a user attempts to pass a valid 
datanodeUuid (DataNode ID), the command fails or throws an unsupported/invalid 
argument error.
   
   For better usability and alignment with other ozone admin commands (which 
typically support both UUIDs and addresses to identify cluster nodes), this 
command should be updated to resolve and accept the DataNode ID.
   
   [```
   root@Nodename ~]# ozone admin datanode list -id scm1
   Datanode: a3b63511-bdf8-4fa1-8ab6-d19c0e806f84 
(/default/10.140.95.199/Nodename/3 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Total volume count: 1
   Healthy volume count: 1
   Related pipelines:
   18acb50f-830d-426d-a8c4-a2d0577c12ab/RATIS/THREE/RATIS/OPEN/Follower
   1f6743b3-3eb4-4c9b-994c-3655217dc9b4/RATIS/THREE/RATIS/OPEN/Leader
   f5ef1508-579a-4bee-9933-a04c525c36dd/RATIS/ONE/RATIS/OPEN/Leader
   
   
   Datanode: bc55ef13-ba30-4086-9f80-a5c9abc263ed 
(/default/10.140.181.1/Nodename-2/3 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Total volume count: 1
   Healthy volume count: 1
   Related pipelines:
   a5bf9a58-1eb2-4036-9e3a-c8e508942482/RATIS/THREE/RATIS/OPEN/Leader
   85ef6b85-f3c1-4ce6-bd9d-8ada883a88fe/RATIS/ONE/RATIS/OPEN/Leader
   a2075c08-4167-462c-acb1-1bdf03cfc47a/RATIS/THREE/RATIS/OPEN/Follower
   
   
   Datanode: c557e715-f1ef-458b-8df0-04dc63b54e0e 
(/default/10.140.163.5/Nodename-3/1 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Total volume count: 1
   Healthy volume count: 1
   Related pipelines:
   2e4b6954-f2be-47b4-bd68-0fa5c8bc4eca/RATIS/ONE/RATIS/OPEN/Leader 
   Now check the status of  disk balancer 
   
   ```
   **DiskBalancer output:-**
   ```
   [root@Nodename ~]# ozone admin datanode diskbalancer status 
a3b63511-bdf8-4fa1-8ab6-d19c0e806f84
   Error on node [a3b63511-bdf8-4fa1-8ab6-d19c0e806f84]: Invalid host name: 
local host is: "Nodename/10.140.213.128"; destination host is: 
"a3b63511-bdf8-4fa1-8ab6-d19c0e806f84":19864; java.net.UnknownHostException: 
Invalid host name: local host is: "Nodename/10.140.213.128"; destination host 
is: "a3b63511-bdf8-4fa1-8ab6-d19c0e806f84":19864; 
java.net.UnknownHostException; For more details see:  
http://wiki.apache.org/hadoop/UnknownHost; For more details see:  
http://wiki.apache.org/hadoop/UnknownHost
   Failed to get DiskBalancer status from nodes: 
[a3b63511-bdf8-4fa1-8ab6-d19c0e806f84] 
   ```
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15690
   
   ## How was this patch tested?
   
   Added unit tests.
   
   ```
   bash-5.1$ ozone admin datanode diskbalancer status 
756bfdf0-b45b-4127-88d3-bce91a3a8653
   Status result:
   Datanode                                                                     
              Status     Threshold(%)    BandwidthInMB   Threads    
StopAfterDiskEven  ContainerStates                SuccessMove  FailureMove  
BytesMoved(MB)  EstBytesToMove(MB) EstTimeLeft(min)    
   ozone-datanode-3.ozone_default (172.18.0.8:19864 / 
756bfdf0-b45b-4127-88d3-bce91a3a8653)   STOPPED    10.0000         10           
   5          true               CLOSED,QUASI_CLOSED            0            0  
          0               0                  0                   
   
   Note:
    - EstBytesToMove is calculated based on the target disk even state with the 
configured threshold.
    - EstTimeLeft is calculated based on EstimatedBytesToMove and configured 
disk bandwidth.
    - Both EstimatedBytes and EstTimeLeft could be non-zero while no containers 
can be moved, especially when the configured threshold or disk capacity is too 
small.
    - ContainerStates indicates which container lifecycle states are eligible 
for balancing; by default, CLOSED and QUASI_CLOSED are allowed.
    
   bash-5.1$ ozone admin datanode diskbalancer report 
756bfdf0-b45b-4127-88d3-bce91a3a8653
   Report result:
   Datanode: ozone-datanode-3.ozone_default (172.18.0.8:19864 / 
756bfdf0-b45b-4127-88d3-bce91a3a8653)
   Aggregate VolumeDataDensity: 0.00%
   IdealUsage: 7.87% | Threshold: 10.00% | ThresholdRange: (0.00%, 17.87%)
   
   Volume Details:
   
   StorageID                                     StoragePath                    
            OzoneCapacity  OzoneAvailable       OzoneUsed     
ContainerPreAllocatedSpace   EffectiveUsedSpace     Utilization   VolumeDensity
   DS-1aa03f2e-e540-41b6-9497-162bdc5e8f45       /data/hdds/hdds                
               1006.75 GB       927.53 GB         4.18 MB                       
     0 B             79.22 GB           7.87%           0.00%
   
   
   Note:
     - Aggregate VolumeDataDensity: Sum of per-volume density (deviation from 
ideal); higher means more imbalance.
     - IdealUsage: Target utilization (0-100%) when volumes are evenly balanced.
     - ThresholdRange: Acceptable deviation (percent); volumes within 
IdealUsage +/- Threshold are considered balanced.
     - VolumeDensity: Deviation of a particular volume's utilization from 
IdealUsage.
     - Utilization: how much a particular volume is utilized 
(effectiveUsedSpace / ozoneCapacity) in %.
     - OzoneCapacity: Ozone data volume capacity.
     - OzoneAvailable: Ozone data volume available space.
     - OzoneUsed: Ozone data volume used space.
     - ContainerPreAllocatedSpace: Space reserved for containers not yet 
written to disk.
     - EffectiveUsedSpace: This is the actual used space of volume which is 
visible to the diskBalancer : (ozoneCapacity minus ozoneAvailable) + 
containerPreAllocatedSpace + move delta.
     - move delta: source volume space to be reclaimed after move completion; 
this value is reflected only when diskBalancer is running else it is 0.
   
   bash-5.1$ ozone admin datanode diskbalancer start -t 20 
756bfdf0-b45b-4127-88d3-bce91a3a8653
   Started DiskBalancer on nodes: [ozone-datanode-3.ozone_default 
(172.18.0.8:19864 / 756bfdf0-b45b-4127-88d3-bce91a3a8653)]
   
   bash-5.1$ ozone admin datanode diskbalancer stop 
756bfdf0-b45b-4127-88d3-bce91a3a8653
   Stopped DiskBalancer on nodes: [ozone-datanode-3.ozone_default 
(172.18.0.8:19864 / 756bfdf0-b45b-4127-88d3-bce91a3a8653)]
   
   bash-5.1$ ozone admin datanode diskbalancer status 
756bfdf0-b45b-4127-88d3-bce91a3a8653 --json
   [ {
     "datanode" : "ozone-datanode-3.ozone_default (172.18.0.8:19864 / 
756bfdf0-b45b-4127-88d3-bce91a3a8653)",
     "action" : "status",
     "status" : "success",
     "serviceStatus" : "STOPPED",
     "threshold" : 20.0,
     "bandwidthInMB" : 10,
     "threads" : 5,
     "stopAfterDiskEven" : true,
     "containerStates" : "CLOSED,QUASI_CLOSED",
     "successMove" : 0,
     "failureMove" : 0,
     "bytesMovedMB" : 0,
     "estBytesToMoveMB" : 0,
     "estTimeLeftMin" : 0
   } ]
   
   bash-5.1$ ozone admin datanode diskbalancer status ozone-datanode-3 --json
   [ {
     "datanode" : "ozone-datanode-3.ozone_default (172.18.0.8:19864 / 
756bfdf0-b45b-4127-88d3-bce91a3a8653)",
     "action" : "status",
     "status" : "success",
     "serviceStatus" : "STOPPED",
     "threshold" : 20.0,
     "bandwidthInMB" : 10,
     "threads" : 5,
     "stopAfterDiskEven" : true,
     "containerStates" : "CLOSED,QUASI_CLOSED",
     "successMove" : 0,
     "failureMove" : 0,
     "bytesMovedMB" : 0,
     "estBytesToMoveMB" : 0,
     "estTimeLeftMin" : 0
   } ]
   
   ```
   


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