Search in sources :

Example 1 with BackupRestoreStatus

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));
}
Also used : BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus) BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus)

Example 2 with BackupRestoreStatus

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);
}
Also used : BackupDataTable(models.datatable.BackupDataTable) BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus) BackupSet(com.emc.vipr.model.sys.backup.BackupSets.BackupSet) Restrictions(controllers.deadbolt.Restrictions)

Example 3 with BackupRestoreStatus

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();
}
Also used : BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus) BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus)

Example 4 with BackupRestoreStatus

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);
}
Also used : BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus)

Example 5 with BackupRestoreStatus

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");
    }
}
Also used : BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) IOException(java.io.IOException) BackupException(com.emc.storageos.management.backup.exceptions.BackupException)

Aggregations

BackupRestoreStatus (com.emc.vipr.model.sys.backup.BackupRestoreStatus)14 BackupException (com.emc.storageos.management.backup.exceptions.BackupException)5 IOException (java.io.IOException)5 RetryableBackupException (com.emc.storageos.management.backup.exceptions.RetryableBackupException)3 MalformedURLException (java.net.MalformedURLException)3 URISyntaxException (java.net.URISyntaxException)3 UnknownHostException (java.net.UnknownHostException)3 CancellationException (java.util.concurrent.CancellationException)3 ExecutionException (java.util.concurrent.ExecutionException)3 MalformedObjectNameException (javax.management.MalformedObjectNameException)3 KeeperException (org.apache.zookeeper.KeeperException)3 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 BackupInfo (com.emc.vipr.model.sys.backup.BackupInfo)2 Restrictions (controllers.deadbolt.Restrictions)2 File (java.io.File)2 BackupDataTable (models.datatable.BackupDataTable)2 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)1 BackupSet (com.emc.vipr.model.sys.backup.BackupSets.BackupSet)1