Search in sources :

Example 86 with VirtualPool

use of com.emc.storageos.db.client.model.VirtualPool in project coprhd-controller by CoprHD.

the class VirtualPoolService method recordOperation.

public void recordOperation(OperationTypeEnum opType, String evDesc, Object... extParam) {
    String evType;
    evType = opType.getEvType(true);
    _log.info("opType: {} detail: {}", opType.toString(), evType + ':' + evDesc);
    VirtualPool vpool = (VirtualPool) extParam[0];
    recordVirtualPoolEvent(evType, evDesc, vpool.getId());
    StringBuilder protocols = new StringBuilder();
    if (vpool.getProtocols() != null) {
        for (String proto : vpool.getProtocols()) {
            protocols.append(" ");
            protocols.append(proto);
        }
    }
    StringBuilder neighborhoods = new StringBuilder();
    if (vpool.getVirtualArrays() != null) {
        for (String neighborhood : vpool.getVirtualArrays()) {
            neighborhoods.append(" ");
            neighborhoods.append(neighborhood);
        }
    }
    switch(opType) {
        case CREATE_VPOOL:
            auditOp(opType, true, null, vpool.getId().toString(), vpool.getLabel(), vpool.getType(), protocols.toString(), neighborhoods.toString(), vpool.getSupportedProvisioningType(), vpool.getAutoTierPolicyName(), vpool.getDriveType(), vpool.getHighAvailability());
            break;
        case UPDATE_VPOOL:
            auditOp(opType, true, null, vpool.getId().toString(), vpool.getLabel(), vpool.getType(), protocols.toString(), neighborhoods.toString(), vpool.getSupportedProvisioningType(), vpool.getAutoTierPolicyName(), vpool.getDriveType());
            break;
        case DELETE_VPOOL:
            auditOp(opType, true, null, vpool.getId().toString(), vpool.getLabel(), vpool.getType());
            break;
        default:
            _log.error("unrecognized vpool operation type");
    }
}
Also used : VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 87 with VirtualPool

use of com.emc.storageos.db.client.model.VirtualPool in project coprhd-controller by CoprHD.

the class VirtualPoolService method updateVirtualPoolWithAssignedStoragePools.

/**
 * This method allows user to assign matching pools to VirtualPool.
 *
 * @param id : the URN of a ViPR VirtualPool.
 * @param param : Pool Update param
 * @return : update VirtualPool.
 */
protected VirtualPool updateVirtualPoolWithAssignedStoragePools(URI id, VirtualPoolPoolUpdateParam param) {
    ArgValidator.checkUri(id);
    VirtualPool vpool = queryResource(id);
    ArgValidator.checkEntity(vpool, id, isIdEmbeddedInURL(id));
    if (param.getStoragePoolAssignmentChanges() != null) {
        // Validate whether all the pools with virtual pool resources are part of the assigned pools
        checkPoolsWithResources(param.getStoragePoolAssignmentChanges(), vpool, _dbClient);
        StoragePoolAssignments addedAssignedPools = param.getStoragePoolAssignmentChanges().getAdd();
        if ((addedAssignedPools != null) && (!addedAssignedPools.getStoragePools().isEmpty())) {
            validateAssignedPoolInMatchedPools(addedAssignedPools.getStoragePools(), vpool);
            vpool.updateAssignedStoragePools(addedAssignedPools.getStoragePools());
        }
        // Validate that the storage pools to be unassigned from the storage
        // pool reference existing storage pools in the database and remove
        // them from the storage pool.
        StoragePoolAssignments removedPool = param.getStoragePoolAssignmentChanges().getRemove();
        if ((removedPool != null) && (!removedPool.getStoragePools().isEmpty())) {
            checkUnassignedPoolURIs(removedPool.getStoragePools(), vpool, _dbClient);
            _log.debug("Removing pools {} from the virtual pool {}", removedPool.getStoragePools(), id);
            vpool.removeAssignedStoragePools(removedPool.getStoragePools());
        }
        // adding supported vpools to unmanaged volumes/file systems
        if (vpool.getType().equals(VirtualPool.Type.file.name())) {
            ImplicitUnManagedObjectsMatcher.matchVirtualPoolsWithUnManagedFileSystems(vpool, _dbClient);
        } else if (vpool.getType().equals(VirtualPool.Type.block.name())) {
            Set<URI> allSrdfTargetVPools = SRDFUtils.fetchSRDFTargetVirtualPools(_dbClient);
            Set<URI> allRpTargetVpools = RPHelper.fetchRPTargetVirtualPools(_dbClient);
            ImplicitUnManagedObjectsMatcher.matchVirtualPoolsWithUnManagedVolumes(vpool, allSrdfTargetVPools, allRpTargetVpools, _dbClient, false);
        }
        _dbClient.updateAndReindexObject(vpool);
    }
    return vpool;
}
Also used : StoragePoolAssignments(com.emc.storageos.model.vpool.StoragePoolAssignments) EnumSet(java.util.EnumSet) Set(java.util.Set) HashSet(java.util.HashSet) StringSet(com.emc.storageos.db.client.model.StringSet) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 88 with VirtualPool

use of com.emc.storageos.db.client.model.VirtualPool in project coprhd-controller by CoprHD.

the class VirtualPoolService method getAclsOnVirtualPool.

protected ACLAssignments getAclsOnVirtualPool(VirtualPool.Type type, URI id) {
    VirtualPool vpool = queryResource(id);
    ArgValidator.checkEntityNotNull(vpool, id, isIdEmbeddedInURL(id));
    if (!vpool.getType().equals(type.name())) {
        throw APIException.badRequests.providedVirtualPoolNotCorrectType();
    }
    ACLAssignments response = new ACLAssignments();
    response.setAssignments(_permissionsHelper.convertToACLEntries(vpool.getAcls()));
    return response;
}
Also used : ACLAssignments(com.emc.storageos.model.auth.ACLAssignments) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 89 with VirtualPool

use of com.emc.storageos.db.client.model.VirtualPool in project coprhd-controller by CoprHD.

the class VirtualPoolService method refreshMatchedPools.

/**
 * Refresh the matching pools by running implicit pool matcher algorithm and
 * find if there are any new matched pools exists in the environment.
 * Returns the new matched pools to user.
 *
 * @param id the URN of a ViPR VirtualPool.
 * @return : list of pools.
 */
protected StoragePoolList refreshMatchedPools(VirtualPool.Type type, URI id) {
    ArgValidator.checkUri(id);
    StoragePoolList poolList = new StoragePoolList();
    VirtualPool vpool = queryResource(id);
    ArgValidator.checkEntityNotNull(vpool, id, isIdEmbeddedInURL(id));
    if (!vpool.getType().equals(type.name())) {
        throw APIException.badRequests.providedVirtualPoolNotCorrectType();
    }
    StringBuffer errorMessage = new StringBuffer();
    ImplicitPoolMatcher.matchVirtualPoolWithAllStoragePools(vpool, _dbClient, _coordinator, errorMessage);
    _dbClient.updateAndReindexObject(vpool);
    StringSet matchedPools = vpool.getMatchedStoragePools();
    if (null != matchedPools && !matchedPools.isEmpty()) {
        Iterator<String> vpoolItr = matchedPools.iterator();
        while (vpoolItr.hasNext()) {
            URI poolURI = URI.create(vpoolItr.next());
            StoragePool pool = _dbClient.queryObject(StoragePool.class, poolURI);
            if (pool == null) {
                continue;
            }
            poolList.getPools().add(toNamedRelatedResource(pool));
        }
    }
    return poolList;
}
Also used : StoragePoolList(com.emc.storageos.model.pools.StoragePoolList) StoragePool(com.emc.storageos.db.client.model.StoragePool) StringSet(com.emc.storageos.db.client.model.StringSet) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 90 with VirtualPool

use of com.emc.storageos.db.client.model.VirtualPool in project coprhd-controller by CoprHD.

the class VirtualPoolService method queryResource.

@Override
protected VirtualPool queryResource(URI id) {
    VirtualPool vpool = _permissionsHelper.getObjectById(id, VirtualPool.class);
    ArgValidator.checkEntityNotNull(vpool, id, isIdEmbeddedInURL(id));
    return vpool;
}
Also used : VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Aggregations

VirtualPool (com.emc.storageos.db.client.model.VirtualPool)339 URI (java.net.URI)189 ArrayList (java.util.ArrayList)122 Volume (com.emc.storageos.db.client.model.Volume)103 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)92 NamedURI (com.emc.storageos.db.client.model.NamedURI)88 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)88 StringSet (com.emc.storageos.db.client.model.StringSet)76 Project (com.emc.storageos.db.client.model.Project)65 StoragePool (com.emc.storageos.db.client.model.StoragePool)57 StringMap (com.emc.storageos.db.client.model.StringMap)53 HashMap (java.util.HashMap)52 Produces (javax.ws.rs.Produces)50 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)45 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)44 List (java.util.List)44 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)42 Path (javax.ws.rs.Path)42 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)37 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)37