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);
}
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);
}
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;
}
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);
}
Aggregations