Search in sources :

Example 1 with CopiesParam

use of com.emc.storageos.model.block.CopiesParam in project coprhd-controller by CoprHD.

the class ApiSystemTestUtil method attachContinuousCopy.

public List<URI> attachContinuousCopy(URI volumeURI, String copyName) {
    try {
        List<URI> mirrors = new ArrayList<URI>();
        Copy copy = new Copy("native", Copy.SyncDirection.SOURCE_TO_TARGET.name(), null, copyName, 1);
        CopiesParam input = new CopiesParam();
        List<Copy> copies = input.getCopies();
        copies.add(copy);
        input.setCopies((copies));
        ;
        Tasks<VolumeRestRep> tasks = client.blockVolumes().startContinuousCopies(volumeURI, input);
        for (VolumeRestRep volumeRestRep : tasks.get()) {
            log.info(String.format("Mirror %s (%s)", volumeRestRep.getName(), volumeRestRep.getNativeId()));
            mirrors.add(volumeRestRep.getId());
        }
        return mirrors;
    } catch (ServiceErrorException ex) {
        log.info(String.format("Could not attach mirror %s to volume %s", copyName, volumeURI));
        throw ex;
    }
}
Also used : Copy(com.emc.storageos.model.block.Copy) ArrayList(java.util.ArrayList) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) URI(java.net.URI)

Example 2 with CopiesParam

use of com.emc.storageos.model.block.CopiesParam in project coprhd-controller by CoprHD.

the class BlockVolumes method deleteContinuousCopy.

@FlashException(referrer = { "volume" })
public static void deleteContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().deactivateContinuousCopies(uri(volumeId), input, VolumeDeleteTypeEnum.FULL);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.deactivate"));
    }
    volume(volumeId, continuousCopyId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Example 3 with CopiesParam

use of com.emc.storageos.model.block.CopiesParam in project coprhd-controller by CoprHD.

the class BlockVolumes method pauseContinuousCopy.

@FlashException(referrer = { "volume" })
public static void pauseContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().pauseContinuousCopies(uri(volumeId), input);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.pause"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Example 4 with CopiesParam

use of com.emc.storageos.model.block.CopiesParam in project coprhd-controller by CoprHD.

the class BlockVolumes method resumeContinuousCopy.

@FlashException(referrer = { "volume" })
public static void resumeContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().resumeContinuousCopies(uri(volumeId), input);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.resume"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Example 5 with CopiesParam

use of com.emc.storageos.model.block.CopiesParam in project coprhd-controller by CoprHD.

the class DeactivateContinuousCopy method doExecute.

@Override
protected Tasks<VolumeRestRep> doExecute() throws Exception {
    Copy copy = new Copy();
    copy.setType(type);
    copy.setCopyID(continuousCopyId);
    CopiesParam param = new CopiesParam();
    param.getCopies().add(copy);
    return getClient().blockVolumes().deactivateContinuousCopies(volumeId, param, deleteType);
}
Also used : Copy(com.emc.storageos.model.block.Copy) CopiesParam(com.emc.storageos.model.block.CopiesParam)

Aggregations

CopiesParam (com.emc.storageos.model.block.CopiesParam)16 Copy (com.emc.storageos.model.block.Copy)12 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 FlashException (controllers.util.FlashException)4 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)1 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 Util (play.mvc.Util)1 BourneUtil (util.BourneUtil)1