Package org.apache.cloudstack.engine.cloud.entity.api.db

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


    }

    @Override
    public void loadVmReservation(VMEntityVO vm) {
        VMReservationVO vmReservation = _vmReservationDao.findByVmId(vm.getId());
        vm.setVmReservation(vmReservation);
    }
View Full Code Here


    }

    @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

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

        VMReservationVO dbVO = super.persist(reservation);

        saveVolumeReservation(reservation);
        loadVolumeReservation(dbVO);

        txn.commit();
View Full Code Here

        }
    }

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

    public void deployVirtualMachine(String reservationId, VMEntityVO vmEntityVO, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{
        //grab the VM Id and destination using the reservationId.

        VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());

        VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId);
        if(vmReservation != null){

            DataCenterDeployment reservedPlan = new DataCenterDeployment(vm.getDataCenterId(),
                    vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), null, null);
            try {
                _itMgr.start(vm.getUuid(), params, reservedPlan);
            } catch (Exception ex) {
                // Retry the deployment without using the reservation plan
                DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
View Full Code Here

                    }
                }
            }

            if (saveReservation) {
                    VMReservationVO vmReservation =
                        new VMReservationVO(vm.getId(), plannedDestination.getDataCenter().getId(), plannedDestination.getPod().getId(), plannedDestination.getCluster()
                            .getId(), plannedDestination.getHost().getId());
                    if (planner != null) {
                        vmReservation.setDeploymentPlanner(planner.getName());
                    }
                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

                    }
                }
            }

            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();
            }
        } finally {
            txn.commit();
        }
        return null;
View Full Code Here

    }

    @Override
    public void loadVmReservation(VMEntityVO vm) {
        VMReservationVO vmReservation = _vmReservationDao.findByVmId(vm.getId());
        vm.setVmReservation(vmReservation);
    }
View Full Code Here

    }

    @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

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

        VMReservationVO dbVO = super.persist(reservation);

        saveVolumeReservation(reservation);
        loadVolumeReservation(dbVO);

        txn.commit();
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO

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.