Merge r1414874 and r1414878 from trunk for HDFS-3495. Update Balancer to support new NetworkTopology with NodeGroup.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488848 13f79535-47bb-0310-9956-ffa450edef68
svn merge -c 1417130 from trunk for HDFS-4234. Use generic code for choosing datanode in Balancer.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488850 13f79535-47bb-0310-9956-ffa450edef68
svn merge -c 1416691 from trunk for HDFS-4240. For nodegroup-aware block placement, when a node is excluded, he nodes in the same nodegroup should also be excluded.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488851 13f79535-47bb-0310-9956-ffa450edef68
svn merge -c 1430917 from trunk for HDFS-4261. Fix bugs in Balaner causing infinite loop and TestBalancerWithNodeGroup timeing out.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488855 13f79535-47bb-0310-9956-ffa450edef68
svn merge -c 1431726 from trunk for HDFS-4382. Fix typo MAX_NOT_CHANGED_INTERATIONS.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488856 13f79535-47bb-0310-9956-ffa450edef68
Merge remote branch 'origin/branch-2' into branch-2-gd
Merge remote branch 'origin/branch-2-gd' into fb-HADOOP-9016-branch-2-gd