Xiaobing Zhou Thank you submitting the patch. It looks very good overall.
Had a minor comment. Instead of throwing an IOException in Datanode.java, would it be possible to throw a DiskBalancerException.
You would first need to add a corresponding state in DiskBalancerException.result enum. Say DATANODE_STATUS_NOT_REGULAR.
Then in the exception we can say something like
throw new DiskBalancerException("Datanode is in special state. Upgrade/Rollback etc. Disk balancing not permitted.", DiskBalancerException.Result.DATANODE_STATUS_NOT_REGULAR);