Search in sources :

Example 1 with VolumeGroupFullCopyRestoreParam

use of com.emc.storageos.model.application.VolumeGroupFullCopyRestoreParam in project coprhd-controller by CoprHD.

the class RestoreApplicationFullCopy method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    List<URI> volumeIds = new ArrayList<URI>();
    List<VolumeRestRep> allCopyVols = getClient().blockVolumes().getByRefs(getClient().application().getFullCopiesByApplication(applicationId).getVolumes());
    List<VolumeRestRep> volsForCopy = filterByCopyName(allCopyVols);
    if (volsForCopy != null && !volsForCopy.isEmpty()) {
        for (String subGroup : applicationSubGroup) {
            URI volInSubGroup = findVolumeInSubGroup(volsForCopy, subGroup);
            if (volInSubGroup != null) {
                volumeIds.add(volInSubGroup);
            }
        }
    }
    if (volumeIds.isEmpty()) {
        ExecutionUtils.fail("failTask.RestoreApplicationFullCopyService.volumeId.precheck", new Object[] {});
    }
    VolumeGroupFullCopyRestoreParam input = new VolumeGroupFullCopyRestoreParam(true, volumeIds);
    TaskList taskList = getClient().application().restoreApplicationFullCopy(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) VolumeGroupFullCopyRestoreParam(com.emc.storageos.model.application.VolumeGroupFullCopyRestoreParam)

Aggregations

WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)1 TaskList (com.emc.storageos.model.TaskList)1 VolumeGroupFullCopyRestoreParam (com.emc.storageos.model.application.VolumeGroupFullCopyRestoreParam)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 Tasks (com.emc.vipr.client.Tasks)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1