/** * Return the list of running hosts to which upload certificates for Direct Download */ private List<HostVO> getRunningHostsToUploadCertificate(HypervisorType hypervisorType) { return hostDao.listAllHostsByType(Host.Type.Routing) .stream() .filter(x -> x.getStatus().equals(Status.Up) && x.getHypervisorType().equals(hypervisorType)) .collect(Collectors.toList()); }
/** * Get running host IDs within the same hypervisor, cluster and datacenter than hostId. ID hostId is not included on the returned list */ protected List<Long> getRunningHostIdsInTheSameCluster(Long clusterId, long dataCenterId, HypervisorType hypervisorType, long hostId) { List<Long> list = hostDao.listByDataCenterIdAndHypervisorType(dataCenterId, hypervisorType) .stream() .filter(x -> x.getHypervisorType().equals(hypervisorType) && x.getStatus().equals(Status.Up) && x.getType().equals(Host.Type.Routing) && x.getClusterId().equals(clusterId) && x.getId() != hostId) .map(x -> x.getId()) .collect(Collectors.toList()); Collections.shuffle(list); return list; }
List<HostVO> hosts = listAllHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId()); for (final HostVO host : hosts) { if (host.getType().equals(Host.Type.Routing) && !host.getStatus().equals(Status.Down) && !host.getStatus().equals(Status.Disconnected) && !host.getStatus().equals(Status.Up) && !host.getStatus().equals(Status.Alert)) { final String msg = "host " + host.getPrivateIpAddress() + " should not be in " + host.getStatus().toString() + " status"; throw new CloudRuntimeException("PrepareUnmanaged Failed due to " + msg); if (host.getStatus().equals(Status.Up)) { umanageHost(host.getId()); if (!host.getStatus().equals(Status.Down) && !host.getStatus().equals(Status.Disconnected) && !host.getStatus().equals(Status.Alert)) { lsuccess = false; break;