Search in sources :

Example 6 with VpoolUse

use of com.emc.storageos.api.service.impl.placement.VpoolUse in project coprhd-controller by CoprHD.

the class VolumeService method newVolume.

protected TaskList newVolume(VolumeCreate volumeCreate, Project project, BlockServiceApi api, VirtualPoolCapabilityValuesWrapper capabilities, VirtualArray varray, String task, VirtualPool vpool, VolumeCreateRequestGen param, int volumeCount, long requestedSize, String name) {
    List recommendations = _placementManager.getRecommendationsForVolumeCreateRequest(varray, project, vpool, capabilities);
    Map<VpoolUse, List<Recommendation>> recommendationsMap = new HashMap<VpoolUse, List<Recommendation>>();
    recommendationsMap.put(VpoolUse.ROOT, recommendations);
    if (recommendations.isEmpty()) {
        throw APIException.badRequests.noMatchingStoragePoolsForVpoolAndVarray(vpool.getLabel(), varray.getLabel());
    }
    String volname = null;
    if (param.volume.name != null)
        volname = param.volume.name;
    else
        volname = param.volume.display_name;
    auditOp(OperationTypeEnum.CREATE_BLOCK_VOLUME, true, AuditLogManager.AUDITOP_BEGIN, volname, volumeCount, varray.getId().toString(), project.getId().toString());
    _log.debug("Block Service API call for : Create New Volume ");
    TaskList passedTaskist = createTaskList(requestedSize, project, varray, vpool, name, task, volumeCount);
    return api.createVolumes(volumeCreate, project, varray, vpool, recommendationsMap, passedTaskist, task, capabilities);
}
Also used : VpoolUse(com.emc.storageos.api.service.impl.placement.VpoolUse) HashMap(java.util.HashMap) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) SearchedResRepList(com.emc.storageos.api.service.impl.response.SearchedResRepList) Recommendation(com.emc.storageos.volumecontroller.Recommendation)

Example 7 with VpoolUse

use of com.emc.storageos.api.service.impl.placement.VpoolUse in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method prepareBackendVolumeForMigration.

/**
 * Deprecated, need to start using createBackendVolumeMigrationDescriptors for use in
 * BlockOrchestration.
 *
 * Does the work necessary to prepare the passed backend volume for the
 * passed virtual volume to be migrated to a new volume with a new VirtualPool.
 *
 * @param vplexSystem A reference to the Vplex storage system
 * @param virtualVolume A reference to the virtual volume.
 * @param sourceVolume A reference to the backend volume to be migrated.
 * @param nh A reference to the varray for the backend volume.
 * @param vpool A reference to the VirtualPool for the new volume.
 * @param capacity The capacity for the migration target.
 * @param taskId The task identifier.
 * @param newVolumes An OUT parameter to which the new volume is added.
 * @param migrationMap A OUT parameter to which the new migration is added.
 * @param poolVolumeMap An OUT parameter associating the new Volume to the
 *            storage pool in which it will be created.
 */
@Deprecated
private void prepareBackendVolumeForMigration(StorageSystem vplexSystem, Volume virtualVolume, Volume sourceVolume, VirtualArray varray, VirtualPool vpool, Long capacity, String taskId, List<URI> newVolumes, Map<URI, URI> migrationMap, Map<URI, URI> poolVolumeMap) {
    URI sourceVolumeURI = null;
    Project targetProject = null;
    String targetLabel = null;
    if (sourceVolume != null) {
        // Since we know the source volume, this is not an ingested
        // VPLEX volume that is being migrated. Ideally we would just
        // give the new backend volume the same name as the current
        // i.e., source. However, this is a problem if the migration
        // is on the same array. We can't have two volumes with the
        // same name. Eventually the source will go away, but not until
        // after the migration is completed. The backend volume names
        // are basically irrelevant, but we still want them tied to
        // the VPLEX volume name.
        // 
        // When initially created, the names are <vvolname>-0 or
        // <vvolname>-1, depending upon if it is the source side
        // backend volume or HA side backend volume. The volume may
        // also have an additional suffix of "-<1...N>" if the
        // VPLEX volume was created as part of a multi-volume creation
        // request, where N was the number of volumes requested. When
        // a volume is first migrated, we will append a "m" to the current
        // source volume name to ensure name uniqueness. If the volume
        // happens to be migrated again, we'll remove the extra character.
        // We'll go back forth in this manner for each migration of that
        // backend volume.
        sourceVolumeURI = sourceVolume.getId();
        targetProject = _dbClient.queryObject(Project.class, sourceVolume.getProject().getURI());
        targetLabel = sourceVolume.getLabel();
        if (!targetLabel.endsWith(MIGRATION_LABEL_SUFFIX)) {
            targetLabel += MIGRATION_LABEL_SUFFIX;
        } else {
            targetLabel = targetLabel.substring(0, targetLabel.length() - 1);
        }
    } else {
        // The VPLEX volume must be ingested and now the backend
        // volume(s) are being migrated. We have no idea what the
        // source volume name is. Therefore, we can just give
        // them initial extensions. It is highly unlikely that
        // they will have the same naming conventions for their
        // backend volumes.
        targetProject = getVplexProject(vplexSystem, _dbClient, _tenantsService);
        targetLabel = virtualVolume.getLabel();
        if (virtualVolume.getVirtualArray().equals(varray.getId())) {
            targetLabel += SRC_BACKEND_VOL_LABEL_SUFFIX;
        } else {
            targetLabel += HA_BACKEND_VOL_LABEL_SUFFIX;
        }
    }
    // Get the recommendation for this volume placement.
    URI cgURI = null;
    if (!NullColumnValueGetter.isNullURI(sourceVolume.getConsistencyGroup())) {
        cgURI = sourceVolume.getConsistencyGroup();
    }
    Set<URI> requestedVPlexSystems = new HashSet<URI>();
    requestedVPlexSystems.add(vplexSystem.getId());
    VirtualPoolCapabilityValuesWrapper cosWrapper = new VirtualPoolCapabilityValuesWrapper();
    cosWrapper.put(VirtualPoolCapabilityValuesWrapper.SIZE, capacity);
    cosWrapper.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, new Integer(1));
    if (cgURI != null) {
        cosWrapper.put(VirtualPoolCapabilityValuesWrapper.BLOCK_CONSISTENCY_GROUP, cgURI);
    }
    List<Recommendation> recommendations = getBlockScheduler().scheduleStorage(varray, requestedVPlexSystems, null, vpool, false, null, null, cosWrapper, targetProject, VpoolUse.ROOT, new HashMap<VpoolUse, List<Recommendation>>());
    if (recommendations.isEmpty()) {
        throw APIException.badRequests.noStorageFoundForVolumeMigration(vpool.getLabel(), varray.getLabel(), sourceVolumeURI);
    }
    s_logger.info("Got recommendation");
    // Create a volume for the new backend volume to which
    // data will be migrated.
    URI targetStorageSystem = recommendations.get(0).getSourceStorageSystem();
    URI targetStoragePool = recommendations.get(0).getSourceStoragePool();
    Volume targetVolume = prepareVolumeForRequest(capacity, targetProject, varray, vpool, targetStorageSystem, targetStoragePool, targetLabel, ResourceOperationTypeEnum.CREATE_BLOCK_VOLUME, taskId, _dbClient);
    if (cgURI != null) {
        targetVolume.setConsistencyGroup(cgURI);
    }
    targetVolume.addInternalFlags(Flag.INTERNAL_OBJECT);
    _dbClient.updateObject(targetVolume);
    s_logger.info("Prepared volume {}", targetVolume.getId());
    // Add the volume to the passed new volumes list and pool
    // volume map.
    URI targetVolumeURI = targetVolume.getId();
    newVolumes.add(targetVolumeURI);
    poolVolumeMap.put(targetStoragePool, targetVolumeURI);
    // Create a migration to represent the migration of data
    // from the backend volume to the new backend volume for the
    // passed virtual volume and add the migration to the passed
    // migrations list.
    Migration migration = prepareMigration(virtualVolume.getId(), sourceVolumeURI, targetVolumeURI, taskId);
    migrationMap.put(targetVolumeURI, migration.getId());
    s_logger.info("Prepared migration {}.", migration.getId());
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VpoolUse(com.emc.storageos.api.service.impl.placement.VpoolUse) Migration(com.emc.storageos.db.client.model.Migration) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) VolumeRecommendation(com.emc.storageos.api.service.impl.placement.VolumeRecommendation) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) Project(com.emc.storageos.db.client.model.Project) Volume(com.emc.storageos.db.client.model.Volume) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) VolumeGroupVolumeList(com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) List(java.util.List) HashSet(java.util.HashSet)

Aggregations

VpoolUse (com.emc.storageos.api.service.impl.placement.VpoolUse)7 Recommendation (com.emc.storageos.volumecontroller.Recommendation)7 ArrayList (java.util.ArrayList)7 List (java.util.List)7 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)6 TaskList (com.emc.storageos.model.TaskList)6 HashMap (java.util.HashMap)6 Project (com.emc.storageos.db.client.model.Project)5 StorageSystemConnectivityList (com.emc.storageos.model.systems.StorageSystemConnectivityList)5 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)5 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)4 VolumeGroupVolumeList (com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList)4 ApplicationAddVolumeList (com.emc.storageos.volumecontroller.ApplicationAddVolumeList)4 URI (java.net.URI)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 Volume (com.emc.storageos.db.client.model.Volume)3 VolumeCreate (com.emc.storageos.model.block.VolumeCreate)3 RPProtectionRecommendation (com.emc.storageos.volumecontroller.RPProtectionRecommendation)3 RPRecommendation (com.emc.storageos.volumecontroller.RPRecommendation)3 Migration (com.emc.storageos.db.client.model.Migration)2