Search in sources :

Example 26 with ServiceErrorException

use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.

the class ChangeBlockVolumeVirtualPoolNoWait method executeTask.

@Override
public Tasks<VolumeRestRep> executeTask() throws Exception {
    Tasks<VolumeRestRep> result = new Tasks<VolumeRestRep>(getClient().auth().getClient(), null, VolumeRestRep.class);
    // One request per virtual pool
    for (URI vpool : volumeIds.keySet()) {
        if (!vpool.equals(targetVirtualPoolId)) {
            VolumeVirtualPoolChangeParam input = new VolumeVirtualPoolChangeParam();
            input.setVolumes(Lists.newArrayList(volumeIds.get(vpool)));
            input.setVirtualPool(targetVirtualPoolId);
            try {
                Tasks<VolumeRestRep> tasks = getClient().blockVolumes().changeVirtualPool(input);
                for (Task<VolumeRestRep> task : tasks.getTasks()) {
                    addOrderIdTag(task.getTaskResource().getId());
                }
                result.getTasks().addAll(tasks.getTasks());
            } catch (ServiceErrorException ex) {
                logError(ex.getMessage());
            }
        }
    }
    return result;
}
Also used : Tasks(com.emc.vipr.client.Tasks) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) VolumeVirtualPoolChangeParam(com.emc.storageos.model.block.VolumeVirtualPoolChangeParam) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) URI(java.net.URI)

Aggregations

ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)26 Test (org.junit.Test)7 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 ArrayList (java.util.ArrayList)5 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)4 URI (java.net.URI)4 ViPRException (com.emc.vipr.client.exceptions.ViPRException)3 VolumeCreate (com.emc.storageos.model.block.VolumeCreate)2 ServiceErrorRestRep (com.emc.storageos.model.errorhandling.ServiceErrorRestRep)2 TenantUpdateParam (com.emc.storageos.model.tenant.TenantUpdateParam)2 UserMappingChanges (com.emc.storageos.model.tenant.UserMappingChanges)2 UserMappingParam (com.emc.storageos.model.tenant.UserMappingParam)2 ViPRClientHelper (com.emc.storageos.usermanagement.util.ViPRClientHelper)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)2 FlashException (controllers.util.FlashException)2 ACLUpdateBuilder (util.builders.ACLUpdateBuilder)2 ExecutionException (com.emc.sa.engine.ExecutionException)1 CreateBlockVolumeHelper (com.emc.sa.service.vipr.block.CreateBlockVolumeHelper)1 DeactivateBlockExport (com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport)1