ChenSammi commented on code in PR #3874:
URL: https://github.com/apache/ozone/pull/3874#discussion_r1098654274
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DiskBalancerCommandHandler.java:
##########
@@ -56,7 +61,37 @@ public DiskBalancerCommandHandler() {
public void handle(SCMCommand command, OzoneContainer ozoneContainer,
StateContext context, SCMConnectionManager connectionManager) {
invocationCount.incrementAndGet();
- // TODO: Do start/stop/update operation
+ final long startTime = Time.monotonicNow();
+ DiskBalancerCommand diskBalancerCommand = (DiskBalancerCommand) command;
+
+ final HddsProtos.DatanodeDiskBalancerOpType opType =
+ diskBalancerCommand.getOpType();
+ final DiskBalancerConfiguration diskBalancerConf =
+ diskBalancerCommand.getDiskBalancerConfiguration();
+
+ DiskBalancerInfo diskBalancerInfo = ozoneContainer.getDiskBalancerInfo();
+
+ try {
+ switch (opType) {
+ case start:
+ diskBalancerInfo.setShouldRun(true);
+ diskBalancerInfo.updateFromConf(diskBalancerConf);
+ break;
+ case stop:
+ diskBalancerInfo.setShouldRun(false);
+ break;
+ case update:
+ diskBalancerInfo.updateFromConf(diskBalancerConf);
+ break;
+ default:
Review Comment:
Please throw exception here.
--
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]