Package com.cloud.storage

Examples of com.cloud.storage.CreateSnapshotPayload


    return true;
  }
    @Override
    @DB
    public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationException {
        CreateSnapshotPayload payload = (CreateSnapshotPayload)volume.getpayload();
        Long snapshotId = payload.getSnapshotId();
        Account snapshotOwner = payload.getAccount();
        SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotId, volume.getDataStore());
        boolean processed = false;

        try {
            for (SnapshotStrategy strategy : snapshotStrategies) {
                if (strategy.canHandle(snapshot)) {
                    processed = true;
                    snapshot = strategy.takeSnapshot(snapshot);
                    break;
                }
            }
            if (!processed) {
                throw new CloudRuntimeException("Can't find snapshot strategy to deal with snapshot:" + snapshotId);
            }

            try {
                postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());

                UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(),
                        snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null,
                        volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid());
                _resourceLimitMgr.incrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
View Full Code Here


                    try {
                        SnapshotVO snapshotVO = createSnapshotInDb(vol.getId());
                        VolumeObject volumeObject = (VolumeObject)vol;
                        Account account = mock(Account.class);
                        when(account.getId()).thenReturn(1L);
                        CreateSnapshotPayload createSnapshotPayload = mock(CreateSnapshotPayload.class);
                        when(createSnapshotPayload.getAccount()).thenReturn(account);
                        when(createSnapshotPayload.getSnapshotId()).thenReturn(snapshotVO.getId());
                        when(createSnapshotPayload.getSnapshotPolicyId()).thenReturn(0L);
                        volumeObject.addPayload(createSnapshotPayload);
                        if (cnt > 8) {
                            mockStorageMotionStrategy.makeBackupSnapshotSucceed(false);
                        }
                        SnapshotInfo newSnapshot = volumeService.takeSnapshot(vol);
View Full Code Here

        CreateCmdResult result = null;
        try {
            SnapshotObjectTO snapshotTO = (SnapshotObjectTO) snapshot.getTO();
            Object payload = snapshot.getPayload();
            if (payload != null && payload instanceof CreateSnapshotPayload) {
                CreateSnapshotPayload snapshotPayload = (CreateSnapshotPayload) payload;
                snapshotTO.setQuiescevm(snapshotPayload.getQuiescevm());
            }

            CreateObjectCommand cmd = new CreateObjectCommand(snapshotTO);
            EndPoint ep = this.epSelector.select(snapshot, StorageAction.TAKESNAPSHOT);
            Answer answer = null;
View Full Code Here

    @Override
    @DB
    public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
        Object payload = snapshot.getPayload();
        if (payload != null) {
            CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload;
            if (createSnapshotPayload.getQuiescevm()) {
                throw new InvalidParameterValueException("can't handle quiescevm equal true for volume snapshot");
            }
        }

        SnapshotVO snapshotVO = snapshotDao.acquireInLockTable(snapshot.getId());
View Full Code Here

                    try {
                        SnapshotVO snapshotVO = createSnapshotInDb(vol.getId());
                        VolumeObject volumeObject = (VolumeObject)vol;
                        Account account = mock(Account.class);
                        when(account.getId()).thenReturn(1L);
                        CreateSnapshotPayload createSnapshotPayload = mock(CreateSnapshotPayload.class);
                        when(createSnapshotPayload.getAccount()).thenReturn(account);
                        when(createSnapshotPayload.getSnapshotId()).thenReturn(snapshotVO.getId());
                        when(createSnapshotPayload.getSnapshotPolicyId()).thenReturn(0L);
                        volumeObject.addPayload(createSnapshotPayload);
                        if (cnt > 8) {
                            mockStorageMotionStrategy.makeBackupSnapshotSucceed(false);
                        }
                        SnapshotInfo newSnapshot = volumeService.takeSnapshot(vol);
View Full Code Here

    }

    @Override
    @DB
    public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationException {
        CreateSnapshotPayload payload = (CreateSnapshotPayload)volume.getpayload();
        Long snapshotId = payload.getSnapshotId();
        Account snapshotOwner = payload.getAccount();
        SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, volume.getDataStore());
        snapshot.addPayload(payload);
        try {
            SnapshotStrategy snapshotStrategy = _storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);

            if (snapshotStrategy == null) {
                throw new CloudRuntimeException("Can't find snapshot strategy to deal with snapshot:" + snapshotId);
            }

            snapshotStrategy.takeSnapshot(snapshot);

            try {
            postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());

                UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(),
                    null, null, volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid());
                SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Image);
                // Correct the resource count of snapshot in case of delta snapshots.
View Full Code Here

    @Override
    @DB
    public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
        Object payload = snapshot.getPayload();
        if (payload != null) {
            CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload;
            if (createSnapshotPayload.getQuiescevm()) {
                throw new InvalidParameterValueException("can't handle quiescevm equal true for volume snapshot");
            }
        }

        SnapshotVO snapshotVO = snapshotDao.acquireInLockTable(snapshot.getId());
View Full Code Here

        return true;
    }
    @Override
    @DB
    public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationException {
        CreateSnapshotPayload payload = (CreateSnapshotPayload)volume.getpayload();
        Long snapshotId = payload.getSnapshotId();
        Account snapshotOwner = payload.getAccount();
        SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, volume.getDataStore());
        snapshot.addPayload(payload);
        try {
            SnapshotStrategy snapshotStrategy = _storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.TAKE);

            if (snapshotStrategy == null) {
                throw new CloudRuntimeException("Can't find snapshot strategy to deal with snapshot:" + snapshotId);
            }

            snapshotStrategy.takeSnapshot(snapshot);

            try {
                postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());

                UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(),
                        snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null,
                        volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid());
                SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Image);
View Full Code Here

                    try {
                        SnapshotVO snapshotVO = createSnapshotInDb(vol.getId());
                        VolumeObject volumeObject = (VolumeObject)vol;
                        Account account = mock(Account.class);
                        when(account.getId()).thenReturn(1L);
                        CreateSnapshotPayload createSnapshotPayload = mock(CreateSnapshotPayload.class);
                        when(createSnapshotPayload.getAccount()).thenReturn(account);
                        when(createSnapshotPayload.getSnapshotId()).thenReturn(snapshotVO.getId());
                        when(createSnapshotPayload.getSnapshotPolicyId()).thenReturn(0L);
                        volumeObject.addPayload(createSnapshotPayload);
                        if (cnt > 8) {
                            mockStorageMotionStrategy.makeBackupSnapshotSucceed(false);
                        }
                        SnapshotInfo newSnapshot = volumeService.takeSnapshot(vol);
View Full Code Here

TOP

Related Classes of com.cloud.storage.CreateSnapshotPayload

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.