Package com.cloud.storage

Examples of com.cloud.storage.Volume


    @Override
    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
        ResourceAllocationException, NetworkRuleConflictException {

            Volume volume = _volumeService.uploadVolume(this);
            if (volume != null){
            VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
                response.setResponseName(getCommandName());
                setResponseObject(response);
            } else {
View Full Code Here


    private boolean checkIfMigrationRequired(Map<Volume, List<StoragePool>> volumePools) {
        boolean migratingToOtherStoragePool = false;
        Iterator<Volume> volumesIt = volumePools.keySet().iterator();
        while(volumesIt.hasNext()) {
            Volume vol = volumesIt.next();
            List<StoragePool> poolList = volumePools.get(vol);
            for (StoragePool pool : poolList) {
                // See if any volume requies migration to another storage pool
                if (pool.getId() != vol.getPoolId()) {
                    migratingToOtherStoragePool = true;
                }
            }
        }
        return migratingToOtherStoragePool;
View Full Code Here

    @Inject
    DataStoreManager dataStoreMgr;

    @Override
    protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, DeploymentPlan plan) {
        Volume volume = _volumeDao.findById(dskCh.getVolumeId());
        List<Volume> requestVolumes = new ArrayList<Volume>();
        requestVolumes.add(volume);

        return storageMgr.storagePoolHasEnoughIops(requestVolumes, pool) &&
               storageMgr.storagePoolHasEnoughSpace(requestVolumes, pool);
View Full Code Here

      return getId();
    }

    @Override
    public long getEntityOwnerId() {
        Volume volume = _entityMgr.findById(Volume.class, getId());
        if (volume != null) {
            return volume.getAccountId();
        }

        // invalid id, parent this command to SYSTEM so ERROR events are tracked
        return Account.ACCOUNT_ID_SYSTEM;
    }
View Full Code Here

    }
   
    @Override
    public void create() throws ResourceAllocationException{

        Volume volume = _storageService.allocVolume(this);
        if (volume != null) {
            this.setEntityId(volume.getId());
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
       
    }
View Full Code Here

    }
   
    @Override
    public void execute(){
        UserContext.current().setEventDetails("Volume Id: "+getEntityId()+((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
        Volume volume = _storageService.createVolume(this);
        if (volume != null) {
            VolumeResponse response = _responseGenerator.createVolumeResponse(volume);
            //FIXME - have to be moved to ApiResponseHelper
            response.setSnapshotId(getSnapshotId())// if the volume was created from a snapshot, snapshotId will be set so we pass it back in the response
            response.setResponseName(getCommandName());
View Full Code Here

    }

    @Override
    public long getEntityOwnerId() {
       
        Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
        if (volume == null) {
          throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId);
        }
       
        Account account = _accountService.getAccount(volume.getAccountId());
        //Can create templates for enabled projects/accounts only
        if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
          Project project = _projectService.findByProjectAccountId(volume.getAccountId());
            if (project.getState() != Project.State.Active) {
                throw new PermissionDeniedException("Can't add resources to the project id=" + project.getId() + " in state=" + project.getState() + " as it's no longer active");
            }
        } else if (account.getState() == Account.State.disabled) {
            throw new PermissionDeniedException("The owner of template is disabled: " + account);
        }
       
        return volume.getAccountId();
    }
View Full Code Here

      return getId();
    }

    @Override
    public long getEntityOwnerId() {
        Volume volume = _responseGenerator.findVolumeById(getId());
        if (volume == null) {
            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
        }
        return volume.getAccountId();
    }
View Full Code Here

    }
   
    @Override
    public void execute(){
        UserContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
        Volume result = _userVmService.attachVolumeToVM(this);
        if (result != null) {
            VolumeResponse response = _responseGenerator.createVolumeResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
View Full Code Here

    @Override
    public long getEntityOwnerId() {
        Long volumeId = getId();
        if (volumeId != null) {
            Volume volume = _responseGenerator.findVolumeById(volumeId);
            if (volume != null) {
                return volume.getAccountId();
            }
        } else if (getVirtualMachineId() != null) {
            UserVm vm = _responseGenerator.findUserVmById(getVirtualMachineId());
            if (vm != null) {
                return vm.getAccountId();
View Full Code Here

TOP

Related Classes of com.cloud.storage.Volume

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.