use of com.emc.vipr.model.sys.backup.BackupRestoreStatus in project coprhd-controller by CoprHD.
the class Backup method getRestoreStatus.
public static void getRestoreStatus(String id, Type type) {
BackupRestoreStatus status = BackupUtils.getRestoreStatus(id, type == Type.LOCAL);
renderJSON(new RestoreStatus(status));
}
use of com.emc.vipr.model.sys.backup.BackupRestoreStatus in project coprhd-controller by CoprHD.
the class Backup method itemsJson.
/**
* Get local backup info
* @param ids
*/
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SYSTEM_MONITOR"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void itemsJson(@As(",") String[] ids) {
List<BackupDataTable.Backup> results = Lists.newArrayList();
if (ids != null) {
for (String id : ids) {
if (StringUtils.isNotBlank(id)) {
BackupSet backupSet = BackupUtils.getBackup(id);
if (backupSet != null) {
BackupDataTable.Backup backup = new BackupDataTable.Backup(backupSet);
BackupRestoreStatus restoreStatus = BackupUtils.getRestoreStatus(id, true);
backup.alterLocalBackupRestoreStatus(restoreStatus);
results.add(backup);
}
}
}
}
renderJSON(results);
}
use of com.emc.vipr.model.sys.backup.BackupRestoreStatus in project coprhd-controller by CoprHD.
the class Backup method restore.
public static void restore(String id, Type type) {
if (type == Type.REMOTE) {
// pull first if remote backup set
BackupUtils.pullBackup(id);
}
BackupRestoreStatus status = BackupUtils.getRestoreStatus(id, type == Type.LOCAL);
renderArgs.put("status", status);
renderArgs.put("percentages", new RestoreStatus(status).percentageMap);
renderArgs.put("id", id);
renderArgs.put("type", type);
render();
}
use of com.emc.vipr.model.sys.backup.BackupRestoreStatus in project coprhd-controller by CoprHD.
the class DownloadExecutor method pullFromInternalNode.
private void pullFromInternalNode() throws Exception {
log.info("Pull from internal node");
BackupRestoreStatus s = backupOps.queryBackupRestoreStatus(remoteBackupFileName, false);
List<String> backupFilenames = s.getBackupFileNames();
for (String filename : backupFilenames) {
if (isMyBackupFile(filename)) {
pullFileFromNode(endpoint, filename);
}
}
backupOps.setRestoreStatus(remoteBackupFileName, false, null, null, true, true);
}
use of com.emc.vipr.model.sys.backup.BackupRestoreStatus in project coprhd-controller by CoprHD.
the class DownloadExecutor method run.
@Override
public void run() {
try {
BackupRestoreStatus s = backupOps.queryBackupRestoreStatus(remoteBackupFileName, false);
if (s.isNotSuccess() || s.getStatus() == Status.DOWNLOAD_CANCELLED) {
log.info("Download {} has been failed or canceled, no need to start it on this node", remoteBackupFileName);
return;
}
registerListener();
backupOps.registerDownloader();
if (!fromRemoteServer) {
pullFromInternalNode();
return;
}
pullBackupFilesFromRemoteServer();
postDownload();
backupOps.setRestoreStatus(remoteBackupFileName, false, null, null, true, true);
} catch (InterruptedException e) {
log.info("The downloading thread has been interrupted");
} catch (Exception e) {
log.info("isCanceled={}", isCanceled);
if (!isCanceled) {
if (fromRemoteServer) {
log.error("Failed to pull backup file from remote server e=", e);
} else {
log.error("Failed to pull backup file from other node e=", e);
}
backupOps.setRestoreStatus(remoteBackupFileName, false, Status.DOWNLOAD_FAILED, e.getMessage(), false, true);
}
} finally {
try {
backupOps.unregisterDownloader();
} catch (Exception ex) {
if (!isCanceled) {
log.error("Failed to remove listener e=", ex);
}
}
log.info("Download finished");
}
}
Aggregations