Examples of SnapshotStrategy


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

        if (snapshotCheck == null) {
            throw new InvalidParameterValueException("unable to find a snapshot with id " + snapshotId);
        }

        _accountMgr.checkAccess(caller, null, true, snapshotCheck);
        SnapshotStrategy snapshotStrategy = null;
        for (SnapshotStrategy strategy : this.snapshotStrategies) {
          if (strategy.canHandle(snapshotCheck)) {
            snapshotStrategy = strategy;
            break;
          }
        }
        try {
          boolean result = snapshotStrategy.deleteSnapshot(snapshotId);
          if (result) {
            if (snapshotCheck.getState() == Snapshot.State.BackedUp) {
              UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_DELETE, snapshotCheck.getAccountId(),
                  snapshotCheck.getDataCenterId(), snapshotId, snapshotCheck.getName(), null, null, 0L,
                  snapshotCheck.getClass().getName(), snapshotCheck.getUuid());
View Full Code Here

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

            // Either way delete the snapshots for this volume.
            List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
            for (SnapshotVO snapshot : snapshots) {
                SnapshotVO snap = _snapshotDao.findById(snapshot.getId());
                SnapshotStrategy snapshotStrategy = null;
                for (SnapshotStrategy strategy : snapshotStrategies) {
                    if (strategy.canHandle(snap)) {
                        snapshotStrategy = strategy;
                        break;
                    }
                }
                if (snapshotStrategy.deleteSnapshot(snapshot.getId())) {
                    if (snapshot.getRecurringType() == Type.MANUAL) {
                        _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
                        _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,
                                new Long(snapshot.getSize()));
                    }
View Full Code Here

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

        if (snapshotCheck == null) {
            throw new InvalidParameterValueException("unable to find a snapshot with id " + snapshotId);
        }

        _accountMgr.checkAccess(caller, null, true, snapshotCheck);
        SnapshotStrategy snapshotStrategy = null;
        for (SnapshotStrategy strategy : this.snapshotStrategies) {
          if (strategy.canHandle(snapshotCheck)) {
            snapshotStrategy = strategy;
            break;
          }
        }
        try {
          boolean result = snapshotStrategy.deleteSnapshot(snapshotId);
          if (result) {
            if (snapshotCheck.getState() == Snapshot.State.BackedUp) {
              UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_DELETE, snapshotCheck.getAccountId(),
                  snapshotCheck.getDataCenterId(), snapshotId, snapshotCheck.getName(), null, null, 0L,
                  snapshotCheck.getClass().getName(), snapshotCheck.getUuid());
View Full Code Here

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

            // Either way delete the snapshots for this volume.
            List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
            for (SnapshotVO snapshot : snapshots) {
                SnapshotVO snap = _snapshotDao.findById(snapshot.getId());
                SnapshotStrategy snapshotStrategy = null;
                for (SnapshotStrategy strategy : snapshotStrategies) {
                    if (strategy.canHandle(snap)) {
                        snapshotStrategy = strategy;
                        break;
                    }
                }
                if (snapshotStrategy.deleteSnapshot(snapshot.getId())) {
                    if (snapshot.getRecurringType() == Type.MANUAL) {
                        _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
                        _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,
                                new Long(snapshot.getSize()));
                    }
View Full Code Here

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

        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        boolean result = false;

        SnapshotStrategy snapshotStrategy = storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);
        if (snapshotStrategy != null) {
            snapshot = snapshotStrategy.takeSnapshot(snapshot);
            result = true;
        }

        AssertJUnit.assertTrue(result);
View Full Code Here

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

        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        SnapshotInfo newSnapshot = null;

        SnapshotStrategy snapshotStrategy = storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);
        if (snapshotStrategy != null) {
            newSnapshot = snapshotStrategy.takeSnapshot(snapshot);

        }
        AssertJUnit.assertNotNull(newSnapshot);

        // create another snapshot
View Full Code Here

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

        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        boolean result = false;

        SnapshotStrategy snapshotStrategy = storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);
        if (snapshotStrategy != null) {
            snapshot = snapshotStrategy.takeSnapshot(snapshot);
            result = true;
        }

        AssertJUnit.assertTrue(result);
        LocalHostEndpoint ep = new LocalHostEndpoint();
View Full Code Here

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

        VolumeInfo vol = createCopyBaseImage();
        SnapshotVO snapshotVO = createSnapshotInDb(vol);
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore());
        SnapshotInfo newSnapshot = null;

        SnapshotStrategy snapshotStrategy = storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);
        if (snapshotStrategy != null) {
            newSnapshot = snapshotStrategy.takeSnapshot(snapshot);
        }

        AssertJUnit.assertNotNull(newSnapshot);

        LocalHostEndpoint ep = new MockLocalHostEndPoint();
View Full Code Here

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

        return snapshotFactory.getSnapshot(vo.getId(), store);
    }

    @Override
    public boolean isRevertable() {
        SnapshotStrategy snapshotStrategy = storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.REVERT);
        if (snapshotStrategy != null) {
            return true;
        }

        return false;
View Full Code Here

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

            if (vm.getState() != State.Stopped && vm.getState() != State.Shutdowned) {
                throw new InvalidParameterValueException("The VM the specified disk is attached to is not in the shutdown state.");
            }
        }

        SnapshotStrategy snapshotStrategy = _storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.REVERT);

        if (snapshotStrategy == null) {
            s_logger.error("Unable to find snaphot strategy to handle snapshot with id '" + snapshotId + "'");
            return false;
        }

        return snapshotStrategy.revertSnapshot(snapshotId);
    }
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.