Search in sources :

Example 16 with VirtualPool

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

the class MigrationService method getVirtualPoolForMigrationTarget.

/**
 * Gets the VirtualPool for the migration target.
 *
 * @param requestedCosURI The VirtualPool specified in the migration request.
 * @param vplexVolume A reference to the VPlex virtual volume.
 * @param migrationSrc A reference to the migration source.
 *
 * @return A reference to the VirtualPool for the migration target volume.
 */
private VirtualPool getVirtualPoolForMigrationTarget(URI requestedCosURI, Volume vplexVolume, Volume migrationSrc) {
    // Get the VirtualPool for the migration source.
    VirtualPool cosForMigrationSrc = _permissionsHelper.getObjectById(migrationSrc.getVirtualPool(), VirtualPool.class);
    // Determine the VirtualPool for the migration target based on
    // the VirtualPool specified in the request, if any. Note that the
    // VirtualPool specified in the request should be the new VirtualPool for
    // the passed VPlex volume after the migration is complete.
    VirtualPool cosForMigrationTgt = null;
    if (requestedCosURI != null) {
        // Get the new VirtualPool for the virtual volume verifying
        // that the VirtualPool is valid for the project's tenant and
        // set it initially as the VirtualPool for the migration
        // target.
        Project vplexVolumeProject = _permissionsHelper.getObjectById(vplexVolume.getProject(), Project.class);
        cosForMigrationTgt = BlockService.getVirtualPoolForRequest(vplexVolumeProject, requestedCosURI, _dbClient, _permissionsHelper);
        // Now get the VirtualArray of the migration source volume.
        // We need to know if this is the primary volume or the HA
        // volume.
        URI migrationNhURI = migrationSrc.getVirtualArray();
        if (!migrationNhURI.toString().equals(vplexVolume.getVirtualArray().toString())) {
            // The HA backend volume is being migrated.
            // The VirtualPool for the HA volume is potentially
            // specified by the HA VirtualPool map in the requested
            // VirtualPool. If not, then the VirtualPool for the HA volume
            // is the same as that of the VPlex volume.
            StringMap haNhCosMap = cosForMigrationTgt.getHaVarrayVpoolMap();
            if ((haNhCosMap != null) && (haNhCosMap.containsKey(migrationNhURI.toString()))) {
                cosForMigrationTgt = BlockService.getVirtualPoolForRequest(vplexVolumeProject, URI.create(haNhCosMap.get(migrationNhURI.toString())), _dbClient, _permissionsHelper);
            }
            // Now verify the VirtualPool change is legitimate.
            VirtualPoolChangeAnalyzer.verifyVirtualPoolChangeForTechRefresh(cosForMigrationSrc, cosForMigrationTgt);
        } else {
            // The primary or source volume is being migrated.
            // The VirtualPool for the primary volume is the same as
            // that for the VPlex volume. We still need to verify
            // this is a legitimate VirtualPool change.
            VirtualPoolChangeAnalyzer.verifyVirtualPoolChangeForTechRefresh(cosForMigrationSrc, cosForMigrationTgt);
        }
    } else {
        // A new VirtualPool was not specified for the virtual volume, so
        // the VirtualPool for the migration target will be the same as that
        // for the migration source.
        cosForMigrationTgt = cosForMigrationSrc;
    }
    return cosForMigrationTgt;
}
Also used : Project(com.emc.storageos.db.client.model.Project) StringMap(com.emc.storageos.db.client.model.StringMap) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 17 with VirtualPool

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

the class ObjectVirtualPoolService method prepareVirtualPool.

// this method must not persist anything to the DB.
private VirtualPool prepareVirtualPool(ObjectVirtualPoolParam param) {
    VirtualPool vPool = new VirtualPool();
    vPool.setType(VirtualPool.Type.object.name());
    // set common VirtualPool parameters.
    populateCommonVirtualPoolCreateParams(vPool, param);
    StringSetMap arrayInfo = new StringSetMap();
    if (null != param.getSystemType()) {
        if (!VirtualPool.SystemType.NONE.toString().equals(param.getSystemType()) && !VirtualPool.SystemType.isObjectTypeSystem(param.getSystemType())) {
            throw APIException.badRequests.invalidParameter("system_type", param.getSystemType());
        }
        arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, param.getSystemType());
        vPool.addArrayInfoDetails(arrayInfo);
    }
    if (null != param.getMaxRetention()) {
        vPool.setMaxRetention(param.getMaxRetention());
    }
    if (null != param.getMinDataCenters()) {
        vPool.setMinDataCenters(param.getMinDataCenters());
    }
    return vPool;
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) VirtualPoolMapper.toObjectVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toObjectVirtualPool) MapObjectVirtualPool(com.emc.storageos.api.mapper.functions.MapObjectVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 18 with VirtualPool

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

the class ObjectVirtualPoolService method getMatchingPoolsForVirtualPoolAttributes.

/**
 * Return the matching pools for a given set of VirtualPool attributes.
 * This API is useful for user to find the matching pools before creating a VirtualPool.
 *
 * @param param : VirtualPoolAttributeParam
 * @brief List pools matching specified properties in Object store VirtualPool
 * @return : matching pools.
 */
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/matching-pools")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public StoragePoolList getMatchingPoolsForVirtualPoolAttributes(ObjectVirtualPoolParam param) {
    StoragePoolList poolList = new StoragePoolList();
    VirtualPool vpool = prepareVirtualPool(param);
    List<URI> poolURIs = _dbClient.queryByType(StoragePool.class, true);
    List<StoragePool> allPools = _dbClient.queryObject(StoragePool.class, poolURIs);
    StringBuffer errorMessage = new StringBuffer();
    List<StoragePool> matchedPools = ImplicitPoolMatcher.getMatchedPoolWithStoragePools(vpool, allPools, null, null, null, _dbClient, _coordinator, AttributeMatcher.VPOOL_MATCHERS, errorMessage);
    for (StoragePool pool : matchedPools) {
        poolList.getPools().add(toNamedRelatedResource(pool, pool.getNativeGuid()));
    }
    return poolList;
}
Also used : StoragePoolList(com.emc.storageos.model.pools.StoragePoolList) StoragePool(com.emc.storageos.db.client.model.StoragePool) VirtualPoolMapper.toObjectVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toObjectVirtualPool) MapObjectVirtualPool(com.emc.storageos.api.mapper.functions.MapObjectVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 19 with VirtualPool

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

the class RPBlockServiceApiImpl method changeVolumeVirtualPool.

/**
 * {@inheritDoc}
 *
 * @throws InternalException
 */
@Override
public TaskList changeVolumeVirtualPool(URI systemURI, Volume volume, VirtualPool newVpool, VirtualPoolChangeParam vpoolChangeParam, String taskId) throws InternalException {
    _log.info(String.format("RP change virtual pool operation for volume [%s](%s) moving to new vpool [%s](%s).", volume.getLabel(), volume.getId(), newVpool.getLabel(), newVpool.getId()));
    ArrayList<Volume> volumes = new ArrayList<Volume>();
    volumes.add(volume);
    // Check for common Vpool updates handled by generic code. It returns true if handled.
    if (checkCommonVpoolUpdates(volumes, newVpool, taskId)) {
        return null;
    }
    // Get the storage system to check for supported types
    StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
    String systemType = storageSystem.getSystemType();
    if ((DiscoveredDataObject.Type.vplex.name().equals(systemType)) || (DiscoveredDataObject.Type.vmax.name().equals(systemType)) || (DiscoveredDataObject.Type.vnxblock.name().equals(systemType)) || (DiscoveredDataObject.Type.xtremio.name().equals(systemType)) || (DiscoveredDataObject.Type.unity.name().equals(systemType))) {
        // Get the current vpool
        VirtualPool currentVpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
        String currentVpoolCopyMode = currentVpool.getRpCopyMode() == null ? "" : currentVpool.getRpCopyMode();
        String newVpoolCopyMode = newVpool.getRpCopyMode() == null ? "" : newVpool.getRpCopyMode();
        if (volume.checkForRp() && !VirtualPool.vPoolSpecifiesMetroPoint(currentVpool) && VirtualPool.vPoolSpecifiesRPVPlex(currentVpool) && VirtualPool.vPoolSpecifiesMetroPoint(newVpool)) {
            _log.info("Upgrade To MetroPoint");
            upgradeToMetroPointVolume(volume, newVpool, vpoolChangeParam, taskId);
        } else if (volume.checkForRp() && !currentVpoolCopyMode.equals(newVpoolCopyMode)) {
            _log.info("Change Replication Mode");
            updateReplicationMode(volumes, newVpool, taskId);
        } else {
            _log.info("Add RecoverPoint Protection");
            upgradeToProtectedVolume(volume, newVpool, vpoolChangeParam, taskId);
        }
    }
    return null;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 20 with VirtualPool

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

the class RPBlockServiceApiImpl method rpVPlexGroupedMigrations.

/**
 * Calls out to the VPLEX Block Service to group any volumes in RG and migrate
 * the volumes together. If there are any volumes not in RGs they are returned
 * and then added to the single migration container to be migrated later.
 *
 * @param volumesToMigrate All volumes to migrate
 * @param singleMigrations Container to keep track of single migrations
 * @param type Personality type for logging
 * @param logMigrations Log buffer
 * @param taskList List of tasks that will be returned to user
 * @param vpoolChangeParam used to determine if we should suspend on migration commit
 */
private void rpVPlexGroupedMigrations(HashMap<VirtualPool, List<Volume>> volumesToMigrate, Map<Volume, VirtualPool> singleMigrations, String type, StringBuffer logMigrations, TaskList taskList, VirtualPoolChangeParam vpoolChangeParam) {
    for (Map.Entry<VirtualPool, List<Volume>> entry : volumesToMigrate.entrySet()) {
        // List to hold volumes that are grouped by RG and migrated together
        List<Volume> volumesInRG = new ArrayList<Volume>();
        // List to hold volumes that are not grouped by RG and will be migrated as single migrations
        List<Volume> volumesNotInRG = new ArrayList<Volume>();
        VirtualPool migrateToVpool = entry.getKey();
        List<Volume> migrateVolumes = entry.getValue();
        ControllerOperationValuesWrapper operationsWrapper = new ControllerOperationValuesWrapper();
        operationsWrapper.put(ControllerOperationValuesWrapper.MIGRATION_SUSPEND_BEFORE_COMMIT, vpoolChangeParam.getMigrationSuspendBeforeCommit());
        operationsWrapper.put(ControllerOperationValuesWrapper.MIGRATION_SUSPEND_BEFORE_DELETE_SOURCE, vpoolChangeParam.getMigrationSuspendBeforeDeleteSource());
        TaskList taskList2 = vplexBlockServiceApiImpl.migrateVolumesInReplicationGroup(migrateVolumes, migrateToVpool, volumesNotInRG, volumesInRG, operationsWrapper);
        taskList.getTaskList().addAll(taskList2.getTaskList());
        for (Volume volumeInRG : volumesInRG) {
            logMigrations.append(String.format("\tRP+VPLEX migrate %s [%s](%s) to vpool [%s](%s) - GROUPED BY RG\n", type, volumeInRG.getLabel(), volumeInRG.getId(), migrateToVpool.getLabel(), migrateToVpool.getId()));
        }
        for (Volume volumeNotInRG : volumesNotInRG) {
            logMigrations.append(String.format("\tRP+VPLEX migrate %s [%s](%s) to vpool [%s](%s)\n", type, volumeNotInRG.getLabel(), volumeNotInRG.getId(), migrateToVpool.getLabel(), migrateToVpool.getId()));
            singleMigrations.put(volumeNotInRG, migrateToVpool);
        }
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) 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) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Map(java.util.Map) OpStatusMap(com.emc.storageos.db.client.model.OpStatusMap) HashMap(java.util.HashMap) ControllerOperationValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.ControllerOperationValuesWrapper)

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