You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by xy...@apache.org on 2020/06/02 22:16:17 UTC

[hadoop-ozone] branch master updated: HDDS-3676. Display datanode uuid into the printTopology command output (#981)

This is an automated email from the ASF dual-hosted git repository.

xyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new a0c7370  HDDS-3676. Display datanode uuid into the printTopology command output (#981)
a0c7370 is described below

commit a0c7370c196d6a2caa6bbb48e9e7352c9a3235f8
Author: maobaolong <30...@qq.com>
AuthorDate: Wed Jun 3 06:16:04 2020 +0800

    HDDS-3676. Display datanode uuid into the printTopology command output (#981)
---
 .../org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
index 95a1235..214da34 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
@@ -71,6 +71,10 @@ public class TopologySubcommand implements Callable<Void> {
       description = "Print Topology ordered by network location")
   private boolean order;
 
+  @CommandLine.Option(names = {"-f", "--full"},
+      description = "Print Topology with full node infos")
+  private boolean fullInfo;
+
   @Override
   public Void call() throws Exception {
     try (ScmClient scmClient = parent.createScmClient()) {
@@ -128,10 +132,15 @@ public class TopologySubcommand implements Callable<Void> {
     return sb.toString();
   }
 
+  private String getAdditionNodeOutput(HddsProtos.Node node) {
+    return fullInfo ? node.getNodeID().getUuid() + "/" : "";
+  }
+
   // Format "ipAddress(hostName):PortName1=PortValue1    networkLocation"
   private void printNodesWithLocation(Collection<HddsProtos.Node> nodes) {
     nodes.forEach(node -> {
-      System.out.print(" " + node.getNodeID().getIpAddress() + "(" +
+      System.out.print(" " + getAdditionNodeOutput(node) +
+          node.getNodeID().getIpAddress() + "(" +
           node.getNodeID().getHostName() + ")" +
           ":" + formatPortOutput(node.getNodeID().getPortsList()));
       System.out.println("    " +


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