Examples of VolumeVO


Examples of com.cloud.storage.VolumeVO

    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

Examples of com.cloud.storage.VolumeVO

        diskOffering.setCustomized(false);
        diskOffering.setRecreatable(false);
        diskOffering = diskOfferingDao.persist(diskOffering);
        diskOfferingId = diskOffering.getId();

        volume = new VolumeVO(Volume.Type.ROOT, "volume", dcId, 1, 1, diskOffering.getId(), diskOffering.getDiskSize(),
                diskOffering.getMinIops(), diskOffering.getMaxIops(), "");
        volume = volumeDao.persist(volume);
        volumeId = volume.getId();
    }
View Full Code Here

Examples of com.cloud.storage.VolumeVO

            }
        }
    }

    private void publishUsageEvent(String type, VMSnapshot vmSnapshot, UserVm userVm, VolumeTO volumeTo){
        VolumeVO volume = _volumeDao.findById(volumeTo.getId());
        Long diskOfferingId = volume.getDiskOfferingId();
        Long offeringId = null;
        if (diskOfferingId != null) {
            DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId);
            if (offering != null
                    && (offering.getType() == DiskOfferingVO.Type.Disk)) {
                offeringId = offering.getId();
            }
        }
        UsageEventUtils.publishUsageEvent(
                type,
                vmSnapshot.getAccountId(),
                userVm.getDataCenterId(),
                userVm.getId(),
                vmSnapshot.getName(),
                offeringId,    
                volume.getId(), // save volume's id into templateId field
                volumeTo.getChainSize(),
                VMSnapshot.class.getName(), vmSnapshot.getUuid());      
    }
View Full Code Here

Examples of com.cloud.storage.VolumeVO

    }

    private void updateVolumePath(List<VolumeTO> volumeTOs) {
        for (VolumeTO volume : volumeTOs) {
            if (volume.getPath() != null) {
                VolumeVO volumeVO = _volumeDao.findById(volume.getId());
                volumeVO.setPath(volume.getPath());
                volumeVO.setVmSnapshotChainSize(volume.getChainSize());
                _volumeDao.persist(volumeVO);
            }
        }
    }
View Full Code Here

Examples of com.cloud.storage.VolumeVO

       
        List<VolumeVO> listVolumes = _volumeDao.findByInstance(vmId);
        if (listVolumes == null || listVolumes.size() == 0) {
            throw new InvalidParameterValueException("vmInstance has no volumes");
        }
        VolumeVO volume = listVolumes.get(0);
        Long poolId = volume.getPoolId();
        if (poolId == null) {
            throw new InvalidParameterValueException("pool id is not found");
        }
        StoragePoolVO storagePool = _storagePoolDao.findById(poolId);
        if (storagePool == null) {
View Full Code Here

Examples of com.cloud.storage.VolumeVO

            return null;
        }
    }

    private VolumeVO createVolume(Long templateId, long dataStoreId) {
        VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
        ;
        volume.setPoolId(dataStoreId);
        volume = volumeDao.persist(volume);
        return volume;
    }
View Full Code Here

Examples of com.cloud.storage.VolumeVO

    @Test
    public void testCopyBaseImage() {
        DataStore primaryStore = createPrimaryDataStore();
        primaryStoreId = primaryStore.getId();
        primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
        VolumeVO volume = createVolume(image.getId(), primaryStore.getId());
        VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeFromTemplateAsync(volInfo,
                this.primaryStoreId, this.templateFactory.getTemplate(this.image.getId(), DataStoreRole.Image));
        try {
            VolumeApiResult result = future.get();

            AssertJUnit.assertTrue(result.isSuccess());

            VolumeInfo newVol = result.getVolume();
            boolean res = this.volumeService.destroyVolume(newVol.getId());
            Assert.assertTrue(res);
            VolumeInfo vol = this.volFactory.getVolume(volume.getId());
            future = this.volumeService.expungeVolumeAsync(vol);
            result = future.get();
            Assert.assertTrue(result.isSuccess());
        } catch (InterruptedException e) {
            Assert.fail(e.toString());
View Full Code Here

Examples of com.cloud.storage.VolumeVO

    @Test
    public void testCreateDataDisk() throws InterruptedException, ExecutionException {
        DataStore primaryStore = createPrimaryDataStore();
        primaryStoreId = primaryStore.getId();
        primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
        VolumeVO volume = createVolume(null, primaryStore.getId());
        VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeAsync(volInfo, primaryStore);
        VolumeApiResult result = future.get();
        Assert.assertTrue(result.isSuccess());
    }
View Full Code Here

Examples of com.cloud.storage.VolumeVO

    @Test
    public void testDeleteDisk() throws InterruptedException, ExecutionException, ConcurrentOperationException {
        DataStore primaryStore = createPrimaryDataStore();
        primaryStoreId = primaryStore.getId();
        primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
        VolumeVO volume = createVolume(null, primaryStore.getId());
        VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeAsync(volInfo, primaryStore);

        VolumeApiResult result = future.get();
        Assert.assertTrue(result.isSuccess());
        VolumeInfo vol = result.getVolume();
View Full Code Here

Examples of com.cloud.storage.VolumeVO

    @Test
    public void testCreateTemplateFromVolume() throws InterruptedException, ExecutionException {
        DataStore primaryStore = createPrimaryDataStore();
        primaryStoreId = primaryStore.getId();
        primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
        VolumeVO volume = createVolume(null, primaryStore.getId());
        VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeAsync(volInfo, primaryStore);

        VolumeApiResult result = future.get();

        AssertJUnit.assertTrue(result.isSuccess());
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.