Examples of DeployDestination


Examples of com.cloud.deploy.DeployDestination

         // call to core process
        DataCenterVO dcVO = _dcDao.findById(destinationHost.getDataCenterId());
        HostPodVO pod = _podDao.findById(destinationHost.getPodId());
        Cluster cluster = _clusterDao.findById(destinationHost.getClusterId());
        DeployDestination dest = new DeployDestination(dcVO, pod, cluster,
                destinationHost);

        // check max guest vm limit for the destinationHost
        HostVO destinationHostVO = _hostDao.findById(destinationHost.getId());
        if (_capacityMgr.checkIfHostReachMaxGuestLimit(destinationHostVO)) {
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

                            Network newNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
                                    newAccount.getAccountName() + "-network", newAccount.getAccountName() + "-network", null, null,
                                    null, null, newAccount, null, physicalNetwork, zone.getId(), ACLType.Account, null, null, null, null, true, null);
                            // if the network offering has persistent set to true, implement the network
                            if (requiredOfferings.get(0).getIsPersistent()) {
                                DeployDestination dest = new DeployDestination(zone, null, null, null);
                                UserVO callerUser = _userDao.findById(UserContext.current().getCallerUserId());
                                Journal journal = new Journal.LogJournal("Implementing " + newNetwork, s_logger);
                                ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(),
                                        journal, callerUser, caller);
                                s_logger.debug("Implementing the network for account" + newNetwork + " as a part of" +
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

        Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);

        DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);

        Mockito.when(avoids.shouldAvoid((DataCenterVO) Mockito.anyObject())).thenReturn(true);
        DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids);
        assertNull("DataCenter is in avoid set, destination should be null! ", dest);
    }
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

        DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
        Mockito.when(avoids.shouldAvoid((DataCenterVO) Mockito.anyObject())).thenReturn(false);

        Mockito.when(_planner.canHandle(vmProfile, plan, avoids)).thenReturn(false);
        DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids);
        assertNull("Planner cannot handle, destination should be null! ", dest);
    }
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

        DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
        Mockito.when(avoids.shouldAvoid((DataCenterVO) Mockito.anyObject())).thenReturn(false);
        Mockito.when(_planner.canHandle(vmProfile, plan, avoids)).thenReturn(true);

        Mockito.when(((DeploymentClusterPlanner) _planner).orderClusters(vmProfile, plan, avoids)).thenReturn(null);
        DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids);
        assertNull("Planner cannot handle, destination should be null! ", dest);
    }
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

    @Test(expected=CloudRuntimeException.class)
    public void testScaleVM1()  throws Exception {


        DeployDestination dest = new DeployDestination(null, null, null, _host);
        long l = 1L;

        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
        _vmMgr.migrateForScale(_vmInstance, l, dest, l);
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

    }

    @Test (expected=CloudRuntimeException.class)
    public void testScaleVM2()  throws Exception {

        DeployDestination dest = new DeployDestination(null, null, null, _host);
        long l = 1L;

        doReturn(3L).when(_vmInstance).getId();
        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
        ServiceOfferingVO newServiceOffering = getSvcoffering(512);
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

      HostVO h = _hostDao.findById(vm.getLastHostId());
      DataCenter dc = _dcDao.findById(h.getDataCenterId());
      Pod pod = _podDao.findById(h.getPodId());
      Cluster c =  _clusterDao.findById(h.getClusterId());
      s_logger.debug("Start baremetal vm " + vm.getId() + " on last stayed host " + h.getId());
      return new DeployDestination(dc, pod, c, h);
    }
   
    if (haVmTag != null) {
        hostTag = haVmTag;
    } else if (offering.getHostTag() != null) {
      String[] tags = offering.getHostTag().split(",");
      if (tags.length > 0) {
        hostTag = tags[0];
      }
    }
   
    List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterId(), HypervisorType.BareMetal.toString());
    int cpu_requested;
    long ram_requested;
    HostVO target = null;
    List<HostVO> hosts;
    for (ClusterVO cluster : clusters) {
      hosts = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
      if (hostTag != null) {
        for (HostVO h : hosts) {
          _hostDao.loadDetails(h);
          if (h.getDetail("hostTag") != null && h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
            target = h;
            break;
          }
        }
      }
    }

    if (target == null) {
      s_logger.warn("Cannot find host with tag " + hostTag + " use capacity from service offering");
      cpu_requested = offering.getCpu() * offering.getSpeed();
      ram_requested = offering.getRamSize() * 1024L * 1024L;
    } else {
      cpu_requested = target.getCpus() * target.getSpeed().intValue();
      ram_requested = target.getTotalMemory();
    }
   
    for (ClusterVO cluster : clusters) {
        if (haVmTag == null) {
            hosts = _resourceMgr.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
        } else {
            s_logger.warn("Cannot find HA host with tag " + haVmTag + " in cluster id=" + cluster.getId() + ", pod id=" + cluster.getPodId() + ", data center id=" + cluster.getDataCenterId());
            return null;
        }
      for (HostVO h : hosts) {
                long cluster_id = h.getClusterId();
                ClusterDetailsVO cluster_detail_cpu =  _clusterDetailsDao.findDetail(cluster_id,"cpuOvercommitRatio") ;
                ClusterDetailsVO cluster_detail_ram =  _clusterDetailsDao.findDetail(cluster_id,"memoryOvercommitRatio");
                Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue());
                Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue());

        if (_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true)) {
          s_logger.debug("Find host " + h.getId() + " has enough capacity");
          DataCenter dc = _dcDao.findById(h.getDataCenterId());
          Pod pod = _podDao.findById(h.getPodId());
          return new DeployDestination(dc, pod, cluster, h);
        }
      }
    }

    s_logger.warn(String.format("Cannot find enough capacity(requested cpu=%1$s memory=%2$s)", cpu_requested, ram_requested));
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

        Pod pod = podId == null?null:_podDao.findById(podId);
        Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(
                1);
        params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
        Account owner = _accountService.getActiveAccountByName("system", new Long(1));
        DeployDestination dest = new DeployDestination(dc, pod, null, null);
        s_logger.debug("About to deploy ELB vm ");

        try {
            DomainRouterVO elbVm = deployELBVm(network, dest, owner, params);
            if (elbVm == null) {
View Full Code Here

Examples of com.cloud.deploy.DeployDestination

    NetworkVO network = mock(NetworkVO.class);
    when(network.getName()).thenReturn("testnetwork");
    when(network.getState()).thenReturn(State.Implementing);
    when(network.getPhysicalNetworkId()).thenReturn(42L);
   
    DeployDestination dest = mock(DeployDestination.class);
   
    DataCenter dc = mock(DataCenter.class);
    when(dest.getDataCenter()).thenReturn(dc);
   
    HostVO niciraHost = mock(HostVO.class);
    when(hostdao.findById(anyLong())).thenReturn(niciraHost);
    when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
    when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.