本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例8: advanceStart
import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException,
ConcurrentOperationException, OperationTimedoutException;
示例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;
示例10: findHostAndMigrate
import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
void findHostAndMigrate(String vmUuid, Long newSvcOfferingId, DeploymentPlanner.ExcludeList excludeHostList) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException;
示例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);
}
示例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);
}
示例13: reserveVirtualMachine
import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
String reserveVirtualMachine(VMEntityVO vmEntityVO, DeploymentPlanner plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException,
ResourceUnavailableException;
示例14: getPlanners
import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
public List<DeploymentPlanner> getPlanners() {
return _planners;
}
示例15: setPlanners
import com.cloud.deploy.DeploymentPlanner; //导入依赖的package包/类
@Inject
public void setPlanners(final List<DeploymentPlanner> planners) {
this._planners = planners;
}