Package com.cloud.dc

Examples of com.cloud.dc.DataCenter


        }
    }

    @Override
    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
        DataCenter dc = _dcDao.findById(plan.getDataCenterId());

        if (!canHandle(offering, dc)) {
            return null;
        }

        State state = State.Allocated;
        if (dc.getNetworkType() == NetworkType.Basic) {
            state = State.Setup;
        }

        NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Dhcp, BroadcastDomainType.Vlan, offering.getId(), state, plan.getDataCenterId(), plan.getPhysicalNetworkId());
View Full Code Here


        super();
    }

    @Override
    public void updateNicProfile(NicProfile profile, Network network) {
        DataCenter dc = _dcDao.findById(network.getDataCenterId());
        if (profile != null) {
            profile.setDns1(dc.getDns1());
            profile.setDns2(dc.getDns2());
            profile.setIp6Dns1(dc.getIp6Dns1());
            profile.setIp6Dns2(dc.getIp6Dns2());
        }
    }
View Full Code Here

    @Override
    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
            InsufficientAddressCapacityException, ConcurrentOperationException {

        DataCenter dc = _dcDao.findById(network.getDataCenterId());   

        if (nic == null) {
            nic = new NicProfile(ReservationStrategy.Create, null, null, null, null);
        } else if (nic.getIp4Address() == null && nic.getIp6Address() == null) {
            nic.setStrategy(ReservationStrategy.Start);
View Full Code Here

        return true;
    }

    @Override
    public void updateNetworkProfile(NetworkProfile networkProfile) {
        DataCenter dc = _dcDao.findById(networkProfile.getDataCenterId());
        networkProfile.setDns1(dc.getDns1());
        networkProfile.setDns2(dc.getDns2());
    }
View Full Code Here

            response.setResponseName(getCommandName());
            response.setObjectName("volume");
            Volume vol = _entityMgr.findById(Volume.class, id);
            response.setId(vol.getUuid());
            response.setName(vol.getName());
            DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
            response.setZoneId(zone.getUuid());
            response.setZoneName(zone.getName());
            response.setMode(mode);
            response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
            Account account = _entityMgr.findById(Account.class, getEntityOwnerId());
            response.setAccountId(account.getUuid());
            response.setUrl(uploadUrl);
View Full Code Here

        }
    }

    @Override
    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
        DataCenter dc = _configMgr.getZone(plan.getDataCenterId());
        if (!canHandle(offering, dc)) {
            return null;
        }

        NetworkVO network = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(),
View Full Code Here

    }

    @Override
    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
        DataCenter dc = _configMgr.getZone(network.getDataCenterId());
        NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
        if (!canHandle(offering, dc)) {
            return null;
        }
       
View Full Code Here

    }
   

    @Override
    public void updateNicProfile(NicProfile profile, Network network) {
        DataCenter dc = _configMgr.getZone(network.getDataCenterId());
        if (profile != null) {
            profile.setDns1(dc.getDns1());
            profile.setDns2(dc.getDns2());
        }
    }
View Full Code Here

        return true;
    }

    @Override
    public void updateNetworkProfile(NetworkProfile networkProfile) {
        DataCenter dc = _configMgr.getZone(networkProfile.getDataCenterId());
        networkProfile.setDns1(dc.getDns1());
        networkProfile.setDns2(dc.getDns2());
    }
View Full Code Here

    @Override
    public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
            ExcludeList avoid) throws AffinityConflictException {
        VirtualMachine vm = vmProfile.getVirtualMachine();
        List<AffinityGroupVMMapVO> vmGroupMappings = _affinityGroupVMMapDao.findByVmIdType(vm.getId(), getType());
        DataCenter dc = _dcDao.findById(vm.getDataCenterId());
        List<DedicatedResourceVO> resourceList = new ArrayList<DedicatedResourceVO>();

        if (vmGroupMappings != null && !vmGroupMappings.isEmpty()) {

            for (AffinityGroupVMMapVO vmGroupMapping : vmGroupMappings) {
                if (vmGroupMapping != null) {
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Processing affinity group " + vmGroupMapping.getAffinityGroupId()
                                + "of type 'ExplicitDedication' for VM Id: " + vm.getId());
                    }

                    long affinityGroupId = vmGroupMapping.getAffinityGroupId();

                    // List<DedicatedResourceVO> dr =
                    // _dedicatedDao.listByAccountId(accountId);
                    // List<DedicatedResourceVO> drOfDomain =
                    // searchInDomainResources(domainId);
                    // List<DedicatedResourceVO> drOfParentDomain =
                    // searchInParentDomainResources(domainId);

                    List<DedicatedResourceVO> dr = _dedicatedDao.listByAffinityGroupId(affinityGroupId);
                    resourceList.addAll(dr);

                }
            }

            boolean canUse = false;

            if (plan.getHostId() != null) {
                HostVO host = _hostDao.findById(plan.getHostId());
                ClusterVO clusterofHost = _clusterDao.findById(host.getClusterId());
                HostPodVO podOfHost = _podDao.findById(host.getPodId());
                DataCenterVO zoneOfHost = _dcDao.findById(host.getDataCenterId());
                if (resourceList != null && resourceList.size() != 0) {
                    for (DedicatedResourceVO resource : resourceList) {
                        if ((resource.getHostId() != null && resource.getHostId() == plan.getHostId())
                                || (resource.getClusterId() != null && resource.getClusterId() == clusterofHost.getId())
                                || (resource.getPodId() != null && resource.getPodId() == podOfHost.getId())
                                || (resource.getDataCenterId() != null && resource.getDataCenterId() == zoneOfHost
                                        .getId())) {
                            canUse = true;
                        }
                    }
                }
                if (!canUse) {
                    throw new CloudRuntimeException("Cannot use this host " + host.getName()
                            + " for explicit dedication");
                }
            } else if (plan.getClusterId() != null) {
                ClusterVO cluster = _clusterDao.findById(plan.getClusterId());
                HostPodVO podOfCluster = _podDao.findById(cluster.getPodId());
                DataCenterVO zoneOfCluster = _dcDao.findById(cluster.getDataCenterId());
                List<HostVO> hostToUse = new ArrayList<HostVO>();
                // check whether this cluster or its pod is dedicated
                if (resourceList != null && resourceList.size() != 0) {
                    for (DedicatedResourceVO resource : resourceList) {
                        if ((resource.getClusterId() != null && resource.getClusterId() == cluster.getId())
                                || (resource.getPodId() != null && resource.getPodId() == podOfCluster.getId())
                                || (resource.getDataCenterId() != null && resource.getDataCenterId() == zoneOfCluster
                                        .getId())) {
                            canUse = true;
                        }

                        // check for all dedicated host; if it belongs to this
                        // cluster
                        if (!canUse) {
                            if (resource.getHostId() != null) {
                                HostVO dHost = _hostDao.findById(resource.getHostId());
                                if (dHost.getClusterId() == cluster.getId()) {
                                    hostToUse.add(dHost);
                                }
                            }
                        }

                    }
                }

                if (hostToUse.isEmpty() && !canUse) {
                    throw new CloudRuntimeException("Cannot use this cluster " + cluster.getName()
                            + " for explicit dedication");
                }

                if (hostToUse != null && hostToUse.size() != 0) {
                    // add other non-dedicated hosts to avoid list
                    List<HostVO> hostList = _hostDao.findByClusterId(cluster.getId());
                    for (HostVO host : hostList) {
                        if (!hostToUse.contains(host)) {
                            avoid.addHost(host.getId());
                        }
                    }
                }

            } else if (plan.getPodId() != null) {
                HostPodVO pod = _podDao.findById(plan.getPodId());
                DataCenterVO zoneOfPod = _dcDao.findById(pod.getDataCenterId());
                List<ClusterVO> clustersToUse = new ArrayList<ClusterVO>();
                List<HostVO> hostsToUse = new ArrayList<HostVO>();
                // check whether this cluster or its pod is dedicated
                if (resourceList != null && resourceList.size() != 0) {
                    for (DedicatedResourceVO resource : resourceList) {
                        if ((resource.getPodId() != null && resource.getPodId() == pod.getId())
                                || (resource.getDataCenterId() != null && resource.getDataCenterId() == zoneOfPod
                                        .getId())) {
                            canUse = true;
                        }

                        // check for all dedicated cluster/host; if it belongs
                        // to
                        // this pod
                        if (!canUse) {
                            if (resource.getClusterId() != null) {
                                ClusterVO dCluster = _clusterDao.findById(resource.getClusterId());
                                if (dCluster.getPodId() == pod.getId()) {
                                    clustersToUse.add(dCluster);
                                }
                            }
                            if (resource.getHostId() != null) {
                                HostVO dHost = _hostDao.findById(resource.getHostId());
                                if (dHost.getPodId() == pod.getId()) {
                                    hostsToUse.add(dHost);
                                }
                            }
                        }

                    }
                }

                if (hostsToUse.isEmpty() && clustersToUse.isEmpty() && !canUse) {
                    throw new CloudRuntimeException("Cannot use this pod " + pod.getName() + " for explicit dedication");
                }

                if (clustersToUse != null && clustersToUse.size() != 0) {
                    // add other non-dedicated clusters to avoid list
                    List<ClusterVO> clusterList = _clusterDao.listByPodId(pod.getId());
                    for (ClusterVO cluster : clusterList) {
                        if (!clustersToUse.contains(cluster)) {
                            avoid.addCluster(cluster.getId());
                        }
                    }
                }

                if (hostsToUse != null && hostsToUse.size() != 0) {
                    // add other non-dedicated hosts to avoid list
                    List<HostVO> hostList = _hostDao.findByPodId(pod.getId());
                    for (HostVO host : hostList) {
                        if (!hostsToUse.contains(host)) {
                            avoid.addHost(host.getId());
                        }
                    }
                }

            } else {
                // check all resources under this zone
                if (resourceList != null && resourceList.size() != 0) {
                    avoid = updateAvoidList(resourceList, avoid, dc);
                } else {
                    avoid.addDataCenter(dc.getId());
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("No dedicated resources available for this domain or account under this group");
                    }
                }
View Full Code Here

TOP

Related Classes of com.cloud.dc.DataCenter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.