// Due to HDFS-778, a node may appear in job history logs as both numeric // ips and as host names. We remove them from the parsed network topology // before feeding it to ZombieCluster. static void removeIpHosts(LoggedNetworkTopology topology) { for (Iterator<LoggedNetworkTopology> rackIt = topology.getChildren().iterator(); rackIt.hasNext(); ) { LoggedNetworkTopology rack = rackIt.next(); List<LoggedNetworkTopology> nodes = rack.getChildren(); for (Iterator<LoggedNetworkTopology> it = nodes.iterator(); it.hasNext(); ) { LoggedNetworkTopology node = it.next(); if (isIPAddress(node.getName())) { it.remove(); } } if (nodes.isEmpty()) { rackIt.remove(); } } }
static void setStaticMapping(LoggedNetworkTopology topology) { for (LoggedNetworkTopology rack : topology.getChildren()) { for (LoggedNetworkTopology node : rack.getChildren()) { StaticMapping.addNodeToRack(node.getName(), new RackNode(rack.getName(), 1).getName()); } } }