Set<String> hostNames = new HashSet<String>(){{
add(hostname1);
add(hostname2);
}};
clusters.mapHostsToCluster(hostNames, clusterName);
Service hdfs = cluster.addService(serviceName);
hdfs.persist();
hdfs.addServiceComponent(Role.DATANODE.name()).persist();
hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(hostname1).persist();
hdfs.addServiceComponent(Role.NAMENODE.name()).persist();
hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(hostname1).persist();