Examples of SnapshotInfo


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

    }

    @Override
    public EndPoint select(DataObject object, StorageAction action) {
        if (action == StorageAction.TAKESNAPSHOT) {
            SnapshotInfo snapshotInfo = (SnapshotInfo)object;
            if (snapshotInfo.getHypervisorType() == Hypervisor.HypervisorType.KVM) {
                VolumeInfo volumeInfo = snapshotInfo.getBaseVolume();
                VirtualMachine vm = volumeInfo.getAttachedVM();
                if ((vm != null) && (vm.getState() == VirtualMachine.State.Running)) {
                    Long hostId = vm.getHostId();
                    return getEndPointFromHostId(hostId);
                }
View Full Code Here

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

    protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> callback,
            CreateVolumeFromBaseImageContext<VolumeApiResult> context) {
        CopyCommandResult result = callback.getResult();
        VolumeInfo volume = (VolumeInfo)context.templateOnStore;
        SnapshotInfo snapshot = context.snapshot;
        VolumeApiResult apiResult = new VolumeApiResult(volume);
        Event event = null;
        if (result.isFailed()) {
            apiResult.setResult(result.getResult());
            event = Event.OperationFailed;
        } else {
            event = Event.OperationSuccessed;
        }

        try {
            if (result.isSuccess()) {
                volume.processEvent(event, result.getAnswer());
            } else {
                volume.processEvent(event);
            }
            snapshot.processEvent(event);
        } catch (Exception e) {
            s_logger.debug("create volume from snapshot failed", e);
            apiResult.setResult(e.toString());
        }
View Full Code Here

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

        return null;
    }

    @Override
    public SnapshotInfo takeSnapshot(VolumeInfo volume) {
        SnapshotInfo snapshot = null;
        try {
            snapshot = snapshotMgr.takeSnapshot(volume);
        } catch (Exception e) {
            s_logger.debug("Take snapshot: " + volume.getId() + " failed", e);
        }
View Full Code Here

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

            CopyCommandResult result = new CopyCommandResult(null, null);
            result.setResult("Failed");
            callback.complete(result);
        }
        if (destData.getType() == DataObjectType.SNAPSHOT) {
            SnapshotInfo srcSnapshot = (SnapshotInfo)srcData;

            SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
            newSnapshot.setPath(UUID.randomUUID().toString());
            if (srcSnapshot.getParent() != null) {
                newSnapshot.setParentSnapshotPath(srcSnapshot.getParent().getPath());
            }
            data = newSnapshot;
        } else if (destData.getType() == DataObjectType.TEMPLATE) {
            TemplateObjectTO newTemplate = new TemplateObjectTO();
            newTemplate.setPath(UUID.randomUUID().toString());
View Full Code Here

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

            throw new StorageUnavailableException(msg, -1);
        }

        VolumeInfo vol = volFactory.getVolume(volume.getId());
        DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
        SnapshotInfo snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Image);
        // sync snapshot to region store if necessary
        DataStore snapStore = snapInfo.getDataStore();
        long snapVolId = snapInfo.getVolumeId();
        try {
            _snapshotSrv.syncVolumeSnapshotsToRegionStore(snapVolId, snapStore);
        } catch (Exception ex) {
            // log but ignore the sync error to avoid any potential S3 down issue, it should be sync next time
            s_logger.warn(ex.getMessage(), ex);
View Full Code Here

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

    @Inject
    SnapshotDataFactory snapshotDataFactory;

    @Override
    public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
        SnapshotInfo parentSnapshot = snapshot.getParent();

        if (parentSnapshot != null && snapshot.getPath().equalsIgnoreCase(parentSnapshot.getPath())) {
            s_logger.debug("backup an empty snapshot");
            // don't need to backup this snapshot
            SnapshotDataStoreVO parentSnapshotOnBackupStore = snapshotStoreDao.findBySnapshot(parentSnapshot.getId(), DataStoreRole.Image);
            if (parentSnapshotOnBackupStore != null && parentSnapshotOnBackupStore.getState() == State.Ready) {
                DataStore store = dataStoreMgr.getDataStore(parentSnapshotOnBackupStore.getDataStoreId(), parentSnapshotOnBackupStore.getRole());

                SnapshotInfo snapshotOnImageStore = (SnapshotInfo)store.create(snapshot);
                snapshotOnImageStore.processEvent(Event.CreateOnlyRequested);

                SnapshotObjectTO snapTO = new SnapshotObjectTO();
                snapTO.setPath(parentSnapshotOnBackupStore.getInstallPath());

                CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);

                snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
                SnapshotObject snapObj = (SnapshotObject)snapshot;
                try {
                    snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
                } catch (NoTransitionException e) {
                    s_logger.debug("Failed to change state: " + snapshot.getId() + ": " + e.toString());
View Full Code Here

Examples of org.drools.guvnor.client.rpc.SnapshotInfo

                Object uo = event.getSelectedItem().getUserObject();
                if ( uo instanceof Object[] ) {
                    Object o = ((Object[]) uo)[0];
                    showAssetList( new String[]{(String) o} );
                } else if ( uo instanceof SnapshotInfo ) {
                    SnapshotInfo s = (SnapshotInfo) uo;
                    clientFactory.getPlaceController().goTo( new ModuleEditorPlace( s.getUuid() ) );
                }
            }
        } );

        return packagesTreeItemPanel;
View Full Code Here

Examples of org.drools.guvnor.client.rpc.SnapshotInfo

                        snapshotName));
    }

    private SnapshotInfo moduleItemToSnapshotItem(String snapshotName,
            ModuleItem packageItem) {
        SnapshotInfo snapshotInfo = new SnapshotInfo();
        snapshotInfo.setComment(packageItem.getCheckinComment());
        snapshotInfo.setName(snapshotName);
        snapshotInfo.setUuid(packageItem.getUUID());
        return snapshotInfo;
    }
View Full Code Here

Examples of org.drools.guvnor.client.rpc.SnapshotInfo

                        snapshotName));
    }

    private SnapshotInfo moduleItemToSnapshotItem(String snapshotName,
                                                  ModuleItem packageItem) {
        SnapshotInfo snapshotInfo = new SnapshotInfo();
        snapshotInfo.setComment(packageItem.getCheckinComment());
        snapshotInfo.setName(snapshotName);
        snapshotInfo.setUuid(packageItem.getUUID());
        return snapshotInfo;
    }
View Full Code Here

Examples of org.drools.guvnor.client.rpc.SnapshotInfo

                        packageName,
                        snapshotName ) );
    }

    private SnapshotInfo packageItemToSnapshotItem(String snapshotName, PackageItem packageItem) {
        SnapshotInfo snapshotInfo = new SnapshotInfo();
        snapshotInfo.setComment( packageItem.getCheckinComment() );
        snapshotInfo.setName( snapshotName );
        snapshotInfo.setUuid( packageItem.getUUID() );
        return snapshotInfo;
    }
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.