Search in sources :

Example 1 with BackupUploadStatus

use of com.emc.vipr.model.sys.backup.BackupUploadStatus in project coprhd-controller by CoprHD.

the class Backup method getUploadStatus.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SYSTEM_MONITOR"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void getUploadStatus(String id) {
    BackupUploadStatus status = BackupUtils.getUploadStatus(id);
    renderJSON(status);
}
Also used : BackupUploadStatus(com.emc.vipr.model.sys.backup.BackupUploadStatus) Restrictions(controllers.deadbolt.Restrictions)

Example 2 with BackupUploadStatus

use of com.emc.vipr.model.sys.backup.BackupUploadStatus in project coprhd-controller by CoprHD.

the class UploadExecutor method getUploadStatus.

public BackupUploadStatus getUploadStatus(String backupTag, File backupDir) throws Exception {
    if (backupTag == null) {
        log.error("Query parameter of backupTag is null");
        throw new IllegalStateException("Invalid query parameter");
    }
    this.cfg.reload();
    log.info("Current uploaded backup list: {}", this.cfg.uploadedBackups);
    if (this.cfg.uploadedBackups.contains(backupTag)) {
        log.info("{} is in the uploaded backup list", backupTag);
        return new BackupUploadStatus(backupTag, Status.DONE, 100, null);
    }
    if (!getIncompleteUploads().contains(backupTag)) {
        File backup = new File(backupDir, backupTag);
        if (backup.exists()) {
            log.info("The {} will be reclaimed");
            return new BackupUploadStatus(backupTag, Status.FAILED, 0, ErrorCode.TO_BE_RECLAIMED);
        }
        return new BackupUploadStatus(backupTag, Status.FAILED, 0, ErrorCode.BACKUP_NOT_EXIST);
    }
    if (cfg.uploadUrl == null) {
        return new BackupUploadStatus(backupTag, Status.FAILED, 0, ErrorCode.FTP_NOT_CONFIGURED);
    }
    BackupUploadStatus uploadStatus = this.cfg.queryBackupUploadStatus();
    if (backupTag.equals(uploadStatus.getBackupName())) {
        return uploadStatus;
    }
    if (isPendingUploadTask(backupTag)) {
        return new BackupUploadStatus(backupTag, Status.PENDING, null, null);
    }
    return new BackupUploadStatus(backupTag, Status.NOT_STARTED, null, null);
}
Also used : BackupUploadStatus(com.emc.vipr.model.sys.backup.BackupUploadStatus) File(java.io.File)

Example 3 with BackupUploadStatus

use of com.emc.vipr.model.sys.backup.BackupUploadStatus in project coprhd-controller by CoprHD.

the class SchedulerConfig method queryBackupUploadStatus.

/**
 * Query upload status from ZK
 */
public BackupUploadStatus queryBackupUploadStatus() {
    CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
    Configuration cfg = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), BackupConstants.BACKUP_UPLOAD_STATUS, Constants.GLOBAL_ID);
    Map<String, String> allItems = (cfg == null) ? new HashMap<String, String>() : cfg.getAllConfigs(false);
    BackupUploadStatus uploadStatus = new BackupUploadStatus(allItems);
    log.info("Upload status is: {}", uploadStatus);
    return uploadStatus;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) BackupUploadStatus(com.emc.vipr.model.sys.backup.BackupUploadStatus) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Example 4 with BackupUploadStatus

use of com.emc.vipr.model.sys.backup.BackupUploadStatus in project coprhd-controller by CoprHD.

the class UploadExecutor method setUploadStatus.

public void setUploadStatus(String backupTag, Status status, Integer progress, ErrorCode errorCode) {
    BackupUploadStatus uploadStatus = this.cfg.queryBackupUploadStatus();
    uploadStatus.update(backupTag, status, progress, errorCode);
    this.cfg.persistBackupUploadStatus(uploadStatus);
}
Also used : BackupUploadStatus(com.emc.vipr.model.sys.backup.BackupUploadStatus)

Aggregations

BackupUploadStatus (com.emc.vipr.model.sys.backup.BackupUploadStatus)4 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 Restrictions (controllers.deadbolt.Restrictions)1 File (java.io.File)1