当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentPlanner类代码示例

本文整理汇总了Java中com.cloud.deploy.DeploymentPlanner的典型用法代码示例。如果您正苦于以下问题:Java DeploymentPlanner类的具体用法?Java DeploymentPlanner怎么用?Java DeploymentPlanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeploymentPlanner类属于com.cloud.deploy包,在下文中一共展示了DeploymentPlanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testScaleVM3

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void testScaleVM3() throws Exception {

    /*VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);

    Long srcHostId = vm.getHostId();
    Long oldSvcOfferingId = vm.getServiceOfferingId();
    if (srcHostId == null) {
        throw new CloudRuntimeException("Unable to scale the vm because it doesn't have a host id");
    }*/

    when(_vmInstance.getHostId()).thenReturn(null);
    when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
    when(_vmInstanceDao.findByUuid(any(String.class))).thenReturn(_vmInstance);
    final DeploymentPlanner.ExcludeList excludeHostList = new DeploymentPlanner.ExcludeList();
    _vmMgr.findHostAndMigrate(_vmInstance.getUuid(), 2l, excludeHostList);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:VirtualMachineManagerImplTest.java

示例2: testScaleVM3

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void testScaleVM3() throws Exception {

    /*VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);

    Long srcHostId = vm.getHostId();
    Long oldSvcOfferingId = vm.getServiceOfferingId();
    if (srcHostId == null) {
        throw new CloudRuntimeException("Unable to scale the vm because it doesn't have a host id");
    }*/

    when(_vmInstance.getHostId()).thenReturn(null);
    when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
    when(_vmInstanceDao.findByUuid(any(String.class))).thenReturn(_vmInstance);
    DeploymentPlanner.ExcludeList excludeHostList = new DeploymentPlanner.ExcludeList();
    _vmMgr.findHostAndMigrate(_vmInstance.getUuid(), 2l, excludeHostList);

}
 
开发者ID:apache,项目名称:cloudstack,代码行数:19,代码来源:VirtualMachineManagerImplTest.java

示例3: listDeploymentPlanners

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Override
public List<String> listDeploymentPlanners() {
    final List<String> plannersAvailable = new ArrayList<>();
    for (final DeploymentPlanner planner : _planners) {
        plannersAvailable.add(planner.getName());
    }

    return plannersAvailable;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:10,代码来源:ManagementServerImpl.java

示例4: verifyAllocateAndStartTheSystemVmTest

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
private void verifyAllocateAndStartTheSystemVmTest(LinkedHashMap<Network, List<? extends NicProfile>> networks, AutonomiccsSystemVm autonomiccsSystemVm,
        HypervisorType hypervisorType, Map<VirtualMachineProfile.Param, Object> arg1, DeploymentPlanner arg2, int getters, int timesGetId, int timesFindById,
        int timesAdvanceStart) throws InsufficientCapacityException, ResourceUnavailableException, OperationTimedoutException {
    Mockito.verify(autonomiccsSystemVm, Mockito.times(getters)).getInstanceName();
    Mockito.verify(autonomiccsSystemVm, Mockito.times(timesGetId)).getId();
    Mockito.verify(autonomiccsSystemVm, Mockito.times(getters)).getUuid();
    InOrder inOrderVirtualMachineManager = Mockito.inOrder(virtualMachineManager);
    inOrderVirtualMachineManager.verify(virtualMachineManager).allocate(Mockito.anyString(), Mockito.any(VMTemplateVO.class), Mockito.any(ServiceOfferingVO.class),
            Mockito.eq(networks),
            Mockito.any(DataCenterDeployment.class), Mockito.eq(hypervisorType));
    inOrderVirtualMachineManager.verify(virtualMachineManager, Mockito.times(timesAdvanceStart)).advanceStart(Mockito.anyString(), Mockito.eq(arg1), Mockito.eq(arg2));
    Mockito.verify(autonomiccsSystemVmDao, Mockito.times(timesFindById)).findById(Mockito.anyLong());
}
 
开发者ID:Autonomiccs,项目名称:autonomiccs-platform,代码行数:14,代码来源:AutonomiccsSystemVmDeploymentServiceTest.java

示例5: configureAllocateAndStartTheSystemVmTest

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
private void configureAllocateAndStartTheSystemVmTest(LinkedHashMap<Network, List<? extends NicProfile>> networks, AutonomiccsSystemVm autonomiccsSystemVm,
        HypervisorType hypervisorType, Map<VirtualMachineProfile.Param, Object> arg1, DeploymentPlanner arg2)
                throws InsufficientCapacityException, ResourceUnavailableException, OperationTimedoutException {
    Mockito.doReturn(0l).when(autonomiccsSystemVm).getId();
    Mockito.doReturn("uuid").when(autonomiccsSystemVm).getUuid();
    Mockito.doReturn("instanceName").when(autonomiccsSystemVm).getInstanceName();
    Mockito.doNothing().when(virtualMachineManager).allocate(Mockito.anyString(), Mockito.any(VMTemplateVO.class), Mockito.any(ServiceOfferingVO.class), Mockito.eq(networks),
            Mockito.any(DataCenterDeployment.class), Mockito.eq(hypervisorType));
    Mockito.doReturn(autonomiccsSystemVm).when(autonomiccsSystemVmDao).findById(Mockito.anyLong());
    Mockito.doNothing().when(virtualMachineManager).advanceStart(Mockito.anyString(), Mockito.eq(arg1), Mockito.eq(arg2));
    Mockito.doReturn(autonomiccsSystemVm).when(autonomiccsSystemVmDao).findById(Mockito.anyLong());
}
 
开发者ID:Autonomiccs,项目名称:autonomiccs-platform,代码行数:13,代码来源:AutonomiccsSystemVmDeploymentServiceTest.java

示例6: listDeploymentPlanners

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Override
public List<String> listDeploymentPlanners() {
    final List<String> plannersAvailable = new ArrayList<String>();
    for (final DeploymentPlanner planner : _planners) {
        plannersAvailable.add(planner.getName());
    }

    return plannersAvailable;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:10,代码来源:ManagementServerImpl.java

示例7: testSetUp

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Before
public void testSetUp() {
    MockitoAnnotations.initMocks(this);

    ComponentContext.initComponentsLifeCycle();

    PlannerHostReservationVO reservationVO = new PlannerHostReservationVO(200L, 1L, 2L, 3L, PlannerResourceUsage.Shared);
    Mockito.when(_plannerHostReserveDao.persist(Matchers.any(PlannerHostReservationVO.class))).thenReturn(reservationVO);
    Mockito.when(_plannerHostReserveDao.findById(Matchers.anyLong())).thenReturn(reservationVO);
    Mockito.when(_affinityGroupVMMapDao.countAffinityGroupsForVm(Matchers.anyLong())).thenReturn(0L);

    VMInstanceVO vm = new VMInstanceVO();
    Mockito.when(vmProfile.getVirtualMachine()).thenReturn(vm);

    Mockito.when(vmDetailsDao.listDetailsKeyPairs(Matchers.anyLong())).thenReturn(null);

    Mockito.when(_dcDao.findById(Matchers.anyLong())).thenReturn(dc);
    Mockito.when(dc.getId()).thenReturn(dataCenterId);

    ClusterVO clusterVO = new ClusterVO();
    clusterVO.setHypervisorType(HypervisorType.XenServer.toString());
    Mockito.when(_clusterDao.findById(Matchers.anyLong())).thenReturn(clusterVO);

    Mockito.when(_planner.getName()).thenReturn("FirstFitPlanner");
    List<DeploymentPlanner> planners = new ArrayList<DeploymentPlanner>();
    planners.add(_planner);
    _dpm.setPlanners(planners);

}
 
开发者ID:apache,项目名称:cloudstack,代码行数:30,代码来源:DeploymentPlanningManagerImplTest.java

示例8: advanceStart

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException,
ConcurrentOperationException, OperationTimedoutException;
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:3,代码来源:VirtualMachineManager.java

示例9: orchestrateStart

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
void orchestrateStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy, DeploymentPlanner planner) throws
InsufficientCapacityException,
ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:4,代码来源:VirtualMachineManager.java

示例10: findHostAndMigrate

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
void findHostAndMigrate(String vmUuid, Long newSvcOfferingId, DeploymentPlanner.ExcludeList excludeHostList) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException;
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:3,代码来源:VirtualMachineManager.java

示例11: advanceStart

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Override
public void advanceStart(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params, final DeploymentPlanner planner)
        throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
    advanceStart(vmUuid, params, null, planner);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:6,代码来源:VirtualMachineManagerImpl.java

示例12: startVmThroughJobQueue

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
public Outcome<VirtualMachine> startVmThroughJobQueue(final String vmUuid,
                                                      final Map<VirtualMachineProfile.Param, Object> params,
                                                      final DeploymentPlan planToDeploy, final DeploymentPlanner planner) {

    final CallContext context = CallContext.current();
    final User callingUser = context.getCallingUser();
    final Account callingAccount = context.getCallingAccount();

    final VMInstanceVO vm = _vmDao.findByUuid(vmUuid);

    VmWorkJobVO workJob = null;
    final List<VmWorkJobVO> pendingWorkJobs = _workJobDao.listPendingWorkJobs(VirtualMachine.Type.Instance,
            vm.getId(), VmWorkStart.class.getName());

    if (pendingWorkJobs.size() > 0) {
        assert pendingWorkJobs.size() == 1;
        workJob = pendingWorkJobs.get(0);
    } else {
        workJob = new VmWorkJobVO(context.getContextId());

        workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
        workJob.setCmd(VmWorkStart.class.getName());

        workJob.setAccountId(callingAccount.getId());
        workJob.setUserId(callingUser.getId());
        workJob.setStep(VmWorkJobVO.Step.Starting);
        workJob.setVmType(VirtualMachine.Type.Instance);
        workJob.setVmInstanceId(vm.getId());
        workJob.setRelated(AsyncJobExecutionContext.getOriginJobId());

        // save work context info (there are some duplications)
        final VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER);
        workInfo.setPlan(planToDeploy);
        workInfo.setParams(params);
        if (planner != null) {
            workInfo.setDeploymentPlanner(planner.getName());
        }
        workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));

        _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
    }

    AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());

    return new VmStateSyncOutcome(workJob,
            VirtualMachine.PowerState.PowerOn, vm.getId(), null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:48,代码来源:VirtualMachineManagerImpl.java

示例13: reserveVirtualMachine

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
String reserveVirtualMachine(VMEntityVO vmEntityVO, DeploymentPlanner plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException,
ResourceUnavailableException;
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:3,代码来源:VMEntityManager.java

示例14: getPlanners

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
public List<DeploymentPlanner> getPlanners() {
    return _planners;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:4,代码来源:VMEntityManagerImpl.java

示例15: setPlanners

import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Inject
public void setPlanners(final List<DeploymentPlanner> planners) {
    this._planners = planners;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:5,代码来源:VMEntityManagerImpl.java


注:本文中的com.cloud.deploy.DeploymentPlanner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。