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/02/23 06:57:11 UTC
[GitHub] [ozone] siddhantsangwan commented on a change in pull request #1919: HDDS-4816. Add DiskMetricsSubCommand to get Datanode usage information.
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org