Package org.apache.cloudstack.engine.subsystem.api.storage.VolumeService

Examples of org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult


        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();
        Assert.assertTrue(result.isSuccess());
        return result.getVolume();

    }
View Full Code Here


        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

        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());
        } catch (ExecutionException e) {
            Assert.fail(e.toString());
        } catch (ConcurrentOperationException e) {
View Full Code Here

        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

        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();

        boolean res = this.volumeService.destroyVolume(volInfo.getId());
        Assert.assertTrue(res);
        volInfo = this.volFactory.getVolume(vol.getId());
        future = this.volumeService.expungeVolumeAsync(volInfo);
        result = future.get();
        Assert.assertTrue(result.isSuccess());
    }
View Full Code Here

        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());
        volInfo = result.getVolume();
        VMTemplateVO templateVO = createTemplateInDb();
        TemplateInfo tmpl = this.templateFactory.getTemplate(templateVO.getId(), DataStoreRole.Image);
        DataStore imageStore = this.dataStoreMgr.getImageStore(this.dcId);

        AsyncCallFuture<TemplateApiResult> templateResult = this.imageService.createTemplateFromVolumeAsync(volInfo, tmpl, imageStore);
View Full Code Here

        try {
            VolumeInfo vol = volFactory.getVolume(volume.getId());
            vol.addPayload(payload);

            AsyncCallFuture<VolumeApiResult> future = volService.resize(vol);
            VolumeApiResult result = future.get();
            if (result.isFailed()) {
                s_logger.warn("Failed to resize the volume " + volume);
                return null;
            }

            volume = _volsDao.findById(volume.getId());
View Full Code Here

    @DB
    protected Volume liveMigrateVolume(Volume volume, StoragePool destPool) {
        VolumeInfo vol = volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> future = volService.migrateVolume(vol, (DataStore)destPool);
        try {
            VolumeApiResult result = future.get();
            if (result.isFailed()) {
                s_logger.debug("migrate volume failed:" + result.getResult());
                return null;
            }
            return result.getVolume();
        } catch (InterruptedException e) {
            s_logger.debug("migrate volume failed", e);
            return null;
        } catch (ExecutionException e) {
            s_logger.debug("migrate volume failed", e);
View Full Code Here

        int copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
        // Copy volume from primary to secondary storage
        VolumeInfo srcVol = volFactory.getVolume(volume.getId());
        AsyncCallFuture<VolumeApiResult> cvAnswer = volService.copyVolume(srcVol, secStore);
        // Check if you got a valid answer.
        VolumeApiResult cvResult = null;
        try {
            cvResult = cvAnswer.get();
        } catch (InterruptedException e1) {
            s_logger.debug("failed copy volume", e1);
            throw new CloudRuntimeException("Failed to copy volume", e1);
        } catch (ExecutionException e1) {
            s_logger.debug("failed copy volume", e1);
            throw new CloudRuntimeException("Failed to copy volume", e1);
        }
        if (cvResult == null || cvResult.isFailed()) {
            String errorString = "Failed to copy the volume from the source primary storage pool to secondary storage.";
            throw new CloudRuntimeException(errorString);
        }

        VolumeInfo vol = cvResult.getVolume();

        String extractUrl = secStore.createEntityExtractUrl(vol.getPath(), vol.getFormat(), vol);
        volumeStoreRef = _volumeStoreDao.findByVolume(volumeId);
        volumeStoreRef.setExtractUrl(extractUrl);
        volumeStoreRef.setExtractUrlCreated(DateUtil.now());
View Full Code Here

        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();
            this.volumeService.destroyVolume(newVol.getId());
            VolumeInfo vol = this.volFactory.getVolume(volume.getId());
            this.volumeService.expungeVolumeAsync(vol);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult

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.