Examples of VolumeInfo


Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

    public void testCreateDataDisk() {
        DataStore primaryStore = createPrimaryDataStore();
        primaryStoreId = primaryStore.getId();
        primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
        VolumeVO volume = createVolume(null, primaryStore.getId());
        VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
        this.volumeService.createVolumeAsync(volInfo, primaryStore);
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

    public void testDeleteDisk() {
        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);
        try {
            VolumeApiResult result = future.get();
            VolumeInfo vol = result.getVolume();

            this.volumeService.destroyVolume(volInfo.getId());
            volInfo = this.volFactory.getVolume(vol.getId());
            this.volumeService.expungeVolumeAsync(volInfo);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ExecutionException e) {
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

    public void testCreateTemplateFromVolume() {
        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);
        try {
            VolumeApiResult result = future.get();

            AssertJUnit.assertTrue(result.isSuccess());
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

        // Initiate migration of a virtual machine with it's volumes.
        try {
            Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>();
            for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
                VolumeInfo volume = entry.getKey();
                VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
                StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue());
                volumeToFilerto.put(volumeTo, filerTo);
            }

            // Migration across cluster needs to be done in three phases.
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

        // Initiate migration of a virtual machine with it's volumes.
        try {
            Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>();
            for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
                VolumeInfo volume = entry.getKey();
                VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
                StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue());
                volumeToFilerto.put(volumeTo, filerTo);
            }

            MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto, destHost.getGuid());
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

        }
    }

    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 org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

    public VolumeInfo createCopyBaseImage() throws InterruptedException, ExecutionException {
        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));

        VolumeApiResult result;
        result = future.get();
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

        return image;
    }

    @Test
    public void createVolumeFromSnapshot() throws InterruptedException, ExecutionException {
        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        boolean result = false;
        for (SnapshotStrategy strategy : this.snapshotStrategies) {
            if (strategy.canHandle(snapshot)) {
                snapshot = strategy.takeSnapshot(snapshot);
                result = true;
            }
        }

        AssertJUnit.assertTrue(result);

        VolumeVO volVO = createVolume(vol.getTemplateId(), vol.getPoolId());
        VolumeInfo newVol = this.volFactory.getVolume(volVO.getId());
        AsyncCallFuture<VolumeApiResult> volFuture = this.volumeService.createVolumeFromSnapshot(newVol, newVol.getDataStore(), snapshot);
        VolumeApiResult apiResult = volFuture.get();
        Assert.assertTrue(apiResult.isSuccess());
    }
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

        Assert.assertTrue(apiResult.isSuccess());
    }

    @Test
    public void deleteSnapshot() throws InterruptedException, ExecutionException {
        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        SnapshotInfo newSnapshot = null;
        for (SnapshotStrategy strategy : this.snapshotStrategies) {
            if (strategy.canHandle(snapshot)) {
                newSnapshot = strategy.takeSnapshot(snapshot);
            }
View Full Code Here

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo

    }

    @Test
    public void createTemplateFromSnapshot() throws InterruptedException, ExecutionException {
        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        boolean result = false;
        for (SnapshotStrategy strategy : this.snapshotStrategies) {
            if (strategy.canHandle(snapshot)) {
                snapshot = strategy.takeSnapshot(snapshot);
                result = true;
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.