sumitagrawl commented on code in PR #9091:
URL: https://github.com/apache/ozone/pull/9091#discussion_r2417158684
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -254,6 +258,28 @@ public List<DatanodeAdminError>
updateDiskBalancerConfiguration(
return errors;
}
+ /**
+ * Checks if the datanode is in an optimal state for disk balancing
operations.
+ * A datanode is considered to be in optimal state when it has both:
+ * - NodeOperationalState.IN_SERVICE(not decommissioning, decommissioned, or
in maintenance)
+ * - NodeState.HEALTHY(not stale, dead, or readonly)
+ *
+ * @param dn the DatanodeDetails to check
+ * @param errors list to add any error messages if the datanode is not in
optimal state
+ * @return true if the datanode is in optimal state (IN_SERVICE and
HEALTHY), false otherwise
+ */
+ private boolean isDatanodeInOptimalState(DatanodeDetails dn,
+ List<DatanodeAdminError> errors) throws NodeNotFoundException {
+ NodeStatus nodeStatus = nodeManager.getNodeStatus(dn);
+ if (!nodeStatus.equals(NodeStatus.inServiceHealthy())) {
+ errors.add(new DatanodeAdminError(dn.getHostName(),
+ "Datanode is not in an optimal state for disk balancing. " +
Review Comment:
refactor, "Datanode is not in healthy state for disk balancing.
--
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]