Examples of VMReservationVO


Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

        }
    }

    @Override
    public VMReservationVO findByReservationId(String reservationId) {
        VMReservationVO vmRes = super.findByUuid(reservationId);
        loadVolumeReservation(vmRes);
        return vmRes;
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

            List<Long> groupVMIds = _affinityGroupVMMapDao
                    .listVmIdsByAffinityGroup(vmGroupMapping.getAffinityGroupId());
            groupVMIds.remove(vm.getId());

            for (Long groupVMId : groupVMIds) {
                VMReservationVO vmReservation = _reservationDao.findByVmId(groupVMId);
                if (vmReservation != null && vmReservation.getHostId() != null
                        && vmReservation.getHostId().equals(plannedHostId)) {
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Planned destination for VM " + vm.getId() + " conflicts with an existing VM "
                                + vmReservation.getVmId() + " reserved on the same host " + plannedHostId);
                    }
                    return false;
                }
            }
        }
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

                        }
                    }
                }

                if (saveReservation) {
                    VMReservationVO vmReservation = new VMReservationVO(vm.getId(), plannedDestination.getDataCenter()
                            .getId(), plannedDestination.getPod().getId(), plannedDestination.getCluster().getId(),
                            plannedDestination.getHost().getId());
                    Map<Long, Long> volumeReservationMap = new HashMap<Long, Long>();

                    if (vm.getHypervisorType() != HypervisorType.BareMetal) {
                        for (Volume vo : plannedDestination.getStorageForDisks().keySet()) {
                            volumeReservationMap.put(vo.getId(), plannedDestination.getStorageForDisks().get(vo).getId());
                        }
                        vmReservation.setVolumeReservation(volumeReservationMap);
                    }
                    _reservationDao.persist(vmReservation);
                    return vmReservation.getUuid();
                }

                return null;
            }
        });
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

            dest = planner.plan(vmProfile, plan, exclude);
        }

        if (dest != null) {
           //save destination with VMEntityVO
            VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest.getPod().getId(), dest.getCluster().getId(), dest.getHost().getId());
            Map<Long,Long> volumeReservationMap = new HashMap<Long,Long>();
           
            if (vm.getHypervisorType() != HypervisorType.BareMetal) {
                for(Volume vo : dest.getStorageForDisks().keySet()){
                    volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
                }
                vmReservation.setVolumeReservation(volumeReservationMap);
            }

            vmEntityVO.setVmReservation(vmReservation);
            _vmEntityDao.persist(vmEntityVO);
           
            return vmReservation.getUuid();
        }else{
            throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
        }
       
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

    @Override
    public void deployVirtualMachine(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{
        //grab the VM Id and destination using the reservationId.
       
        VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId);
        long vmId = vmReservation.getVmId();
       
        VMInstanceVO vm = _vmDao.findById(vmId);
        //Pass it down
        Long poolId = null;
        Map<Long,Long> storage = vmReservation.getVolumeReservation();
        if(storage != null){
            List<Long> volIdList = new ArrayList<Long>(storage.keySet());
            if(volIdList !=null && !volIdList.isEmpty()){
                poolId = storage.get(volIdList.get(0));
            }
        }
       
        DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(),
                vmReservation.getHostId(), null , null);
       
        VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan);
       
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

    }
   
    @Override
    public VMReservationVO findByVmId(long vmId) {
        SearchCriteria<VMReservationVO> sc = VmIdSearch.create("vmId", vmId);
        VMReservationVO vmRes = findOneBy(sc);
        loadVolumeReservation(vmRes);
        return vmRes;
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

    @DB
    public VMReservationVO persist(VMReservationVO reservation) {
        Transaction txn = Transaction.currentTxn();
        txn.start();

        VMReservationVO dbVO = super.persist(reservation);

        saveVolumeReservation(reservation);
        loadVolumeReservation(dbVO);

        txn.commit();
View Full Code Here

Examples of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

        }       
    }

    @Override
    public VMReservationVO findByReservationId(String reservationId) {
        VMReservationVO vmRes = super.findByUuid(reservationId);
        loadVolumeReservation(vmRes);
        return vmRes;
    }
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.