Search in sources :

Example 1 with ServiceErrorException

use of com.emc.vipr.client.exceptions.ServiceErrorException 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 ServiceErrorException

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

the class ApiSystemTestUtil method ingestUnManagedVolume.

public List<String> ingestUnManagedVolume(List<URI> volumes, URI project, URI varray, URI vpool) {
    List<String> nativeGuids = new ArrayList<String>();
    try {
        VolumeIngest input = new VolumeIngest();
        input.setProject(project);
        ;
        input.setVarray(varray);
        ;
        input.setVpool(vpool);
        input.setUnManagedVolumes(volumes);
        ;
        Tasks<UnManagedVolumeRestRep> rep = client.unmanagedVolumes().ingest(input);
        for (UnManagedVolumeRestRep uvol : rep.get()) {
            log.info(String.format("Unmanaged volume %s ", uvol.getNativeGuid()));
            nativeGuids.add(uvol.getNativeGuid());
        }
        return nativeGuids;
    } catch (ServiceErrorException ex) {
        log.error("Exception discovering storage system " + ex.getMessage(), ex);
        throw ex;
    }
}
Also used : VolumeIngest(com.emc.storageos.model.block.VolumeIngest) ArrayList(java.util.ArrayList) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 3 with ServiceErrorException

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

the class ApiSystemTestUtil method deleteVolumes.

public void deleteVolumes(List<URI> volumes, boolean inventoryOnly) {
    try {
        Tasks<VolumeRestRep> tasks = client.blockVolumes().deactivate(volumes, (inventoryOnly ? VolumeDeleteTypeEnum.VIPR_ONLY : VolumeDeleteTypeEnum.FULL));
        for (VolumeRestRep volumeRestRep : tasks.get()) {
            log.info(String.format("Volume %s (%s) deleted", volumeRestRep.getName(), volumeRestRep.getId()));
            volumes.add(volumeRestRep.getId());
        }
    } catch (ServiceErrorException ex) {
        log.error("Exception creating deleting volumes " + ex.getMessage(), ex);
        throw ex;
    }
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 4 with ServiceErrorException

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

the class ApiSystemTestUtil method createConsistencyGroup.

public URI createConsistencyGroup(String cgName, URI project) {
    BlockConsistencyGroupCreate input = new BlockConsistencyGroupCreate();
    input.setName(cgName);
    input.setProject(project);
    try {
        BlockConsistencyGroupRestRep rep = client.blockConsistencyGroups().create(input);
        return rep.getId();
    } catch (ServiceErrorException ex) {
        log.error("Exception creating consistency group: " + cgName, ex);
        throw ex;
    }
}
Also used : BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) BlockConsistencyGroupCreate(com.emc.storageos.model.block.BlockConsistencyGroupCreate) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 5 with ServiceErrorException

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

the class DisasterRecovery method pause.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void pause(@As(",") String[] ids) {
    List<String> uuids = Arrays.asList(ids);
    for (String uuid : uuids) {
        if (!DisasterRecoveryUtils.hasStandbySite(uuid)) {
            flash.error(MessagesUtils.get(UNKNOWN, uuid));
            list(true);
        }
    }
    SiteIdListParam param = new SiteIdListParam();
    param.getIds().addAll(uuids);
    try {
        DisasterRecoveryUtils.pauseStandby(param);
    } catch (ServiceErrorException ex) {
        flash.error(ex.getDetailedMessage());
        list(true);
    } catch (Exception ex) {
        flash.error(ex.getMessage());
        list(true);
    }
    flash.success(MessagesUtils.get(PAUSED_SUCCESS));
    list(true);
}
Also used : SiteIdListParam(com.emc.storageos.model.dr.SiteIdListParam) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

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