Search in sources :

Example 6 with ViPRException

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

the class BlockVirtualPools method save.

public static void save(BlockVirtualPoolForm vpool) {
    if (vpool == null) {
        list();
    }
    vpool.deserialize();
    vpool.validate("vpool");
    if (Validation.hasErrors()) {
        error(vpool);
    }
    try {
        BlockVirtualPoolRestRep virtualPool = vpool.save();
        flash.success(MessagesUtils.get(SAVED_SUCCESS, virtualPool.getName()));
        list();
    } catch (ViPRException e) {
        exception(vpool, e);
    }
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) ViPRException(com.emc.vipr.client.exceptions.ViPRException)

Example 7 with ViPRException

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

the class ComputeVirtualPools method saveTenantACLs.

/**
 * Saves tenant ACLs on the virtual compute pool.
 *
 * @param vpoolId
 *            the virtual compute pool ID.
 * @param tenants
 *            the tenant ACLs.
 * @param enableTenants
 *            the checked status for "Grant Access to Tenants".
 */
private static void saveTenantACLs(String vpoolId, List<String> tenants, Boolean enableTenants) {
    Set<String> tenantIds = Sets.newHashSet();
    if (isTrue(enableTenants) && tenants != null) {
        tenantIds.addAll(tenants);
    }
    ACLUpdateBuilder builder = new ACLUpdateBuilder(ComputeVirtualPoolUtils.getComputeACLs(vpoolId));
    builder.setTenants(tenantIds);
    try {
        ComputeVirtualPoolUtils.updateComputeACLs(vpoolId, builder.getACLUpdate());
    } catch (ViPRException e) {
        Logger.error(e, "Failed to update Compute Virtual Pool ACLs");
        String errorDesc = e.getMessage();
        if (e instanceof ServiceErrorException) {
            errorDesc = ((ServiceErrorException) e).getDetailedMessage();
        }
        flash.error(MessagesUtils.get("computeVirtualPool.updateComputeVirtualPoolACLs.failed", errorDesc));
    }
}
Also used : ViPRException(com.emc.vipr.client.exceptions.ViPRException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) ACLUpdateBuilder(util.builders.ACLUpdateBuilder)

Aggregations

ViPRException (com.emc.vipr.client.exceptions.ViPRException)7 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)3 ACLUpdateBuilder (util.builders.ACLUpdateBuilder)2 ACLAssignmentChanges (com.emc.storageos.model.auth.ACLAssignmentChanges)1 ACLEntry (com.emc.storageos.model.auth.ACLEntry)1 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)1 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)1 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)1 ListProcessor (com.emc.vipr.client.impl.jaxb.ListProcessor)1 LogMessage (com.emc.vipr.model.sys.logging.LogMessage)1 FlashException (controllers.util.FlashException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Util (play.mvc.Util)1