private static boolean masterAndSecondariesAreFound(Set<String> componentHosts, String master, List<String> secondaries) {
    return master != null && secondaries.size() + 1 == componentHosts.size() && !secondaries.contains(master);
  }
Find the master and secondary namenode(s) based on JMX NameNodeStatus.
ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java