siddhantsangwan commented on a change in pull request #1919:
URL: https://github.com/apache/ozone/pull/1919#discussion_r580804033



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
##########
@@ -618,6 +607,59 @@ public boolean getReplicationManagerStatus() {
     return scm.getReplicationManager().isRunning();
   }
 
+  /**
+   * Get Datanode disk metrics (such as capacity, used) by ip or uuid.
+   *
+   * @param ipaddress
+   * @param uuid
+   * @return DatanodeDiskMetrics
+   * @throws IOException
+   */
+  @Override
+  public HddsProtos.DatanodeDiskMetrics getDatanodeDiskMetrics(String 
ipaddress,
+                                                         String uuid)
+      throws IOException {
+
+    // check admin authorisation
+    String remoteUser = getRpcRemoteUsername();
+    try {
+      getScm().checkAdminAccess(remoteUser);
+    } catch (IOException e) {
+      LOG.error("Authorisation failed", e);
+      throw e;
+    }
+
+    // get datanode by ip or uuid
+    DatanodeDetails node = null;
+    if (!Strings.isNullOrEmpty(uuid)) {
+      node = scm.getScmNodeManager().getNodeByUuid(uuid);
+    } else if (!Strings.isNullOrEmpty(ipaddress)) {
+      List<DatanodeDetails> nodes = scm.getScmNodeManager()
+          .getNodesByAddress(ipaddress);

Review comment:
       Letting ipaddress and UUID stay exclusive as per our discussion. 




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

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