Search in sources :

Example 1 with TopologyRecord

use of com.sequenceiq.cloudbreak.domain.TopologyRecord in project cloudbreak by hortonworks.

the class HostGroupAssociationBuilder method getTopologyMapping.

private Map<String, String> getTopologyMapping(HostGroup hg) {
    Map<String, String> result = new HashMap<>();
    LOGGER.info("Computing hypervisor - rack mapping based on topology");
    Topology topology = hg.getCluster().getStack().getCredential().getTopology();
    if (topology == null) {
        return result;
    }
    List<TopologyRecord> records = topology.getRecords();
    if (records != null) {
        for (TopologyRecord t : records) {
            result.put(t.getHypervisor(), t.getRack());
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) TopologyRecord(com.sequenceiq.cloudbreak.domain.TopologyRecord) Topology(com.sequenceiq.cloudbreak.domain.Topology)

Aggregations

Topology (com.sequenceiq.cloudbreak.domain.Topology)1 TopologyRecord (com.sequenceiq.cloudbreak.domain.TopologyRecord)1 HashMap (java.util.HashMap)1