Package com.cloud.storage

Examples of com.cloud.storage.StoragePool


    }

    @Override
    public void execute(){
        try {
            StoragePool result = _storageService.createPool(this);
            if (result != null) {
                StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
                response.setResponseName(getCommandName());
                this.setResponseObject(response);
            } else {
View Full Code Here


        for (StoragePoolVO pool : pools) {
            if (suitablePools.size() == returnUpTo) {
                break;
            }
            StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
            if (filter(avoid, pol, dskCh, plan)) {
                suitablePools.add(pol);
            } else {
                avoid.addPool(pool.getId());
            }
View Full Code Here

        for (StoragePoolVO storage : storagePools) {
            if (suitablePools.size() == returnUpTo) {
                break;
            }
            StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(storage.getId());
            if (filter(avoid, pol, dskCh, plan)) {
                suitablePools.add(pol);
            } else {
                avoid.addPool(pol.getId());
            }
        }
        return suitablePools;
    }
View Full Code Here

    }

    private void updateVolumesAfterMigration(Map<VolumeInfo, DataStore> volumeToPool) {
        for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
            VolumeInfo volume = entry.getKey();
            StoragePool pool = (StoragePool)entry.getValue();

            VolumeVO volumeVO = volDao.findById(volume.getId());
            Long oldPoolId = volumeVO.getPoolId();
            volumeVO.setLastPoolId(oldPoolId);
            volumeVO.setFolder(pool.getPath());
            volumeVO.setPodId(pool.getPodId());
            volumeVO.setPoolId(pool.getId());

            volDao.update(volume.getId(), volumeVO);
            s_logger.debug("Volume path was successfully updated for volume " + volume.getName() + " after it was migrated.");
        }
    }
View Full Code Here

    protected List<VolumeTO> getVolumeTOList(Long vmId) {
        List<VolumeTO> volumeTOs = new ArrayList<VolumeTO>();
        List<VolumeVO> volumeVos = _volumeDao.findByInstance(vmId);
       
        for (VolumeVO volume : volumeVos) {
            StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
            VolumeTO volumeTO = new VolumeTO(volume, pool);
            volumeTOs.add(volumeTO);
        }
        return volumeTOs;
    }
View Full Code Here

        }
    }

    protected Answer copyVolumeFromSnapshot(DataObject snapObj, DataObject volObj) {
        SnapshotInfo snapshot = (SnapshotInfo) snapObj;
        StoragePool pool = (StoragePool) volObj.getDataStore();

        String basicErrMsg = "Failed to create volume from " + snapshot.getName() + " on pool " + pool;
        DataStore store = snapObj.getDataStore();
        DataStoreTO storTO = store.getTO();
        DataObject srcData = snapObj;
View Full Code Here

    }

    protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) {
        VolumeInfo volume = (VolumeInfo)srcData;
        StoragePool destPool = (StoragePool)this.dataStoreMgr.getDataStore(destData.getDataStore().getId(), DataStoreRole.Primary);
        MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool);
        EndPoint ep = selector.select(volume.getDataStore());
        MigrateVolumeAnswer answer = (MigrateVolumeAnswer) ep.sendMessage(command);

        if (answer == null || !answer.getResult()) {
            throw new CloudRuntimeException("Failed to migrate volume " + volume + " to storage pool " + destPool);
        } else {
            // Update the volume details after migration.
            VolumeVO volumeVo = this.volDao.findById(volume.getId());
            Long oldPoolId = volume.getPoolId();
            volumeVo.setPath(answer.getVolumePath());
            volumeVo.setFolder(destPool.getPath());
            volumeVo.setPodId(destPool.getPodId());
            volumeVo.setPoolId(destPool.getId());
            volumeVo.setLastPoolId(oldPoolId);
            this.volDao.update(volume.getId(), volumeVo);
        }

        return answer;
View Full Code Here

    }

    @Override
    public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
        VolumeObject vol = (VolumeObject) data;
        StoragePool pool = (StoragePool) data.getDataStore();
        ResizeVolumePayload resizeParameter = (ResizeVolumePayload) vol.getpayload();

        ResizeVolumeCommand resizeCmd = new ResizeVolumeCommand(vol.getPath(), new StorageFilerTO(pool), vol.getSize(),
                resizeParameter.newSize, resizeParameter.shrinkOk, resizeParameter.instanceName);
        CreateCmdResult result = new CreateCmdResult(null, null);
View Full Code Here

        return  "preparing storage pool: " + getId() + " for maintenance";
    }

    @Override
    public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
        StoragePool result = _storageService.preparePrimaryStorageForMaintenance(getId());
        if (result != null){
            StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
            response.setResponseName("storagepool");
            this.setResponseObject(response);
        } else {
View Full Code Here

        boolean result = _storageService.deletePool(this);
        if (result) {
            SuccessResponse response = new SuccessResponse(getCommandName());
            this.setResponseObject(response);
        } else {
            StoragePool pool = _storageService.getStoragePool(id);
            if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
            } else {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool");
            }
        }
View Full Code Here

TOP

Related Classes of com.cloud.storage.StoragePool

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.