Package com.cloud.agent.api.to

Examples of com.cloud.agent.api.to.SwiftTO


        return join(File.pathSeparator, getRootDir(secondaryStorageUrl),
                SNAPSHOT_ROOT_DIR, accountId, volumeId);
    }

    public Answer execute(downloadSnapshotFromSwiftCommand cmd){
        SwiftTO swift = cmd.getSwift();
        String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
        Long accountId = cmd.getAccountId();
        Long volumeId = cmd.getVolumeId();
        String rFilename = cmd.getSnapshotUuid();
        String sParent = cmd.getParent();
View Full Code Here


        String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
        Long accountId = cmd.getAccountId();
        Long volumeId = cmd.getVolumeId();
        String name = cmd.getSnapshotUuid();
        try {
            SwiftTO swift = cmd.getSwift();
            S3TO s3 = cmd.getS3();
            if (swift == null) {
                final String result = deleteSnapshotBackupFromLocalFileSystem(
                        secondaryStorageUrl, accountId, volumeId, name,
                        cmd.isAll());
View Full Code Here

    }

    @Override
    public void deleteSnapshotsForVolume (String secondaryStoragePoolUrl, Long dcId, Long accountId, Long volumeId ){
        SwiftTO swift = _swiftMgr.getSwiftTO();
        S3TO s3 = _s3Mgr.getS3TO();
        VolumeVO volume = _volumeDao.findById(volumeId);
        StoragePoolVO pool = _storagePoolDao.findById(volume.getPoolId());

        checkObjectStorageConfiguration(swift, s3);
View Full Code Here

        Long accountId = volume.getAccountId();
        HostVO secHost = _storageMgr.getSecondaryStorageHost(dcId);
        String secondaryStoragePoolUrl = secHost.getStorageUrl();

        Long swiftId = ss.getSwiftId();
        SwiftTO swift = _swiftMgr.getSwiftTO(swiftId);
        SnapshotVO tss = ss;
        List<String> BackupUuids = new ArrayList<String>(30);
        while (true) {
            BackupUuids.add(0, tss.getBackupSnapshotId());
            if (tss.getPrevSnapshotId() == 0)
View Full Code Here

            SnapshotVO prevSnapshot = null;
            String prevSnapshotUuid = null;
            String prevBackupUuid = null;


            SwiftTO swift = _swiftMgr.getSwiftTO();
            S3TO s3 = _s3Mgr.getS3TO();

            checkObjectStorageConfiguration(swift, s3);
           
            long prevSnapshotId = snapshot.getPrevSnapshotId();
            if (prevSnapshotId > 0) {
                prevSnapshot = _snapshotDao.findByIdIncludingRemoved(prevSnapshotId);
                if ( prevSnapshot.getBackupSnapshotId() != null && swift == null) {
                    if (prevSnapshot.getVersion() != null && prevSnapshot.getVersion().equals("2.2")) {                  
                        prevBackupUuid = prevSnapshot.getBackupSnapshotId();
                        prevSnapshotUuid = prevSnapshot.getPath();
                    }
                } else if ((prevSnapshot.getSwiftId() != null && swift != null)
                        || (prevSnapshot.getS3Id() != null && s3 != null)) {
                    prevBackupUuid = prevSnapshot.getBackupSnapshotId();
                    prevSnapshotUuid = prevSnapshot.getPath();
                }
            }
            boolean isVolumeInactive = _storageMgr.volumeInactive(volume);
            String vmName = _storageMgr.getVmNameOnVolume(volume);
            StoragePoolVO srcPool = _storagePoolDao.findById(volume.getPoolId());
            BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(secondaryStoragePoolUrl, dcId, accountId, volumeId, snapshot.getId(), volume.getPath(), srcPool, snapshotUuid,
                    snapshot.getName(), prevSnapshotUuid, prevBackupUuid, isVolumeInactive, vmName, _backupsnapshotwait);

            if ( swift != null ) {
                backupSnapshotCommand.setSwift(swift);
            } else if (s3 != null) {
                backupSnapshotCommand.setS3(s3);
            }
           
            String backedUpSnapshotUuid = null;
            // By default, assume failed.
            boolean backedUp = false;
            BackupSnapshotAnswer answer = (BackupSnapshotAnswer) sendToPool(volume, backupSnapshotCommand);
            if (answer != null && answer.getResult()) {
                backedUpSnapshotUuid = answer.getBackupSnapshotName();
                if (backedUpSnapshotUuid != null) {
                    backedUp = true;
                }
            } else if (answer != null) {
                s_logger.error(answer.getDetails());
            }
            // Update the status in all cases.
            Transaction txn = Transaction.currentTxn();
            txn.start();

            if (backedUp) {
                if (backupSnapshotCommand.getSwift() != null ) {
                    snapshot.setSwiftId(swift.getId());
                    snapshot.setBackupSnapshotId(backedUpSnapshotUuid);
                } else if (backupSnapshotCommand.getS3() != null) {
                    snapshot.setS3Id(s3.getId());
                    snapshot.setBackupSnapshotId(backedUpSnapshotUuid);
                } else {
View Full Code Here

        String backupOfSnapshot = snapshot.getBackupSnapshotId();
        if (backupOfSnapshot == null) {
            return true;
        }
        SwiftTO swift = _swiftMgr.getSwiftTO(snapshot.getSwiftId());
        S3TO s3 = _s3Mgr.getS3TO();

        checkObjectStorageConfiguration(swift, s3);

        VolumeVO volume = _volumeDao.findById(volumeId);
View Full Code Here

            if (_snapshotDao.listByVolumeIdIncludingRemoved(volumeId).isEmpty()) {
                // This volume doesn't have any snapshots. Nothing do delete.
                continue;
            }
            List<HostVO> ssHosts = _ssvmMgr.listSecondaryStorageHostsInOneZone(dcId);
            SwiftTO swift = _swiftMgr.getSwiftTO();
            S3TO s3 = _s3Mgr.getS3TO();

            checkObjectStorageConfiguration(swift, s3);

            StoragePoolVO pool = _storagePoolDao.findById(volume.getPoolId());
View Full Code Here

        return created;
    }

    @Override
    public SwiftTO toSwiftTO() {
        return new SwiftTO(getId(), getUrl(), getAccount(), getUserName(), getKey());
    }
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.to.SwiftTO

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.