You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/11/17 07:37:54 UTC

[GitHub] [ozone] lokeshj1703 commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable

lokeshj1703 commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750962575



##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
    * @param info Information such as Capacity, SCMUsed etc.
    */
   public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
-    double capacity = (double) info.getCapacity();
-    double usedRatio = info.getUsed() / capacity;
-    double remainingRatio = info.getRemaining() / capacity;
+    long capacity = info.getCapacity();
+    long used = info.getUsed(), remaining = info.getRemaining();
+    long totalUsed = capacity - remaining;
+    double usedRatio = used / (double) capacity;
+    double remainingRatio = remaining / (double) capacity;
     NumberFormat percentFormat = NumberFormat.getPercentInstance();
-    percentFormat.setMinimumFractionDigits(5);
+    percentFormat.setMinimumFractionDigits(2);
+    percentFormat.setMaximumFractionDigits(2);
 
     System.out.printf("Usage info for datanode with UUID %s:%n",
         info.getNode().getUuid());
-    System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
-    System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+    // print capacity in a readable format
+    System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",

Review comment:
       Let's not print capacity and other data in bytes. GB is sufficient.




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org