VolumeVO vol = vols.get(0);
long podId = vol.getPodId();
s_logger.debug("Pod id determined from volume " + vol.getId() + " is " + podId);
Iterator<PodCluster> it = pcs.iterator();
while (it.hasNext()) {
PodCluster pc = it.next();
if (pc.getPod().getId() != podId) {
it.remove();
}
}
}
Set<Pair<Long, Long>> avoidPcs = new HashSet<Pair<Long, Long>>();
Set<Long> hostIdsToAvoid = avoid.getHostsToAvoid();
if (hostIdsToAvoid != null) {
for (Long hostId : hostIdsToAvoid) {
Host h = _hostDao.findById(hostId);
if (h != null) {
avoidPcs.add(new Pair<Long, Long>(h.getPodId(), h.getClusterId()));
}
}
}
for (Pair<Long, Long> pcId : avoidPcs) {
s_logger.debug("Removing " + pcId + " from the list of available pods");
pcs.remove(new PodCluster(new HostPodVO(pcId.first()), pcId.second() != null ? new ClusterVO(pcId.second()) : null));
}
for (PodCluster p : pcs) {
if (p.getPod().getAllocationState() != Grouping.AllocationState.Enabled) {
if (s_logger.isDebugEnabled()) {