You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jyotirmoy-gh (via GitHub)" <gi...@apache.org> on 2023/03/31 10:21:33 UTC

[GitHub] [ozone] jyotirmoy-gh opened a new pull request, #4508: HDDS-8185. ozone admin datanode list should have a json option for output

jyotirmoy-gh opened a new pull request, #4508:
URL: https://github.com/apache/ozone/pull/4508

   ## What changes were proposed in this pull request?
   
   Json formatting option added for `ozone admin datanode list` command 
   ```
   bash-4.2$ ozone admin datanode list --help
   Usage: ozone admin datanode list [-hV] [--json] [-id=<scmServiceId>]
                                    [--id=<uuid>] [--ip=<ipaddress>]
                                    [--node-state=<nodeState>]
                                    [--operational-state=<nodeOperationalState>]
                                    [--scm=<scm>]
   List info of datanodes
     -h, --help             Show this help message and exit.
         -id, --service-id=<scmServiceId>
                            ServiceId of SCM HA Cluster
         --id=<uuid>        Show info by datanode UUID.
         --ip=<ipaddress>   Show info by ip address.
         --json             Show info in json format
         --node-state=<nodeState>
                            Show info by datanode NodeState( HEALTHY, STALE, DEAD)
         --operational-state=<nodeOperationalState>
                            Show info by datanode NodeOperationalState(IN_SERVICE,
                              DECOMMISSIONING, DECOMMISSIONED,
                              ENTERING_MAINTENANCE, IN_MAINTENANCE).
         --scm=<scm>        The destination scm (host:port)
     -V, --version          Print version information and exit.
   ```
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-8185
   
   ## How was this patch tested?
   
   Tested using apache docker build -
   ```
   bash-4.2$ ozone admin datanode list --json | more
   [ {
     "datanodeDetails" : {
       "level" : 0,
       "cost" : 0,
       "uuid" : "a288046d-c3fb-41b7-b25d-00e3da71fcc6",
       "uuidString" : "a288046d-c3fb-41b7-b25d-00e3da71fcc6",
       "ipAddress" : "172.18.0.4",
       "hostName" : "ozone_datanode_1.ozone_default",
       "ports" : [ {
         "name" : "REPLICATION",
         "value" : 9886
       }, {
         "name" : "RATIS",
         "value" : 9858
       }, {
         "name" : "RATIS_ADMIN",
         "value" : 9857
       }, {
         "name" : "RATIS_SERVER",
         "value" : 9856
       }, {
         "name" : "RATIS_DATASTREAM",
         "value" : 9855
       }, {
         "name" : "STANDALONE",
         "value" : 9859
       } ],
       "setupTime" : 0,
       "persistedOpState" : "IN_SERVICE",
       "persistedOpStateExpiryEpochSec" : 0,
       "initialVersion" : 0,
       "currentVersion" : 1,
       "signature" : -413780670,
       "decomissioned" : false,
       "networkLocation" : "/default-rack",
       "networkName" : "a288046d-c3fb-41b7-b25d-00e3da71fcc6",
       "networkFullPath" : "/default-rack/a288046d-c3fb-41b7-b25d-00e3da71fcc6",
       "numOfLeaves" : 1
     },
     "healthState" : "HEALTHY",
     "opState" : "IN_SERVICE"
   }, {
     "datanodeDetails" : {
       "level" : 0,
       "cost" : 0,
       "uuid" : "ea12974c-febe-4bc1-a091-ffa6a2290adc",
       "uuidString" : "ea12974c-febe-4bc1-a091-ffa6a2290adc",
       "ipAddress" : "172.18.0.7",
       "hostName" : "ozone_datanode_4.ozone_default",
       "ports" : [ {
         "name" : "REPLICATION",
         "value" : 9886
       }, {
   --More--
   ```


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


[GitHub] [ozone] adoroszlai merged pull request #4508: HDDS-8185. ozone admin datanode list should have a json option for output

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #4508:
URL: https://github.com/apache/ozone/pull/4508


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


[GitHub] [ozone] jyotirmoy-gh commented on a diff in pull request #4508: HDDS-8185. ozone admin datanode list should have a json option for output

Posted by "jyotirmoy-gh (via GitHub)" <gi...@apache.org>.
jyotirmoy-gh commented on code in PR #4508:
URL: https://github.com/apache/ozone/pull/4508#discussion_r1154394195


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java:
##########
@@ -88,7 +94,13 @@ public void execute(ScmClient scmClient) throws IOException {
       allNodes = allNodes.filter(p -> p.getHealthState().toString()
           .compareToIgnoreCase(nodeState) == 0);
     }
-    allNodes.forEach(this::printDatanodeInfo);
+
+    if (json) {
+      List<DatanodeWithAttributes> datanodeList = allNodes.collect(Collectors.toList());
+      System.out.print(JsonUtils.toJsonStringWithDefaultPrettyPrinter(datanodeList));

Review Comment:
   Reduced the line length



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


[GitHub] [ozone] adoroszlai commented on a diff in pull request #4508: HDDS-8185. ozone admin datanode list should have a json option for output

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #4508:
URL: https://github.com/apache/ozone/pull/4508#discussion_r1154333291


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java:
##########
@@ -88,7 +94,13 @@ public void execute(ScmClient scmClient) throws IOException {
       allNodes = allNodes.filter(p -> p.getHealthState().toString()
           .compareToIgnoreCase(nodeState) == 0);
     }
-    allNodes.forEach(this::printDatanodeInfo);
+
+    if (json) {
+      List<DatanodeWithAttributes> datanodeList = allNodes.collect(Collectors.toList());
+      System.out.print(JsonUtils.toJsonStringWithDefaultPrettyPrinter(datanodeList));

Review Comment:
   Sorry, I just noticed that these lines are too long for checkstyle:
   
   ```
   hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
    99: Line is longer than 80 characters (found 88).
    100: Line is longer than 80 characters (found 85).
   ```
   
   https://github.com/jyotirmoy-gh/ozone/actions/runs/4574046184/jobs/8075209766#step:6:511



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


[GitHub] [ozone] jyotirmoy-gh commented on pull request #4508: HDDS-8185. ozone admin datanode list should have a json option for output

Posted by "jyotirmoy-gh (via GitHub)" <gi...@apache.org>.
jyotirmoy-gh commented on PR #4508:
URL: https://github.com/apache/ozone/pull/4508#issuecomment-1491693493

   @sodonnel @nilotpalnandi - Please review


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