use of com.emc.storageos.volumecontroller.placement.ExportPathUpdater in project coprhd-controller by CoprHD.
the class BlockService method verifyVirtualPoolChangeSupportedForVolumeAndVirtualPool.
/**
* Determines whether or not the passed VirtualPool change for the passed Volume is
* supported. Throws a ServiceCodeException when the vpool change is not
* supported.
*
* @param volume
* A reference to the volume.
* @param newVpool
* A reference to the new VirtualPool.
*/
private void verifyVirtualPoolChangeSupportedForVolumeAndVirtualPool(Volume volume, VirtualPool newVpool) {
// Currently, Vpool change is only supported for volumes on
// VPlex storage systems and volumes (both regular and VPLEX i.e. RP+VPLEX) that are currently
// unprotected by RP to a Vpool that has RP, as long as the source volume doesn't have to move.
VirtualPool currentVpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
URI systemURI = volume.getStorageController();
StorageSystem system = _dbClient.queryObject(StorageSystem.class, systemURI);
String systemType = system.getSystemType();
StringBuffer notSuppReasonBuff = new StringBuffer();
notSuppReasonBuff.setLength(0);
/**
* Do not support following vpool change operations for the volume part of application
* 1. Move into Vplex
* 2. Add RecoverPoint
* 3. Remove RecoverPoint
* 4. Add SRDF
*/
if (volume.getApplication(_dbClient) != null) {
// Move into VPLEX
if (!VirtualPool.vPoolSpecifiesHighAvailability(currentVpool) && VirtualPool.vPoolSpecifiesHighAvailability(newVpool)) {
notSuppReasonBuff.append("Non VPLEX volumes in applications cannot be moved into VPLEX pools");
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
// Add recoverPoint
if (!VirtualPool.vPoolSpecifiesProtection(currentVpool) && VirtualPool.vPoolSpecifiesProtection(newVpool)) {
notSuppReasonBuff.append("Non RP volumes in applications cannot be moved into RP pools");
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
// Remove RecoverPoint
if (VirtualPool.vPoolSpecifiesProtection(currentVpool) && !VirtualPool.vPoolSpecifiesProtection(newVpool)) {
notSuppReasonBuff.append("RP volumes in applications cannot be moved into non RP pools");
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
// Add SRDF
if (!VirtualPool.vPoolSpecifiesSRDF(currentVpool) && VirtualPool.vPoolSpecifiesSRDF(newVpool)) {
notSuppReasonBuff.append("volumes in applications cannot be moved into SRDF pools");
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
}
// Check if an Export Path Params change.
if (VirtualPoolChangeAnalyzer.isSupportedPathParamsChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
ExportPathUpdater updater = new ExportPathUpdater(_dbClient);
ExportPathParams newParam = new ExportPathParams(newVpool.getNumPaths(), newVpool.getMinPaths(), newVpool.getPathsPerInitiator());
updater.validateChangePathParams(volume.getId(), newParam);
_log.info("New VPool specifies an Export Path Params change");
return;
}
// Check if it is an Auto-tiering policy change.
notSuppReasonBuff.setLength(0);
if (VirtualPoolChangeAnalyzer.isSupportedAutoTieringPolicyAndLimitsChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.info("New VPool specifies an Auto-tiering policy change");
return;
}
if (VirtualPoolChangeAnalyzer.isSupportedReplicationModeChange(currentVpool, newVpool, notSuppReasonBuff)) {
_log.info("New VPool specifies a replication mode change");
return;
}
if (DiscoveredDataObject.Type.vplex.name().equals(systemType)) {
_log.info("Volume is a VPlex virtual volume.");
// the Vpool specifies a different grade of disk drives.
if (!VirtualPool.vPoolSpecifiesHighAvailability(newVpool)) {
_log.info("New VirtualPool does not specify VPlex high availability.");
throw new ServiceCodeException(ServiceCode.API_VOLUME_VPOOL_CHANGE_DISRUPTIVE, "New VirtualPool {0} does not specify vplex high availability", new Object[] { newVpool.getId() });
} else {
notSuppReasonBuff.setLength(0);
// can be exposed in the Migration Services catalog to support RP+VPLEX Data Migrations.
if (volume.checkPersonality(Volume.PersonalityTypes.METADATA)) {
if (VirtualPoolChangeAnalyzer.vpoolChangeRequiresMigration(currentVpool, newVpool)) {
verifyVPlexVolumeForDataMigration(volume, currentVpool, newVpool, _dbClient);
return;
}
}
// if the request is trying to remove RP protection.
if (volume.checkForRp() && VirtualPool.vPoolSpecifiesProtection(currentVpool) && !VirtualPool.vPoolSpecifiesProtection(newVpool)) {
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isSupportedRPRemoveProtectionVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
} else if (VirtualPool.vPoolSpecifiesRPVPlex(newVpool)) {
notSuppReasonBuff.setLength(0);
// Check to see if any of the operations for protected vpool to protected vpool changes are supported
if (VirtualPool.vPoolSpecifiesRPVPlex(currentVpool)) {
if (VirtualPoolChangeAnalyzer.isSupportedRPVPlexMigrationVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff, null)) {
verifyVPlexVolumeForDataMigration(volume, currentVpool, newVpool, _dbClient);
} else if (!VirtualPoolChangeAnalyzer.isSupportedUpgradeToMetroPointVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.warn("RP Change Protection VirtualPool change for volume is not supported: {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
} else // Otherwise, check to see if we're trying to protect a VPLEX volume.
if (!VirtualPoolChangeAnalyzer.isSupportedAddRPProtectionVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.warn("RP+VPLEX VirtualPool change for volume is not supported: {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
} else if (BlockFullCopyUtils.volumeHasFullCopySession(volume, _dbClient)) {
// Full copies not supported for RP protected volumes.
throw APIException.badRequests.volumeForRPVpoolChangeHasFullCopies(volume.getLabel());
}
} else {
VirtualPoolChangeOperationEnum vplexVpoolChangeOperation = VirtualPoolChangeAnalyzer.getSupportedVPlexVolumeVirtualPoolChangeOperation(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff);
if (vplexVpoolChangeOperation == null) {
_log.warn("VPlex volume VirtualPool change not supported {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
} else if (VPlexUtil.isVolumeBuiltOnBlockSnapshot(_dbClient, volume)) {
// created using the target volume of a block snapshot.
throw APIException.badRequests.vpoolChangeNotAllowedVolumeIsExposedSnapshot(volume.getId().toString());
} else if (vplexVpoolChangeOperation == VirtualPoolChangeOperationEnum.VPLEX_DATA_MIGRATION) {
verifyVPlexVolumeForDataMigration(volume, currentVpool, newVpool, _dbClient);
}
}
}
} else if (DiscoveredDataObject.Type.vmax.name().equals(systemType) || DiscoveredDataObject.Type.vnxblock.name().equals(systemType) || DiscoveredDataObject.Type.hds.name().equals(systemType) || DiscoveredDataObject.Type.xtremio.name().equals(systemType) || DiscoveredDataObject.Type.ibmxiv.name().equals(systemType) || DiscoveredDataObject.Type.unity.name().equals(systemType)) {
if (VirtualPool.vPoolSpecifiesHighAvailability(newVpool)) {
// VNX/VMAX import to VPLEX cases
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isVPlexImport(volume, currentVpool, newVpool, notSuppReasonBuff) || (!VirtualPoolChangeAnalyzer.doesVplexVpoolContainVolumeStoragePool(volume, newVpool, notSuppReasonBuff))) {
_log.warn("VNX/VMAX cos change for volume is not supported: {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
if (volume.isVolumeExported(_dbClient)) {
throw APIException.badRequests.cannotImportExportedVolumeToVplex(volume.getId());
} else if (BlockFullCopyUtils.volumeHasFullCopySession(volume, _dbClient)) {
// The backend would have a full copy, but the VPLEX volume would not.
throw APIException.badRequests.volumeForVpoolChangeHasFullCopies(volume.getLabel());
} else {
// Can't be imported if it has snapshot sessions, because we
// don't currently support these behind VPLEX.
List<BlockSnapshotSession> snapSessions = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, BlockSnapshotSession.class, ContainmentConstraint.Factory.getParentSnapshotSessionConstraint(volume.getId()));
if (!snapSessions.isEmpty()) {
throw APIException.badRequests.cannotImportVolumeWithSnapshotSessions(volume.getLabel());
}
}
} else if (VirtualPool.vPoolSpecifiesProtection(newVpool)) {
// VNX/VMAX import to RP cases (currently one)
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isSupportedAddRPProtectionVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.warn("VirtualPool change to Add RP Protection for volume is not supported: {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
} else if (BlockFullCopyUtils.volumeHasFullCopySession(volume, _dbClient)) {
// Full copies not supported for RP protected volumes.
throw APIException.badRequests.volumeForRPVpoolChangeHasFullCopies(volume.getLabel());
} else {
// Can't add RP if it has snapshot sessions, because we
// don't currently support these for RP protected volumes.
List<BlockSnapshotSession> snapSessions = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, BlockSnapshotSession.class, ContainmentConstraint.Factory.getParentSnapshotSessionConstraint(volume.getId()));
if (!snapSessions.isEmpty()) {
throw APIException.badRequests.volumeForRPVpoolChangeHasSnapshotSessions(volume.getLabel());
}
}
} else if (VirtualPool.vPoolSpecifiesProtection(currentVpool) && !VirtualPool.vPoolSpecifiesProtection(newVpool)) {
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isSupportedRPRemoveProtectionVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
} else if (VirtualPool.vPoolSpecifiesSRDF(newVpool)) {
// VMAX import to SRDF cases (currently one)
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isSupportedSRDFVolumeVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.warn("VMAX VirtualPool change for volume is not supported: {}", notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
} else if (BlockFullCopyUtils.volumeHasFullCopySession(volume, _dbClient)) {
// Full copy not supported for volumes with asynchronous copy mode.
Map<URI, VpoolRemoteCopyProtectionSettings> remoteCopySettingsMap = VirtualPool.getRemoteProtectionSettings(newVpool, _dbClient);
VpoolRemoteCopyProtectionSettings remoteCopyProtectionSettings = remoteCopySettingsMap.values().iterator().next();
if (SupportedCopyModes.ASYNCHRONOUS.toString().equalsIgnoreCase(remoteCopyProtectionSettings.getCopyMode())) {
throw APIException.badRequests.volumeForSRDFVpoolChangeHasFullCopies(volume.getLabel());
}
}
} else if (!NullColumnValueGetter.isNullNamedURI(volume.getSrdfParent()) || (volume.getSrdfTargets() != null && !volume.getSrdfTargets().isEmpty())) {
// Cannot move SRDF Volume to non SRDF VPool
throw APIException.badRequests.srdfVolumeVPoolChangeToNonSRDFVPoolNotSupported(volume.getId());
} else if (VirtualPool.vPoolSpecifiesMirrors(newVpool, _dbClient)) {
notSuppReasonBuff.setLength(0);
if (!VirtualPoolChangeAnalyzer.isSupportedAddMirrorsVirtualPoolChange(volume, currentVpool, newVpool, _dbClient, notSuppReasonBuff)) {
_log.warn("VirtualPool change to add continuous copies for volume {} is not supported: {}", volume.getId(), notSuppReasonBuff.toString());
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
} else {
String errMsg = "there was an invalid property mismatch between source and target vPools.";
_log.error(errMsg);
notSuppReasonBuff.append(errMsg);
throw APIException.badRequests.changeToVirtualPoolNotSupported(newVpool.getLabel(), notSuppReasonBuff.toString());
}
} else {
_log.info("VirtualPool change volume is not a vplex, vmax or vnxblock volume");
throw new ServiceCodeException(ServiceCode.API_VOLUME_VPOOL_CHANGE_DISRUPTIVE, "VirtualPool change is not supported for volume {0}", new Object[] { volume.getId() });
}
}
use of com.emc.storageos.volumecontroller.placement.ExportPathUpdater in project coprhd-controller by CoprHD.
the class VPlexDeviceController method exportGroupChangePathParams.
@Override
public void exportGroupChangePathParams(URI storageURI, URI exportGroupURI, URI blockObjectURI, String token) throws Exception {
ExportOrchestrationTask taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
ExportPathUpdater updater = new ExportPathUpdater(_dbClient);
try {
String workflowKey = "exportGroupChangePathParams";
if (_workflowService.hasWorkflowBeenCreated(token, workflowKey)) {
return;
}
Workflow workflow = _workflowService.getNewWorkflow(MaskingWorkflowEntryPoints.getInstance(), workflowKey, true, token);
ExportGroup exportGroup = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
BlockObject bo = Volume.fetchExportMaskBlockObject(_dbClient, blockObjectURI);
_log.info(String.format("Changing path parameters for volume %s (%s)", bo.getLabel(), bo.getId()));
updater.generateExportGroupChangePathParamsWorkflow(workflow, _blockScheduler, this, storage, exportGroup, bo, token);
if (!workflow.getAllStepStatus().isEmpty()) {
_log.info("The changePathParams workflow has {} steps. Starting the workflow.", workflow.getAllStepStatus().size());
workflow.executePlan(taskCompleter, "Update the export group on all export masks successfully.");
_workflowService.markWorkflowBeenCreated(token, workflowKey);
} else {
taskCompleter.ready(_dbClient);
}
} catch (Exception ex) {
_log.error("ExportGroup Orchestration failed.", ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(ex.getMessage(), ex);
failStep(taskCompleter, token, serviceError);
}
}
use of com.emc.storageos.volumecontroller.placement.ExportPathUpdater in project coprhd-controller by CoprHD.
the class AbstractBasicMaskingOrchestrator method exportGroupChangePathParams.
@Override
public void exportGroupChangePathParams(URI storageURI, URI exportGroupURI, URI volumeURI, String token) throws Exception {
ExportOrchestrationTask taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
ExportPathUpdater updater = new ExportPathUpdater(_dbClient);
try {
Workflow workflow = _workflowService.getNewWorkflow(MaskingWorkflowEntryPoints.getInstance(), "exportGroupChangePathParams", true, token);
ExportGroup exportGroup = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
BlockObject volume = BlockObject.fetch(_dbClient, volumeURI);
_log.info(String.format("Changing path parameters for volume %s (%s)", volume.getLabel(), volume.getId()));
// Call the ExportPathUpdater to generate Workflow steps necessary to change
// the path parameters. It will analyze the ExportGroups versus the ExportParams in
// the VPool of the volume, and call increaseMaxPaths if necessary.
updater.generateExportGroupChangePathParamsWorkflow(workflow, _blockScheduler, this, storage, exportGroup, volume, token);
if (!workflow.getAllStepStatus().isEmpty()) {
_log.info("The changePathParams workflow has {} steps. Starting the workflow.", workflow.getAllStepStatus().size());
workflow.executePlan(taskCompleter, "Update the export group on all export masks successfully.");
} else {
taskCompleter.ready(_dbClient);
}
} catch (Exception ex) {
_log.error("ExportGroup Orchestration failed.", ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(ex.getMessage(), ex);
taskCompleter.error(_dbClient, serviceError);
}
}
Aggregations