Replication aware decommission

Proposed flow for the decommission:

1, First we find all the nodes belong to the host group
2, We filter the nodes which are running application masters or Hadoop master components
3, After the filter is complete we compare the size of the remaining nodes and the requested scaling adjustment
4, We check the DFS replication of the cluster and refuse the requests which can cause to go below that number in nodes
5, If the nodes contain datanodes we try to calculate the data movement and usage
5a, Sort the nodes by data occupation and select the first x with the less data
5b, Calculate the required space on the other nodes to move the data there, compared to the used space of the selected nodes * replication size * some safety room
5c, If there is enough space we start the decommission

Flaws:
1, Even if we say that there is enough space to move the data the replication can still fail due to topology issues: 
 - all the nodes are in the same rack
 - if there is enough space on the nodes it can happen that it already contains replicas of the same data which blocks the replication 

2, If we start the decommission and for any reasons the replication hangs the cluster will stuck in in progress state

The ultimate solution would be:

1, Select the x nodes with the less amount of data
2, Check all its blocks and their corresponding replicas
3, Calculate the remaining space on other nodes considering the above mentioned criteria

Unit tests are in progress..