private boolean validPod(final long podId) { return _podDao.findById(podId) != null; }
public static HostPodVO findPodById(Long podId) { return s_podDao.findById(podId); }
private String getPodName(final long podId) { return _podDao.findById(new Long(podId)).getName(); }
private boolean podHasAllocatedPrivateIPs(final long podId) { final HostPodVO pod = _podDao.findById(podId); final int count = _privateIpAddressDao.countIPs(podId, pod.getDataCenterId(), true); return count > 0; }
private boolean isEnabledForAllocation(long zoneId, Long podId, Long clusterId) { // Check if the zone exists in the system DataCenterVO zone = _dcDao.findById(zoneId); if (zone != null && Grouping.AllocationState.Disabled == zone.getAllocationState()) { s_logger.info("Zone is currently disabled, cannot allocate to this zone: " + zoneId); return false; } Pod pod = _podDao.findById(podId); if (pod != null && Grouping.AllocationState.Disabled == pod.getAllocationState()) { s_logger.info("Pod is currently disabled, cannot allocate to this pod: " + podId); return false; } Cluster cluster = _clusterDao.findById(clusterId); if (cluster != null && Grouping.AllocationState.Disabled == cluster.getAllocationState()) { s_logger.info("Cluster is currently disabled, cannot allocate to this cluster: " + clusterId); return false; } return true; }
HostPodVO pod = s_podDao.findById(podId);
private DomainRouterVO deployLoadBalancerVM(final Long networkId, final IPAddressVO ipAddr) { final NetworkVO network = _networkDao.findById(networkId); final DataCenter dc = _dcDao.findById(network.getDataCenterId()); final Long podId = getPodIdForDirectIp(ipAddr); final Pod pod = podId == null ? null : _podDao.findById(podId); final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1); params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true); final Account owner = _accountService.getActiveAccountByName("system", new Long(1)); final DeployDestination dest = new DeployDestination(dc, pod, null, null); s_logger.debug("About to deploy ELB vm "); try { final DomainRouterVO elbVm = deployELBVm(network, dest, owner, params); if (elbVm == null) { throw new InvalidParameterValueException("Could not deploy or find existing ELB VM"); } s_logger.debug("Deployed ELB vm = " + elbVm); return elbVm; } catch (final Throwable t) { s_logger.warn("Error while deploying ELB VM: ", t); return null; } }
private void checkOverlapPrivateIpRange(long podId, String startIp, String endIp) { HostPodVO pod = _podDao.findById(podId); if (pod == null) { throw new CloudRuntimeException("Cannot find pod " + podId); } final String[] existingPodIpRanges = pod.getDescription().split(","); for(String podIpRange: existingPodIpRanges) { final String[] existingPodIpRange = podIpRange.split("-"); if (existingPodIpRange.length > 1) { if (!NetUtils.isValidIp4(existingPodIpRange[0]) || !NetUtils.isValidIp4(existingPodIpRange[1])) { continue; } if (NetUtils.ipRangesOverlap(startIp, endIp, existingPodIpRange[0], existingPodIpRange[1])) { throw new InvalidParameterValueException("The Storage network Start IP and endIP address range overlap with private IP :" + existingPodIpRange[0] + ":" + existingPodIpRange[1]); } } } }
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."); } }
@Override public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) { StartupCommand firstCmd = startup[0]; if (!(firstCmd instanceof StartupRoutingCommand)) { return null; } StartupRoutingCommand ssCmd = ((StartupRoutingCommand)firstCmd); if (ssCmd.getHypervisorType() != HypervisorType.XenServer) { return null; } HostPodVO pod = _podDao.findById(host.getPodId()); DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.XenServer + ". Checking CIDR..."); _resourceMgr.checkCIDR(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask()); return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.XenServer, details, hostTags); }
@Override public final HostVO createHostVOForDirectConnectAgent(final HostVO host, final StartupCommand[] startup, final ServerResource resource, final Map<String, String> details, final List<String> hostTags) { StartupCommand firstCmd = startup[0]; if (!(firstCmd instanceof StartupRoutingCommand)) { return null; } StartupRoutingCommand ssCmd = ((StartupRoutingCommand)firstCmd); if (ssCmd.getHypervisorType() != HypervisorType.Hyperv) { return null; } s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.Hyperv + ". Checking CIDR..."); HostPodVO pod = _podDao.findById(host.getPodId()); DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); _resourceMgr.checkCIDR(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask()); return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Hyperv, details, hostTags); }
HostPodVO podVO = _podDao.findById(host.getPodId()); String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host is down, " + hostDesc,
HostPodVO pod = _podDao.findById(proxy.getPodIdToDeployIn()); context.put("pod", pod); context.put("proxyVmId", proxy.getId());
HostPodVO pod = _podDao.findById(podId); if (pod == null) { throw new CloudRuntimeException("Cannot find pod " + podId);
final HostPodVO pod = _podDao.findById(podId);
if (_resourceMgr.checkAndMaintain(host.getId())) { final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); final HostPodVO podVO = _podDao.findById(host.getPodId()); final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc,
final HostPodVO pod = _podDao.findById(host.getPodId()); final DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); checkIPConflicts(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPublicIpAddress(), ssCmd.getPublicIpAddress(), ssCmd.getPublicNetmask());
HostPodVO pod = null; if (router.getPodIdToDeployIn() != null) { pod = _podDao.findById(router.getPodIdToDeployIn());
@Override public DedicatePodResponse createDedicatePodResponse(DedicatedResources resource) { DedicatePodResponse dedicatePodResponse = new DedicatePodResponse(); HostPodVO pod = _podDao.findById(resource.getPodId()); DomainVO domain = _domainDao.findById(resource.getDomainId()); AccountVO account = _accountDao.findById(resource.getAccountId()); AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId()); dedicatePodResponse.setId(resource.getUuid()); dedicatePodResponse.setPodId(pod.getUuid()); dedicatePodResponse.setPodName(pod.getName()); dedicatePodResponse.setDomainId(domain.getUuid()); dedicatePodResponse.setAffinityGroupId(group.getUuid()); if (account != null) { dedicatePodResponse.setAccountId(account.getUuid()); } dedicatePodResponse.setObjectName("dedicatedpod"); return dedicatePodResponse; }
throw new ResourceAllocationException("Unable to allocate IP from this Pod", ResourceType.network); HostPodVO pod_vo = _hpDao.findById(vo.getPodId()); AcquirePodIpCmdResponse ret = new AcquirePodIpCmdResponse(); ret.setCidrAddress(pod_vo.getCidrAddress());