@Override public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final boolean forVirtualRouter, final Long podId) { final List<HypervisorType> hypervisorTypes = new ArrayList<HypervisorType>(); List<ClusterVO> clustersForZone = new ArrayList<ClusterVO>(); if (podId != null) { clustersForZone = _clusterDao.listByPodId(podId); } else { clustersForZone = _clusterDao.listByZoneId(zoneId); } for (final ClusterVO cluster : clustersForZone) { final HypervisorType hType = cluster.getHypervisorType(); if (!forVirtualRouter || forVirtualRouter && hType != HypervisorType.BareMetal && hType != HypervisorType.Ovm) { hypervisorTypes.add(hType); } } return hypervisorTypes; }
@Override public List<PodCluster> listByDataCenter(final long dcId) { final List<HostPodVO> pods = _podDao.listByDataCenterId(dcId); final ArrayList<PodCluster> pcs = new ArrayList<PodCluster>(); for (final HostPodVO pod : pods) { final List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId()); if (clusters.size() == 0) { pcs.add(new PodCluster(pod, null)); } else { for (final ClusterVO cluster : clusters) { pcs.add(new PodCluster(pod, cluster)); } } } return pcs; }
protected HypervisorType getClusterToStartDomainRouterForOvm(final long podId) { final List<ClusterVO> clusters = _clusterDao.listByPodId(podId); for (final ClusterVO cv : clusters) { if (cv.getHypervisorType() == HypervisorType.Ovm || cv.getHypervisorType() == HypervisorType.BareMetal) { continue; } final List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(cv.getId()); if (hosts == null || hosts.isEmpty()) { continue; } for (final HostVO h : hosts) { if (h.getState() == Status.Up) { s_logger.debug("Pick up host that has hypervisor type " + h.getHypervisorType() + " in cluster " + cv.getId() + " to start domain router for OVM"); return h.getHypervisorType(); } } } final String errMsg = new StringBuilder("Cannot find an available cluster in Pod ").append(podId) .append(" to start domain router for Ovm. \n Ovm won't support any system vm including domain router, ") .append("please make sure you have a cluster with hypervisor type of any of xenserver/KVM/Vmware in the same pod") .append(" with Ovm cluster. And there is at least one host in UP status in that cluster.").toString(); throw new CloudRuntimeException(errMsg); }
protected void checkIfPodIsDeletable(final long podId) { final HostPodVO pod = _podDao.findById(podId); final String errorMsg = "The pod cannot be deleted because "; // Check if there are allocated private IP addresses in the pod if (_privateIpAddressDao.countIPs(podId, pod.getDataCenterId(), true) != 0) { throw new CloudRuntimeException(errorMsg + "there are private IP addresses allocated in this pod."); } // Check if there are any non-removed volumes in the pod. if (!_volumeDao.findByPod(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are storage volumes in this pod."); } // Check if there are any non-removed hosts in the pod. if (!_hostDao.findByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are servers in this pod."); } // Check if there are any non-removed vms in the pod. if (!_vmInstanceDao.listByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are virtual machines in this pod."); } // Check if there are any non-removed clusters in the pod. if (!_clusterDao.listByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are clusters in this pod."); } }
List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId()); List<DedicatedResourceVO> clustersToRelease = new ArrayList<DedicatedResourceVO>(); List<DedicatedResourceVO> hostsToRelease = new ArrayList<DedicatedResourceVO>();
List<ClusterVO> clusterList = _clusterDao.listByPodId(pod.getId()); for (ClusterVO cluster : clusterList) { if (!clustersToUse.contains(cluster)) {
includeList.addPod(dr.getPodId()); List<ClusterVO> clusterList = _clusterDao.listByPodId(dr.getPodId()); for (ClusterVO cluster : clusterList) { DedicatedResourceVO dCluster = _dedicatedDao.findByClusterId(cluster.getId());