@Override public AffinityGroup getAffinityGroup(Long groupId) { return _affinityGroupDao.findById(groupId); }
private AffinityGroupVO getAffinityGroup(Long affinityGroupId, String account, Long projectId, Long domainId, String affinityGroupName) { AffinityGroupVO group = null; if (affinityGroupId != null) { group = _affinityGroupDao.findById(affinityGroupId); } else if (affinityGroupName != null) { group = getAffinityGroupByName(account, projectId, domainId, affinityGroupName); } else { throw new InvalidParameterValueException("Either the affinity group Id or group name must be specified to delete the group"); } if (group == null) { throw new InvalidParameterValueException("Unable to find affinity group " + (affinityGroupId == null ? affinityGroupName : affinityGroupId)); } return group; }
/** * Process Affinity Group for VM deployment */ protected void processAffinityGroup(AffinityGroupVMMapVO vmGroupMapping, DeploymentPlan plan, VirtualMachine vm) { AffinityGroupVO group = _affinityGroupDao.findById(vmGroupMapping.getAffinityGroupId()); s_logger.debug("Processing affinity group " + group.getName() + " for VM Id: " + vm.getId()); List<Long> groupVMIds = _affinityGroupVMMapDao.listVmIdsByAffinityGroup(group.getId()); groupVMIds.remove(vm.getId()); List<Long> preferredHosts = getPreferredHostsFromGroupVMIds(groupVMIds); plan.setPreferredHosts(preferredHosts); }
AffinityGroupVO group = _affinityGroupDao.findById(vmGroupMapping.getAffinityGroupId());
AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId); if (ag == null) { throw new InvalidParameterValueException("Unable to find affinity group by id " + affinityGroupId);
@Override public DedicateZoneResponse createDedicateZoneResponse(DedicatedResources resource) { DedicateZoneResponse dedicateZoneResponse = new DedicateZoneResponse(); DataCenterVO dc = _zoneDao.findById(resource.getDataCenterId()); DomainVO domain = _domainDao.findById(resource.getDomainId()); AccountVO account = _accountDao.findById(resource.getAccountId()); AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId()); dedicateZoneResponse.setId(resource.getUuid()); dedicateZoneResponse.setZoneId(dc.getUuid()); dedicateZoneResponse.setZoneName(dc.getName()); dedicateZoneResponse.setDomainId(domain.getUuid()); dedicateZoneResponse.setAffinityGroupId(group.getUuid()); if (account != null) { dedicateZoneResponse.setAccountId(account.getUuid()); } dedicateZoneResponse.setObjectName("dedicatedzone"); return dedicateZoneResponse; }
@Override public DedicateClusterResponse createDedicateClusterResponse(DedicatedResources resource) { DedicateClusterResponse dedicateClusterResponse = new DedicateClusterResponse(); ClusterVO cluster = _clusterDao.findById(resource.getClusterId()); DomainVO domain = _domainDao.findById(resource.getDomainId()); AccountVO account = _accountDao.findById(resource.getAccountId()); AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId()); dedicateClusterResponse.setId(resource.getUuid()); dedicateClusterResponse.setClusterId(cluster.getUuid()); dedicateClusterResponse.setClusterName(cluster.getName()); dedicateClusterResponse.setDomainId(domain.getUuid()); dedicateClusterResponse.setAffinityGroupId(group.getUuid()); if (account != null) { dedicateClusterResponse.setAccountId(account.getUuid()); } dedicateClusterResponse.setObjectName("dedicatedcluster"); return dedicateClusterResponse; }
@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; }
@Override public DedicateHostResponse createDedicateHostResponse(DedicatedResources resource) { DedicateHostResponse dedicateHostResponse = new DedicateHostResponse(); HostVO host = _hostDao.findById(resource.getHostId()); DomainVO domain = _domainDao.findById(resource.getDomainId()); AccountVO account = _accountDao.findById(resource.getAccountId()); AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId()); dedicateHostResponse.setId(resource.getUuid()); dedicateHostResponse.setHostId(host.getUuid()); dedicateHostResponse.setHostName(host.getName()); dedicateHostResponse.setDomainId(domain.getUuid()); dedicateHostResponse.setAffinityGroupId(group.getUuid()); if (account != null) { dedicateHostResponse.setAccountId(account.getUuid()); } dedicateHostResponse.setObjectName("dedicatedhost"); return dedicateHostResponse; }
AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId); if (ag == null) { throw new InvalidParameterValueException("Unable to find affinity group " + ag);