devmadhuu commented on code in PR #9754:
URL: https://github.com/apache/ozone/pull/9754#discussion_r2799084097
##########
hadoop-hdds/docs/themes/ozonedoc/static/swagger-resources/recon-api.yaml:
##########
@@ -1767,6 +1767,12 @@ components:
StorageReport:
Review Comment:
Not sure why this is not renamed. This creates naming confusion if it is
clusterstatestoragereport or datanodestoragereport
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ClusterStateEndpoint.java:
##########
@@ -119,18 +117,34 @@ public Response getClusterState() {
this.containerManager.getContainerStateCount(
HddsProtos.LifeCycleState.DELETED));
- int healthyDatanodes =
+ int healthyDataNodes =
nodeManager.getNodeCount(NodeStatus.inServiceHealthy()) +
nodeManager.getNodeCount(NodeStatus.inServiceHealthyReadOnly());
SCMNodeStat stats = nodeManager.getStats();
+ long fsCapacity = 0;
+ long fsUsed = 0;
+ long fsAvailable = 0;
+
+ for (DatanodeInfo datanode : nodeManager.getAllNodes()) {
+ SpaceUsageSource.Fixed fsUsage =
nodeManager.getTotalFilesystemUsage(datanode);
+ if (fsUsage != null) {
+ fsCapacity += fsUsage.getCapacity();
+ fsAvailable += fsUsage.getAvailable();
+ fsUsed += fsUsage.getUsedSpace();
+ }
+ }
Review Comment:
```suggestion
}List<DatanodeInfo> datanodes = nodeManager.getAllNodes();
if (datanodes == null || datanodes.isEmpty()) {
LOG.warn("No datanodes available for filesystem usage calculation");
// Set to 0 or -1 to indicate unavailable
}
int reportedNodes = 0;
int totalNodes = datanodes.size();
for (DatanodeInfo datanode : datanodes) {
SpaceUsageSource.Fixed fsUsage =
nodeManager.getTotalFilesystemUsage(datanode);
if (fsUsage != null) {
fsCapacity += fsUsage.getCapacity();
fsAvailable += fsUsage.getAvailable();
fsUsed += fsUsage.getUsedSpace();
reportedNodes++;
} else {
LOG.debug("Datanode {} has not reported filesystem usage",
datanode.getUuid());
}
}
if (reportedNodes < totalNodes) {
LOG.warn("Filesystem usage incomplete: {}/{} datanodes reported",
reportedNodes, totalNodes);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]