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

   ## What changes were proposed in this pull request?
   This change introduces new CLI options` --most-used` and `--least-used` 
under the `ozone admin datanode list` command to enable sorting datanodes based 
on their usage. When these options are used, the output includes additional 
details such as used space, total capacity, and percentage of space used.
   Unit tests for this change are added in `TestListInfoSubcommand`.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-13095
   
   ## How was this patch tested?
   sample outputs when `--most-used` flag is used:
   ```
   [ {
     "datanodeDetails" : {
       "level" : 3,
       "cost" : 0,
       "id" : {
         "uuid" : "6173fced-573b-4850-93b5-d799efc48fbf",
         "id" : "6173fced-573b-4850-93b5-d799efc48fbf",
         "byteString" : {
           "validUtf8" : true,
           "empty" : false
         }
       },
       "ipAddress" : "X.X.X.X",
       "hostName" : "ozone-datanode-3.ozone_default",
        .
        .
        .
     "healthState" : "HEALTHY",
     "used" : 400,
     "capacity" : 1000,
     "percentUsed" : 40.0
     "opState" : "IN_SERVICE"
   }, {
     "datanodeDetails" : {
       "level" : 3,
       "cost" : 0,
       "id" : {
         "uuid" : "c2095dc5-d75c-4156-99b2-2da09c7dc32a",
         "id" : "c2095dc5-d75c-4156-99b2-2da09c7dc32a",
         "byteString" : {
           "validUtf8" : true,
           "empty" : false
         }
       },
       "ipAddress" : "Y.Y.Y.Y",
       "hostName" : "ozone-datanode-2.ozone_default",
        .
        .
        .
     "healthState" : "HEALTHY",
     "used" : 300,
     "capacity" : 1000,
     "percentUsed" : 30.0,
     "opState" : "IN_SERVICE"
   }, {
     "datanodeDetails" : {
       "level" : 3,
       "cost" : 0,
       "id" : {
         "uuid" : "beb0322f-63e0-4cfc-9c21-72fd48b68440",
         "id" : "beb0322f-63e0-4cfc-9c21-72fd48b68440",
         "byteString" : {
           "validUtf8" : true,
           "empty" : false
         }
       },
       "ipAddress" : "Z.Z.Z.Z",
       "hostName" : "ozone-datanode-1.ozone_default",
        .
        .
        .
     "healthState" : "HEALTHY",
     "used" : 200,
     "capacity" : 1000,
     "percentUsed" : 20.0,
     "opState" : "IN_SERVICE"
   } ]
   ```
   
   When json flag is not given:
   ```
   Datanode: 6173fced-573b-4850-93b5-d799efc48fbf 
(/default-rack/X.X.X.X/ozone-datanode-3.ozone_default/2 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Related pipelines:
   7aeba473-a20e-4c49-a79e-f0c871222d28/RATIS/THREE/RATIS/OPEN/Follower
   21e77351-5200-42e7-8d38-acbc9b4428e9/RATIS/ONE/RATIS/OPEN/Leader
   
   Used: 400
   Capacity: 1000
   
   Datanode: c2095dc5-d75c-4156-99b2-2da09c7dc32a 
(/default-rack/Y.Y.Y.Y/ozone-datanode-2.ozone_default/2 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Related pipelines:
   7aeba473-a20e-4c49-a79e-f0c871222d28/RATIS/THREE/RATIS/OPEN/Leader
   5c96425b-002f-4ed3-9fae-5433a46eb1ba/RATIS/ONE/RATIS/OPEN/Leader
   
   Used: 300
   Capacity: 1000
   
   Datanode: beb0322f-63e0-4cfc-9c21-72fd48b68440 
(/default-rack/Z.Z.Z.Z/ozone-datanode-1.ozone_default/2 pipelines)
   Operational State: IN_SERVICE
   Health State: HEALTHY
   Related pipelines:
   7aeba473-a20e-4c49-a79e-f0c871222d28/RATIS/THREE/RATIS/OPEN/Follower
   225e4b47-fb29-46a9-90ae-5949ef5a0597/RATIS/ONE/RATIS/OPEN/Leader
   
   Used: 200
   Capacity: 1000
   ```
   
   https://github.com/sreejasahithi/ozone/actions/runs/15297558597
   


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