Skip to content

HDDS-8185. ozone admin datanode list should have a json option for output#4508

Merged
adoroszlai merged 3 commits intoapache:masterfrom
jyotirmoy-gh:HDDS-8185
Apr 1, 2023
Merged

HDDS-8185. ozone admin datanode list should have a json option for output#4508
adoroszlai merged 3 commits intoapache:masterfrom
jyotirmoy-gh:HDDS-8185

Conversation

@jyotirmoy-gh
Copy link
Contributor

@jyotirmoy-gh jyotirmoy-gh commented Mar 31, 2023

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

Added robot tests in - hadoop-ozone/dist/src/main/smoketest/admincli/datanode.robot

@jyotirmoy-gh
Copy link
Contributor Author

@sodonnel @nilotpalnandi - Please review

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jyotirmoy-gh for the patch, LGTM.

Can you please add a test case in hadoop-ozone/dist/src/main/smoketest/admincli/datanode.robot? Something like:

List datanodes as JSON
    ${output} =         Execute          ozone admin datanode list --json | jq -r '.'

jq verifies that it's valid JSON. You can also add further assertions on the output.

@jyotirmoy-gh jyotirmoy-gh requested a review from adoroszlai March 31, 2023 12:06
@adoroszlai adoroszlai merged commit 7b570df into apache:master Apr 1, 2023
@jyotirmoy-gh jyotirmoy-gh deleted the HDDS-8185 branch April 3, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants