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;
}
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;
}
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;
}
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;
}
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);
}
}
}
Aggregations