Search in sources :

Example 56 with Recommendation

use of com.emc.storageos.volumecontroller.Recommendation in project coprhd-controller by CoprHD.

the class RecoverPointScheduler method createMetroPointRecommendations.

/**
 * Creates recommendations for MetroPoint. This consists of single recommendations that include
 * the both the primary and secondary HA clusters and their associated RP protection details.
 *
 * @param srcVarray the source virtual array.
 * @param tgtVarrays the target protection virtual arrays.
 * @param srcVpool the source virtual pool.
 * @param haVarray the HA (second cluster) virtual array.
 * @param haVpool the HA (second cluster) virtual array.
 * @param project the project.
 * @param capabilities the capability params.
 * @param candidatePrimaryPools candidate source pools to use for the primary cluster.
 * @param candidateSecondaryPools candidate source pools to use for the primary cluster.
 * @return list of Recommendation objects to satisfy the request
 */
private List<Recommendation> createMetroPointRecommendations(VirtualArray srcVarray, List<VirtualArray> tgtVarrays, VirtualPool srcVpool, VirtualArray haVarray, VirtualPool haVpool, Project project, VirtualPoolCapabilityValuesWrapper capabilities, List<StoragePool> candidatePrimaryPools, List<StoragePool> candidateSecondaryPools, Volume vpoolChangeVolume) {
    // Initialize a list of recommendations to be returned.
    List<Recommendation> recommendations = new ArrayList<Recommendation>();
    RPProtectionRecommendation rpProtectionRecommendaton = null;
    // Get all the matching pools for each target virtual array. If the target varray's
    // vpool specifies HA, we will only look for VPLEX connected storage pools.
    Map<VirtualArray, List<StoragePool>> tgtVarrayStoragePoolsMap = getVplexTargetMatchingPools(tgtVarrays, srcVpool, project, capabilities, vpoolChangeVolume);
    rpProtectionRecommendaton = createRPProtectionRecommendationForMetroPoint(srcVarray, tgtVarrays, srcVpool, haVarray, haVpool, capabilities, candidatePrimaryPools, candidateSecondaryPools, tgtVarrayStoragePoolsMap, vpoolChangeVolume, project);
    _log.info(String.format("Produced %s recommendations for MetroPoint placement.", rpProtectionRecommendaton.getResourceCount()));
    recommendations.add(rpProtectionRecommendaton);
    return recommendations;
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation)

Example 57 with Recommendation

use of com.emc.storageos.volumecontroller.Recommendation in project coprhd-controller by CoprHD.

the class RecoverPointScheduler method scheduleStorageForVpoolChangeProtected.

/**
 * Scheduler for a Vpool change from a protected VPLEX Virtual volume to a different type
 * of protection. Ex: RP+VPLEX upgrade to MetroPoint
 *
 * @param volume volume that is being changed to a protected vpool
 * @param newVpool vpool requested to change to (must be protected)
 * @param protectionVarrays Varrays to protect this volume to.
 * @param vpoolChangeParam The change param for the vpool change operation
 * @return list of Recommendation objects to satisfy the request
 */
public List<Recommendation> scheduleStorageForVpoolChangeProtected(Volume volume, VirtualPool newVpool, List<VirtualArray> protectionVirtualArraysForVirtualPool) {
    _log.info(String.format("Schedule storage for vpool change to vpool [%s : %s] for volume [%s : %s]", newVpool.getLabel(), newVpool.getId().toString(), volume.getLabel(), volume.getId().toString()));
    this.initResources();
    VirtualPool currentVpool = dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
    VirtualArray varray = dbClient.queryObject(VirtualArray.class, volume.getVirtualArray());
    // Swap src and ha if the flag has been set on the vpool
    SwapContainer container = this.swapSrcAndHAIfNeeded(varray, newVpool);
    Project project = dbClient.queryObject(Project.class, volume.getProject());
    VirtualPoolCapabilityValuesWrapper capabilities = new VirtualPoolCapabilityValuesWrapper();
    capabilities.put(VirtualPoolCapabilityValuesWrapper.SIZE, volume.getCapacity());
    capabilities.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, 1);
    capabilities.put(VirtualPoolCapabilityValuesWrapper.BLOCK_CONSISTENCY_GROUP, volume.getConsistencyGroup());
    List<StoragePool> sourcePools = new ArrayList<StoragePool>();
    List<StoragePool> haPools = new ArrayList<StoragePool>();
    VirtualArray haVarray = vplexScheduler.getHaVirtualArray(container.getSrcVarray(), project, container.getSrcVpool());
    VirtualPool haVpool = vplexScheduler.getHaVirtualPool(container.getSrcVarray(), project, container.getSrcVpool());
    // Recommendations to return
    List<Recommendation> recommendations = Lists.newArrayList();
    // Upgrade RP+VPLEX to MetroPoint
    if (VirtualPool.vPoolSpecifiesRPVPlex(currentVpool) && VirtualPool.vPoolSpecifiesMetroPoint(newVpool)) {
        // We already have our VPLEX Metro source and targets provisioned.
        // We're going to leverage this for placement.
        _log.info("Scheduling storage for upgrade to MetroPoint, we need to place a HA/Stand-by/Secondary Journal");
        // Get a handle on the existing source and ha volumes, we want to use the references to their
        // existing storage pools to pass to the RP Scheduler.
        Volume sourceBackingVolume = null;
        Volume haBackingVolume = null;
        if (null == volume.getAssociatedVolumes() || volume.getAssociatedVolumes().isEmpty()) {
            _log.error("VPLEX volume {} has no backend volumes.", volume.forDisplay());
            throw InternalServerErrorException.internalServerErrors.noAssociatedVolumesForVPLEXVolume(volume.forDisplay());
        }
        for (String associatedVolumeId : volume.getAssociatedVolumes()) {
            URI associatedVolumeURI = URI.create(associatedVolumeId);
            Volume backingVolume = dbClient.queryObject(Volume.class, associatedVolumeURI);
            if (backingVolume.getVirtualArray().equals(volume.getVirtualArray())) {
                sourceBackingVolume = backingVolume;
            } else {
                haBackingVolume = backingVolume;
            }
        }
        // We already have a source vpool from the (the existing one), so just add that one only to the list.
        sourcePools.add(dbClient.queryObject(StoragePool.class, sourceBackingVolume.getPool()));
        haPools.add(dbClient.queryObject(StoragePool.class, haBackingVolume.getPool()));
        // Obtain a list of RP protection Virtual Arrays.
        List<VirtualArray> tgtVarrays = RecoverPointScheduler.getProtectionVirtualArraysForVirtualPool(project, container.getSrcVpool(), dbClient, _permissionsHelper);
        recommendations = createMetroPointRecommendations(container.getSrcVarray(), tgtVarrays, container.getSrcVpool(), haVarray, haVpool, project, capabilities, sourcePools, haPools, volume);
    }
    // There is only one entry of type RPProtectionRecommendation ever in the returned recommendation list.
    _log.info(String.format("%s %n", ((RPProtectionRecommendation) recommendations.get(0)).toString(dbClient)));
    return recommendations;
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) Project(com.emc.storageos.db.client.model.Project) Volume(com.emc.storageos.db.client.model.Volume)

Example 58 with Recommendation

use of com.emc.storageos.volumecontroller.Recommendation in project coprhd-controller by CoprHD.

the class RecoverPointScheduler method placeAlreadyRecommendedPool.

/**
 * Checks if existing recommendations for pools can satisfy requested resource count in addition to what it already satisfies.
 *
 * @param sizeInBytes - Size requested in bytes
 * @param requestedCount - Resource count requested
 * @param sizeInKB - Size in KB
 * @param recs - Existing recommendations
 * @return List of recommendations that can satisfy already satisfied count # of resources plus new count
 */
private List<Recommendation> placeAlreadyRecommendedPool(long sizeInBytes, long requestedCount, long sizeInKB, List<RPRecommendation> recs) {
    List<Recommendation> recommendations = new ArrayList<Recommendation>();
    StringBuffer buff = new StringBuffer();
    for (Recommendation rec : recs) {
        StoragePool existingTargetPool = dbClient.queryObject(StoragePool.class, rec.getSourceStoragePool());
        int count = Math.abs((int) (existingTargetPool.getFreeCapacity() / (sizeInKB)));
        buff.append(String.format("%nRP Placement (Already placed) : # of resources of size %sGB that pool %s can accomodate: %d", SizeUtil.translateSize(sizeInBytes, SizeUtil.SIZE_GB).toString(), existingTargetPool.getLabel(), count));
        if (count >= requestedCount + rec.getResourceCount()) {
            recommendations.add(rec);
        }
    }
    _log.info(buff.toString());
    return recommendations;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) ArrayList(java.util.ArrayList) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint)

Example 59 with Recommendation

use of com.emc.storageos.volumecontroller.Recommendation in project coprhd-controller by CoprHD.

the class RecoverPointScheduler method printPoolRecommendations.

/**
 * Display storage pool information from recommendation
 *
 * @param  poolRecommendations Sorted Storage Pools
 */
private void printPoolRecommendations(List<Recommendation> poolRecommendations) {
    StringBuffer buf = new StringBuffer();
    buf.append(String.format("%n Recommended Pools: %n"));
    for (Recommendation poolRec : poolRecommendations) {
        StoragePool pool = dbClient.queryObject(StoragePool.class, poolRec.getSourceStoragePool());
        buf.append(String.format("Storage Pool : [%s] - Free Capacity : [%s] KB %n", pool.getLabel(), pool.getFreeCapacity()));
    }
    buf.append(String.format("---------------------------------------- %n"));
    _log.info(buf.toString());
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation)

Example 60 with Recommendation

use of com.emc.storageos.volumecontroller.Recommendation in project coprhd-controller by CoprHD.

the class RecoverPointScheduler method initResources.

/**
 * Initialize common resources
 */
private void initResources() {
    // initialize the storage pool -> storage systems map
    this.storagePoolStorageSystemCache = new HashMap<String, List<String>>();
    // Reset the HA Recommendations
    this.srcHaRecommendation = new RPRecommendation();
    this.tgtHaRecommendation = new HashMap<URI, Recommendation>();
    this.tgtVarrayHasHaVpool = new HashMap<VirtualArray, Boolean>();
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) URI(java.net.URI) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation)

Aggregations

Recommendation (com.emc.storageos.volumecontroller.Recommendation)70 ArrayList (java.util.ArrayList)62 URI (java.net.URI)49 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)37 VPlexRecommendation (com.emc.storageos.volumecontroller.VPlexRecommendation)36 NamedURI (com.emc.storageos.db.client.model.NamedURI)28 StoragePool (com.emc.storageos.db.client.model.StoragePool)28 List (java.util.List)28 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)27 RPProtectionRecommendation (com.emc.storageos.volumecontroller.RPProtectionRecommendation)27 RPRecommendation (com.emc.storageos.volumecontroller.RPRecommendation)27 Volume (com.emc.storageos.db.client.model.Volume)24 SRDFRecommendation (com.emc.storageos.volumecontroller.SRDFRecommendation)23 HashMap (java.util.HashMap)23 SRDFCopyRecommendation (com.emc.storageos.volumecontroller.SRDFCopyRecommendation)21 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)21 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)19 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)18 Project (com.emc.storageos.db.client.model.Project)17 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)16