use of com.emc.storageos.volumecontroller.RPRecommendation in project coprhd-controller by CoprHD.
the class RecoverPointSchedulerTest method fillRecommendationObject.
public void fillRecommendationObject(RPProtectionRecommendation rec, ProtectionSystem ps, String sourceInternalSiteName, String destInternalSiteName, VirtualArray sourceVarray, VirtualArray destVarray, StoragePool sourceStoragePool, StoragePool destStoragePool, int resourceCount) {
rec.setProtectionDevice(ps.getId());
// fill the source
RPRecommendation sourceRec = new RPRecommendation();
sourceRec.setInternalSiteName(sourceInternalSiteName);
sourceRec.setSourceStoragePool(sourceStoragePool.getId());
sourceRec.setResourceCount(resourceCount);
rec.setResourceCount(resourceCount);
// fill source journal
RPRecommendation sourceJournalRec = new RPRecommendation();
sourceJournalRec.setSourceStoragePool(sourceStoragePool.getId());
sourceJournalRec.setInternalSiteName(sourceInternalSiteName);
sourceJournalRec.setResourceCount(1);
// fill target
RPRecommendation targetRec = new RPRecommendation();
targetRec.setInternalSiteName(destInternalSiteName);
targetRec.setSourceStoragePool(sourceStoragePool.getId());
targetRec.setResourceCount(resourceCount);
sourceRec.setTargetRecommendations(new ArrayList<RPRecommendation>());
sourceRec.getTargetRecommendations().add(targetRec);
// fill targetJournal
RPRecommendation targetJournalRec = new RPRecommendation();
targetJournalRec.setSourceStoragePool(destStoragePool.getId());
targetJournalRec.setInternalSiteName(destInternalSiteName);
targetJournalRec.setResourceCount(1);
// populate the protection recommendation object with all the recommendation
rec.setSourceRecommendations(new ArrayList<RPRecommendation>());
rec.getSourceRecommendations().add(sourceRec);
rec.setSourceJournalRecommendation(sourceJournalRec);
rec.setTargetJournalRecommendations(new ArrayList<RPRecommendation>());
rec.getTargetJournalRecommendations().add(targetJournalRec);
}
use of com.emc.storageos.volumecontroller.RPRecommendation in project coprhd-controller by CoprHD.
the class RPBlockServiceApiImpl method prepareRecommendedVolumes.
/**
* Prepare Recommended Volumes for Protected scenarios only.
*
* This method is responsible for acting the same as the unprotected "prepareRecommendedVolumes" call,
* however it needs to create multiple volumes per single volume requests in order to generate protection.
*
* Those most typical scenario is, that for any one volume requested in a CRR configuration, we create:
* 1. One Source Volume
* 2. One Source Journal Volume (minimum 10GB, otherwise 2.5X source size)
* 3. One Target Volume on protection varray
* 4. One Target Journal Volume on protection varray
*
* In a CLR configuration, there are additional volumes created for the Local Target and Local Target Journal.
*
* This method will assemble a ProtectionSet object in Cassandra that will describe the Protection that
* will be created on the Protection System.
*
* When other protection mechanisms come on board, the RP-ness of this method will need to be pulled out.
*
* @param param volume create request
* @param task task from request or generated
* @param taskList task list
* @param project project from request
* @param originalVarray varray from request
* @param originalVpool vpool from request
* @param numberOfVolumesInRequest volume count from the request
* @param recommendations list of resulting recommendations from placement
* @param consistencyGroup consistency group ID
* @param capabilities Capabilities object
* @param descriptors List of descriptors to be populated
* @param volumeURIs List to hold volumes that have been prepared
*/
private void prepareRecommendedVolumes(VolumeCreate param, String task, TaskList taskList, Project project, VirtualArray originalVarray, VirtualPool originalVpool, Integer numberOfVolumesInRequest, List<Recommendation> recommendations, String volumeLabel, VirtualPoolCapabilityValuesWrapper capabilities, List<VolumeDescriptor> descriptors, List<URI> volumeURIs) throws APIException {
boolean isChangeVpool = false;
boolean isChangeVpoolForProtectedVolume = false;
boolean isSrcAndHaSwapped = VirtualPool.isRPVPlexProtectHASide(originalVpool);
boolean metroPointEnabled = VirtualPool.vPoolSpecifiesMetroPoint(originalVpool);
// This copy of capabilities object is meant to be used by all volume prepares that require changing data,
// which is our case is TARGET and JOURNALS. SOURCE will use always use the main capabilities object.
VirtualPoolCapabilityValuesWrapper copyOfCapabilities = new VirtualPoolCapabilityValuesWrapper(capabilities);
// Set the volume name from the param
String volumeName = volumeLabel;
// Need to check if we should swap src and ha, call the block scheduler code to
// find out. Nothing will be changed for MetroPoint.
VirtualArray haVarray = null;
VirtualPool haVpool = null;
SwapContainer container = this.getBlockScheduler().new SwapContainer();
container.setSrcVarray(originalVarray);
container.setSrcVpool(originalVpool);
container.setHaVarray(haVarray);
container.setHaVpool(haVpool);
container = RecoverPointScheduler.initializeSwapContainer(container, _dbClient);
// Use the new references post swap
VirtualArray varray = container.getSrcVarray();
VirtualPool vpool = container.getSrcVpool();
// Save a reference to the CG, we'll need this later
BlockConsistencyGroup consistencyGroup = capabilities.getBlockConsistencyGroup() == null ? null : _dbClient.queryObject(BlockConsistencyGroup.class, capabilities.getBlockConsistencyGroup());
// Total volumes to be created
int totalVolumeCount = 0;
// Create an entire Protection object for each recommendation result.
Iterator<Recommendation> recommendationsIter = recommendations.iterator();
while (recommendationsIter.hasNext()) {
RPProtectionRecommendation rpProtectionRec = (RPProtectionRecommendation) recommendationsIter.next();
URI protectionSystemURI = rpProtectionRec.getProtectionDevice();
URI changeVpoolVolumeURI = rpProtectionRec.getVpoolChangeVolume();
Volume changeVpoolVolume = (changeVpoolVolumeURI == null ? null : _dbClient.queryObject(Volume.class, changeVpoolVolumeURI));
isChangeVpool = (changeVpoolVolumeURI != null);
isChangeVpoolForProtectedVolume = rpProtectionRec.isVpoolChangeProtectionAlreadyExists();
boolean addJournalForStandbySourceCopy = capabilities.getAddJournalCapacity() && (rpProtectionRec.getStandbyJournalRecommendation() != null);
String newVolumeLabel = volumeName;
// Find the Source RP Copy Name
String sourceCopyName = retrieveRpCopyName(originalVpool, varray, consistencyGroup, true);
String standbySourceCopyName = "";
if (addJournalForStandbySourceCopy) {
// Find the Source Standby RP Copy Name - for add journal operation
standbySourceCopyName = retrieveRpCopyName(originalVpool, varray, consistencyGroup, true);
}
if (metroPointEnabled) {
// Find the Source Standby RP Copy Name - for MetorPoint
haVarray = _dbClient.queryObject(VirtualArray.class, VPlexUtil.getHAVarray(originalVpool));
standbySourceCopyName = retrieveRpCopyName(originalVpool, haVarray, consistencyGroup, true);
}
StringBuffer volumeInfoBuffer = new StringBuffer();
volumeInfoBuffer.append(String.format(NEW_LINE));
// Prepare the Journals first
try {
prepareRpJournals(rpProtectionRec, project, consistencyGroup, vpool, originalVpool, param, numberOfVolumesInRequest, newVolumeLabel, isChangeVpoolForProtectedVolume, copyOfCapabilities, protectionSystemURI, taskList, task, descriptors, volumeURIs, volumeInfoBuffer, sourceCopyName, standbySourceCopyName);
} catch (Exception e) {
_log.error("Error trying to prepare RP Journal volumes", e);
throw APIException.badRequests.rpBlockApiImplPrepareVolumeException(newVolumeLabel);
}
// Prepare the source and targets
if (rpProtectionRec.getSourceRecommendations() != null) {
for (RPRecommendation sourceRec : rpProtectionRec.getSourceRecommendations()) {
// Get a reference to all existing VPLEX Source volumes (if any)
List<Volume> allSourceVolumesInCG = BlockConsistencyGroupUtils.getActiveVplexVolumesInCG(consistencyGroup, _dbClient, Volume.PersonalityTypes.SOURCE);
// first MP volume of a new CG.
if (metroPointEnabled && allSourceVolumesInCG.isEmpty()) {
validateMetroPointType(sourceRec.getMetroPointType());
}
// Get the number of volumes needed to be created for this recommendation.
int volumeCountInRec = sourceRec.getResourceCount();
// All source volumes will share the same secondary journal.
if (isChangeVpoolForProtectedVolume) {
_log.info(String.format("Change Virtual Pool Protected: %d existing source volume(s) in CG [%s](%s) are affected.", allSourceVolumesInCG.size(), consistencyGroup.getLabel(), consistencyGroup.getId()));
// Force the count to the number of existing source volumes in the CG.
volumeCountInRec = allSourceVolumesInCG.size();
}
// Grab a handle of the haRec, it could be null which is Ok.
RPRecommendation haRec = sourceRec.getHaRecommendation();
for (int volumeCount = 0; volumeCount < volumeCountInRec; volumeCount++) {
// Let's not get into multiple of multiples, this class will handle multi volume creates.
// So force the incoming VolumeCreate param to be set to 1 always from here on.
sourceRec.setResourceCount(1);
if (haRec != null) {
haRec.setResourceCount(1);
}
newVolumeLabel = generateDefaultVolumeLabel(volumeName, totalVolumeCount, numberOfVolumesInRequest);
// Grab the existing volume and task object from the incoming task list
Volume preCreatedVolume = StorageScheduler.getPrecreatedVolume(_dbClient, taskList, newVolumeLabel);
// Assemble a Replication Set; A Collection of volumes. One production, and any number of
// targets.
String rsetName = "RSet-" + newVolumeLabel;
// Increment total volume count
totalVolumeCount++;
// This name has to remain unique, especially when the number of volumes requested to be created
// is more than 1.
param.setName(newVolumeLabel);
Volume sourceVolume = null;
// /////// SOURCE ///////////
if (!isChangeVpoolForProtectedVolume) {
if (isChangeVpool) {
_log.info(String.format("Change Vpool, use existing Source Volume [%s].", changeVpoolVolume.getLabel()));
} else {
_log.info("Create RP Source Volume...");
}
// Create the source
sourceVolume = createRecoverPointVolume(sourceRec, newVolumeLabel, project, capabilities, consistencyGroup, param, protectionSystemURI, Volume.PersonalityTypes.SOURCE, rsetName, preCreatedVolume, null, taskList, task, sourceCopyName, descriptors, changeVpoolVolume, isChangeVpool, isSrcAndHaSwapped, true);
} else {
if (metroPointEnabled) {
_log.info("Upgrade to MetroPoint operation...");
// in the CG to reference the newly created stand-by journal.
for (Volume sourceVol : allSourceVolumesInCG) {
_log.info(String.format("Update the source volume [%s](%s) with new standby journal.", sourceVol.getLabel(), sourceVol.getId()));
// All RP+VPLEX Metro volumes in this CG need to have their backing volume
// references updated with the internal site names for exports.
setInternalSitesForSourceBackingVolumes(sourceRec, haRec, sourceVol, true, false, originalVpool.getHaVarrayConnectedToRp(), sourceCopyName, standbySourceCopyName);
// We need to have all the existing RP+VPLEX Metro volumes from the CG
// added to the volumeURI list so we can properly export the standby
// leg to RP for each volume.
volumeURIs.add(sourceVol.getId());
}
} else {
// NOTE: Upgrade to MetroPoint is (currently) the only supported Change Virtual Pool Protected
// operation, so if we have a null standby journal we're in real trouble.
_log.error("Error trying to upgrade to MetroPoint. Standby journal is null.");
throw APIException.badRequests.rpBlockApiImplPrepareVolumeException(newVolumeLabel);
}
// past this point.
break;
}
volumeURIs.add(sourceVolume.getId());
// NOTE: This is only needed for MetroPoint and Distributed RP+VPLEX(HA as RP source),
// nothing will happen for regular RP volumes.
//
// Source volumes need to have their backing volumes set with the correct internal
// site name. The reason for this is so we know later on where to export the volumes to.
//
// This is very evident with MetroPoint as we need to export BOTH sides of the VPLEX Distributed
// Volume.
//
// This is less evident with Distributed RP+VPLEX that has "HA as RP source" set.
// In this case we need to set it on the HA volume as that is the side to export (not the source
// side).
// To do this we need to pass in a hint...
// We need the (unswapped) original vpool and we then check the getHaVarrayConnectedToRp() value
// which tells us
// which side(varray) to export.
// This value will only be used if isSrcAndHaSwapped == true.
setInternalSitesForSourceBackingVolumes(sourceRec, haRec, sourceVolume, metroPointEnabled, isSrcAndHaSwapped, originalVpool.getHaVarrayConnectedToRp(), sourceCopyName, standbySourceCopyName);
// /////// TARGET(S) ///////////
List<URI> protectionTargets = new ArrayList<URI>();
for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
// Keep track of the targets created
protectionTargets.add(targetRec.getVirtualArray());
// Grab the target's varray
VirtualArray targetVirtualArray = _dbClient.queryObject(VirtualArray.class, targetRec.getVirtualArray());
_log.info(String.format("Create Target (%s)...", targetVirtualArray.getLabel()));
// to provision this target.
if (isChangeVpoolForProtectedVolume) {
Volume alreadyProvisionedTarget = RPHelper.findAlreadyProvisionedTargetVolume(changeVpoolVolume, targetRec.getVirtualArray(), _dbClient);
if (alreadyProvisionedTarget != null) {
_log.info(String.format("Existing target volume [%s] found for varray [%s].", alreadyProvisionedTarget.getLabel(), targetVirtualArray.getLabel()));
// No need to go further, continue on to the next target varray
continue;
}
}
// Generate target volume name
String targetVolumeName = new StringBuilder(newVolumeLabel).append(VOLUME_TYPE_TARGET + targetVirtualArray.getLabel()).toString();
// Create the target
Volume targetVolume = createRecoverPointVolume(targetRec, targetVolumeName, project, copyOfCapabilities, consistencyGroup, param, protectionSystemURI, Volume.PersonalityTypes.TARGET, rsetName, null, sourceVolume, taskList, task, targetRec.getRpCopyName(), descriptors, null, false, false, false);
volumeInfoBuffer.append(logVolumeInfo(targetVolume));
volumeURIs.add(targetVolume.getId());
}
// /////// METROPOINT LOCAL TARGET(S) ///////////
if (metroPointEnabled && haRec.getTargetRecommendations() != null && !haRec.getTargetRecommendations().isEmpty()) {
// then we need to create targets for the second (stand-by) leg.
for (RPRecommendation standbyTargetRec : haRec.getTargetRecommendations()) {
// Grab the MP target's varray
VirtualArray standyTargetVirtualArray = _dbClient.queryObject(VirtualArray.class, standbyTargetRec.getVirtualArray());
_log.info(String.format("Create Standby Target (%s)..", standyTargetVirtualArray.getLabel()));
// source recommendation.
if (protectionTargets.contains(standbyTargetRec.getVirtualArray())) {
continue;
}
// standby.
if (isChangeVpoolForProtectedVolume) {
Volume alreadyProvisionedTarget = RPHelper.findAlreadyProvisionedTargetVolume(changeVpoolVolume, standyTargetVirtualArray.getId(), _dbClient);
if (alreadyProvisionedTarget != null) {
_log.info(String.format("Existing target volume [%s] found for varray [%s].", alreadyProvisionedTarget.getLabel(), standyTargetVirtualArray.getLabel()));
// No need to go further, continue on to the next target varray
continue;
}
}
// Generate standby target label
String standbyTargetVolumeName = new StringBuilder(newVolumeLabel).append(VOLUME_TYPE_TARGET + standyTargetVirtualArray.getLabel()).toString();
// Create the standby target
Volume standbyTargetVolume = createRecoverPointVolume(standbyTargetRec, standbyTargetVolumeName, project, copyOfCapabilities, consistencyGroup, param, protectionSystemURI, Volume.PersonalityTypes.TARGET, rsetName, null, sourceVolume, taskList, task, standbyTargetRec.getRpCopyName(), descriptors, null, false, false, false);
volumeInfoBuffer.append(logVolumeInfo(standbyTargetVolume));
volumeURIs.add(standbyTargetVolume.getId());
}
}
// Hold off on logging the source volume until we're done creating the targets
volumeInfoBuffer.append(logVolumeInfo(sourceVolume));
}
}
volumeInfoBuffer.append(String.format(NEW_LINE));
_log.info(volumeInfoBuffer.toString());
}
}
}
use of com.emc.storageos.volumecontroller.RPRecommendation in project coprhd-controller by CoprHD.
the class PlacementTests method testPlacementRpVplexAdvancedSite1toSite2.
/**
* RP VPLEX placement -- placement decision based on RP array visibility
*/
@Test
public void testPlacementRpVplexAdvancedSite1toSite2() {
String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
String[] vplex2FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
String[] vplex2BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
String[] vplex3FE = { "FE:FE:FE:FE:FE:FE:FE:04", "FE:FE:FE:FE:FE:FE:FE:05" };
String[] vplex3BE = { "BE:BE:BE:BE:BE:BE:BE:04", "BE:BE:BE:BE:BE:BE:BE:05" };
// Create 3 Virtual Arrays
VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
VirtualArray varray3 = PlacementTestUtils.createVirtualArray(_dbClient, "varray3");
// Create 1 Network
StringSet connVA = new StringSet();
connVA.add(varray1.getId().toString());
connVA.add(varray2.getId().toString());
connVA.add(varray3.getId().toString());
Network network = PlacementTestUtils.createNetwork(_dbClient, vplex1FE, "VSAN", "FC+BROCADE", connVA);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex3FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex1BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex2BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex3BE);
PlacementTestUtils.addEndpoints(_dbClient, network, rp1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, rp2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax3FE);
// Create 3 storage systems
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
// Create two front-end storage ports VMAX1
List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1FE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network, vmax1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "C0+FC0" + i));
}
// Create two front-end storage ports VMAX2
List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax2FE.length; i++) {
vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network, vmax2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
}
// Create two front-end storage ports VMAX3
List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax3FE.length; i++) {
vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network, vmax3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
}
// Create 2 VPLEX storage systems
StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
StorageSystem vplexStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex2");
// Create two front-end storage ports VPLEX1
List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1FE.length; i++) {
fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
}
// Create two back-end storage ports VPLEX1
List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1BE.length; i++) {
bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
}
// Create two front-end storage ports VPLEX2
List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex2FE.length; i++) {
fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
}
// Create two back-end storage ports VPLEX2
List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex2BE.length; i++) {
bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2BE[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
}
// Create two front-end storage ports VPLEX3
List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex3FE.length; i++) {
fePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
}
// Create two back-end storage ports VPLEX3
List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex3BE.length; i++) {
bePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3BE[i], varray3, StoragePort.PortType.backend.name(), "portGroupBE3-" + (i + 1), "I0+FC0" + i));
}
// Create RP system
AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
for (int i = 0; i < rp1FE.length; i++) {
wwnSite1.add(rp1FE[i]);
}
StringSetMap initiatorsSiteMap = new StringSetMap();
initiatorsSiteMap.put("site1", wwnSite1);
AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
for (int i = 0; i < rp2FE.length; i++) {
wwnSite2.add(rp2FE[i]);
}
initiatorsSiteMap.put("site2", wwnSite2);
StringSet storSystems = new StringSet();
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster2"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster1"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster2"));
StringSetMap rpVisibleSystems = new StringSetMap();
StringSet storageIds = new StringSet();
storageIds.add(vplexStorageSystem1.getId().toString());
rpVisibleSystems.put("site1", storageIds);
StringSet storageIds2 = new StringSet();
storageIds2.add(vplexStorageSystem2.getId().toString());
rpVisibleSystems.put("site2", storageIds2);
StringMap siteVolCap = new StringMap();
siteVolCap.put("site1", "3221225472");
siteVolCap.put("site2", "3221225472");
StringMap siteVolCnt = new StringMap();
siteVolCnt.put("site1", "10");
siteVolCnt.put("site2", "10");
ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, rpVisibleSystems, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
// RP Site Array objects
RPSiteArray rpSiteArray1 = new RPSiteArray();
rpSiteArray1.setId(URI.create("rsa1"));
rpSiteArray1.setStorageSystem(URI.create("vplex1"));
rpSiteArray1.setRpInternalSiteName("site1");
rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray1);
RPSiteArray rpSiteArray2 = new RPSiteArray();
rpSiteArray2.setId(URI.create("rsa2"));
rpSiteArray2.setStorageSystem(URI.create("vplex2"));
rpSiteArray2.setRpInternalSiteName("site2");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
// Create a storage pool for vmax1
StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 50), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool pool7 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool7", "Pool7", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool pool8 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool8", "Pool8", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool pool9 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool9", "Pool9", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create HA virtual pool
VirtualPool haVpool = new VirtualPool();
haVpool.setId(URI.create(haVpoolUri));
haVpool.setLabel("haVpool");
haVpool.setType("block");
haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
haVpool.setDriveType(SupportedDriveTypes.FC.name());
StringSet matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
matchedPools.add(pool2.getId().toString());
matchedPools.add(pool3.getId().toString());
haVpool.setMatchedStoragePools(matchedPools);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(varray1.getId().toString());
haVpool.setVirtualArrays(virtualArrays1);
haVpool.setUseMatchedPools(true);
_dbClient.createObject(haVpool);
// Create RP target vpool
VirtualPool rpTgtVpool = new VirtualPool();
rpTgtVpool.setId(URI.create("rpTgtVpool"));
rpTgtVpool.setLabel("rpTgtVpool");
rpTgtVpool.setType("block");
rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
rpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
matchedPools = new StringSet();
matchedPools.add(pool7.getId().toString());
matchedPools.add(pool8.getId().toString());
matchedPools.add(pool9.getId().toString());
rpTgtVpool.setMatchedStoragePools(matchedPools);
rpTgtVpool.setUseMatchedPools(true);
StringSet virtualArrays3 = new StringSet();
virtualArrays3.add(varray3.getId().toString());
rpTgtVpool.setVirtualArrays(virtualArrays3);
_dbClient.createObject(rpTgtVpool);
// Create a RP VPLEX source virtual pool
VirtualPool rpVplexSrcVpool = new VirtualPool();
rpVplexSrcVpool.setId(URI.create(dummyVpoolUri));
rpVplexSrcVpool.setLabel("rpVplexSrcVpool");
rpVplexSrcVpool.setType("block");
rpVplexSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpVplexSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
rpVplexSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
StringMap vavpMap = new StringMap();
vavpMap.put(varray1.getId().toString(), haVpool.getId().toString());
rpVplexSrcVpool.setHaVarrayVpoolMap(vavpMap);
VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
protectionSettings.setVirtualPool(rpTgtVpool.getId());
protectionSettings.setId(URI.create("protectionSettings"));
_dbClient.createObject(protectionSettings);
List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
protectionSettingsList.add(protectionSettings);
StringMap protectionVarray = new StringMap();
protectionVarray.put(varray3.getId().toString(), protectionSettingsList.get(0).getId().toString());
rpVplexSrcVpool.setProtectionVarraySettings(protectionVarray);
rpVplexSrcVpool.setRpCopyMode("SYNCHRONOUS");
rpVplexSrcVpool.setRpRpoType("MINUTES");
rpVplexSrcVpool.setRpRpoValue(Long.valueOf("5"));
matchedPools = new StringSet();
matchedPools.add(pool4.getId().toString());
matchedPools.add(pool5.getId().toString());
matchedPools.add(pool6.getId().toString());
rpVplexSrcVpool.setMatchedStoragePools(matchedPools);
rpVplexSrcVpool.setUseMatchedPools(true);
StringSet virtualArrays2 = new StringSet();
virtualArrays2.add(varray2.getId().toString());
rpVplexSrcVpool.setVirtualArrays(virtualArrays2);
_dbClient.createObject(rpVplexSrcVpool);
// Create Tenant
TenantOrg tenant = new TenantOrg();
tenant.setId(URI.create("tenant"));
_dbClient.createObject(tenant);
// Create a project object
Project project = new Project();
project.setId(URI.create("project"));
project.setLabel("project");
project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
_dbClient.createObject(project);
// Create block consistency group
BlockConsistencyGroup cg = new BlockConsistencyGroup();
cg.setProject(new NamedURI(project.getId(), project.getLabel()));
cg.setId(URI.create("blockCG"));
_dbClient.createObject(cg);
// Create capabilities
VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, cg);
// Run single volume placement: Run 10 times to make sure pool6 never comes up for source and pool9 for target.
for (int i = 0; i < 10; i++) {
List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray2, project, rpVplexSrcVpool, capabilities);
assertNotNull(recommendations);
assertTrue(!recommendations.isEmpty());
assertNotNull(recommendations.get(0));
RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
assertNotNull(rec.getSourceRecommendations());
assertNotNull(!rec.getSourceRecommendations().isEmpty());
assertNotNull(rec.getProtectionDevice());
assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
for (RPRecommendation sourceRec : rec.getSourceRecommendations()) {
assertNotNull(sourceRec.getInternalSiteName());
assertNotNull(sourceRec.getVirtualArray());
assertNotNull(sourceRec.getVirtualPool());
assertNotNull(sourceRec.getVirtualVolumeRecommendation());
assertNotNull(sourceRec.getHaRecommendation());
assertNotNull(sourceRec.getTargetRecommendations());
assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
assertTrue("site1".equals(sourceRec.getInternalSiteName()));
assertTrue("vmax2".equals(sourceRec.getSourceStorageSystem().toString()));
assertTrue(("pool5".equals(sourceRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceRec.getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(sourceRec.getVirtualPool())) {
assertNotNull(sourceRec.getVirtualVolumeRecommendation());
}
assertNotNull(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation());
assertTrue("vplex1".equals(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue("varray1".equals(sourceRec.getHaRecommendation().getVirtualArray().toString()));
assertTrue(haVpoolUri.equals(sourceRec.getHaRecommendation().getVirtualPool().getId().toString()));
assertTrue("vmax1".equals(sourceRec.getHaRecommendation().getSourceStorageSystem().toString()));
assertTrue(("pool2".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())));
assertNotNull(sourceRec.getTargetRecommendations());
assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
assertNotNull(targetRec.getInternalSiteName());
assertNotNull(targetRec.getVirtualArray());
assertNotNull(targetRec.getVirtualPool());
if (VirtualPool.vPoolSpecifiesHighAvailability(targetRec.getVirtualPool())) {
assertNotNull(targetRec.getVirtualVolumeRecommendation());
}
assertTrue("varray3".equals(targetRec.getVirtualArray().toString()));
assertTrue(rpTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
assertTrue("site2".equals(targetRec.getInternalSiteName()));
assertTrue("vmax3".equals(targetRec.getSourceStorageSystem().toString()));
assertTrue(("pool8".equals(targetRec.getSourceStoragePool().toString())) || ("pool7".equals(targetRec.getSourceStoragePool().toString())));
}
}
// source journal
assertNotNull(rec.getSourceJournalRecommendation());
RPRecommendation sourceJournalRec = rec.getSourceJournalRecommendation();
if (VirtualPool.vPoolSpecifiesHighAvailability(sourceJournalRec.getVirtualPool())) {
assertNotNull(sourceJournalRec.getVirtualVolumeRecommendation());
}
assertTrue(("pool5".equals(sourceJournalRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceJournalRec.getSourceStoragePool().toString())));
// target journals
assertNotNull(rec.getTargetJournalRecommendations());
assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec.getInternalSiteName());
assertNotNull(targetJournalRec.getVirtualArray());
assertNotNull(targetJournalRec.getVirtualPool());
if (VirtualPool.vPoolSpecifiesHighAvailability(targetJournalRec.getVirtualPool())) {
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
}
assertTrue("vmax3".equals(targetJournalRec.getSourceStorageSystem().toString()));
assertTrue(("pool8".equals(targetJournalRec.getSourceStoragePool().toString())) || ("pool7".equals(targetJournalRec.getSourceStoragePool().toString())));
}
_log.info("Recommendation : " + rec.toString(_dbClient));
}
}
use of com.emc.storageos.volumecontroller.RPRecommendation in project coprhd-controller by CoprHD.
the class PlacementTests method testBasicRPPlacement2.
/**
* Simple block placement with RP
* Basic RP Placement test - VMAX
* In this test, Pool1 from VMAX1 and Pool3 from VMAX3 are available as candidates for source and source journal.
* However, Pool3 doesnt have connectivity to the RP site and should not be chosen.
* Placement also should not fail here, and Pool1 should be chosen for both source and its journal.
*/
@Test
public void testBasicRPPlacement2() {
String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
String[] vmax3FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
String[] rp1FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
String[] rp2FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
// Create 2 Virtual Arrays
VirtualArray rpSrcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpSrcVarray");
VirtualArray rpTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpTgtVarray");
// Create 2 Networks
StringSet connVA = new StringSet();
connVA.add(rpSrcVarray.getId().toString());
Network network1 = PlacementTestUtils.createNetwork(_dbClient, rp1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
connVA = new StringSet();
connVA.add(rpTgtVarray.getId().toString());
Network network2 = PlacementTestUtils.createNetwork(_dbClient, rp2FE, "VSANSite2", "FC+CISCO+FE", connVA);
// Create 2 storage systems
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
// Create two front-end storage ports VMAX1
List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1FE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network1, vmax1FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite1vmax" + i, "C0+FC0" + i));
}
// Create two front-end storage ports VMAX2
List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax2FE.length; i++) {
vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network2, vmax2FE[i], rpTgtVarray, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+FC0" + i));
}
// Create two front-end storage ports VMAX3
List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax3FE.length; i++) {
vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network1, vmax3FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite3vmax" + i, "E0+FC0" + i));
}
// Create RP system
AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
for (int i = 0; i < rp1FE.length; i++) {
wwnSite1.add(rp1FE[i]);
}
StringSetMap initiatorsSiteMap = new StringSetMap();
initiatorsSiteMap.put("site1", wwnSite1);
AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
for (int i = 0; i < rp2FE.length; i++) {
wwnSite2.add(rp2FE[i]);
}
initiatorsSiteMap.put("site2", wwnSite2);
StringSet storSystems = new StringSet();
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem1.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem2.getSerialNumber()));
StringMap siteVolCap = new StringMap();
siteVolCap.put("site1", "3221225472");
siteVolCap.put("site2", "3221225472");
StringMap siteVolCnt = new StringMap();
siteVolCnt.put("site1", "10");
siteVolCnt.put("site2", "10");
ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, null, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
// RP Site Array objects
RPSiteArray rpSiteArray1 = new RPSiteArray();
rpSiteArray1.setId(URI.create("rsa1"));
rpSiteArray1.setStorageSystem(URI.create("vmax1"));
rpSiteArray1.setRpInternalSiteName("site1");
rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray1);
RPSiteArray rpSiteArray2 = new RPSiteArray();
rpSiteArray2.setId(URI.create("rsa2"));
rpSiteArray2.setStorageSystem(URI.create("vmax2"));
rpSiteArray2.setRpInternalSiteName("site2");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
// Create a storage pool for vmax1
StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool2", "Pool2", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem3, "pool3", "Pool3", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool6", "Pool6", Long.valueOf(SIZE_GB * 1), Long.valueOf(SIZE_GB * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a virtual pool
VirtualPool rpTgtVpool = new VirtualPool();
rpTgtVpool.setId(URI.create("rpTgtVpool"));
rpTgtVpool.setLabel("RP Target Vpool");
rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
StringSet matchedPools = new StringSet();
matchedPools.add(pool4.getId().toString());
matchedPools.add(pool5.getId().toString());
matchedPools.add(pool6.getId().toString());
rpTgtVpool.setMatchedStoragePools(matchedPools);
rpTgtVpool.setUseMatchedPools(true);
StringSet virtualArrays2 = new StringSet();
virtualArrays2.add(rpTgtVarray.getId().toString());
rpTgtVpool.setVirtualArrays(virtualArrays2);
_dbClient.createObject(rpTgtVpool);
// Create a RP virtual pool
VirtualPool rpSrcVpool = new VirtualPool();
rpSrcVpool.setId(URI.create("rpSrcVpool"));
rpSrcVpool.setLabel("RP Source Vpool");
rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
protectionSettings.setVirtualPool(rpTgtVpool.getId());
protectionSettings.setId(URI.create("protectionSettings"));
_dbClient.createObject(protectionSettings);
List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
protectionSettingsList.add(protectionSettings);
StringMap protectionVarray = new StringMap();
protectionVarray.put(rpTgtVarray.getId().toString(), protectionSettingsList.get(0).getId().toString());
rpSrcVpool.setProtectionVarraySettings(protectionVarray);
rpSrcVpool.setRpCopyMode("SYNCHRONOUS");
rpSrcVpool.setRpRpoType("MINUTES");
rpSrcVpool.setRpRpoValue(Long.valueOf("5"));
matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
// matchedPools.add(pool2.getId().toString());
matchedPools.add(pool3.getId().toString());
rpSrcVpool.setMatchedStoragePools(matchedPools);
rpSrcVpool.setUseMatchedPools(true);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(rpSrcVarray.getId().toString());
rpSrcVpool.setVirtualArrays(virtualArrays1);
_dbClient.createObject(rpSrcVpool);
// Create Tenant
TenantOrg tenant = new TenantOrg();
tenant.setId(URI.create("tenant"));
_dbClient.createObject(tenant);
// Create a project object
Project project = new Project();
project.setId(URI.create("project"));
project.setLabel("project");
project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
_dbClient.createObject(project);
// Create block consistency group
BlockConsistencyGroup cg = new BlockConsistencyGroup();
cg.setProject(new NamedURI(project.getId(), project.getLabel()));
cg.setId(URI.create("blockCG"));
_dbClient.createObject(cg);
// Create capabilities
VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, cg);
// Run single volume placement: Run 10 times to make sure pool3 never comes up for source and pool6 for target.
for (int i = 0; i < 10; i++) {
List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, rpSrcVarray, project, rpSrcVpool, capabilities);
assertNotNull(recommendations);
assertTrue(!recommendations.isEmpty());
assertNotNull(recommendations.get(0));
RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
assertNotNull(rec.getSourceRecommendations());
assertTrue(!rec.getSourceRecommendations().isEmpty());
assertNotNull(rec.getProtectionDevice());
assertNotNull(rec.getPlacementStepsCompleted().name());
assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
for (RPRecommendation rpRec : rec.getSourceRecommendations()) {
assertNotNull(rpRec.getInternalSiteName());
assertNotNull(rpRec.getSourceStorageSystem());
assertNotNull(rpRec.getSourceStoragePool());
assertTrue("site1".equals(rpRec.getInternalSiteName()));
assertTrue("vmax1".equals(rpRec.getSourceStorageSystem().toString()));
assertTrue(("pool2".equals(rpRec.getSourceStoragePool().toString())) || ("pool1".equals(rpRec.getSourceStoragePool().toString())));
assertNotNull(rpRec.getTargetRecommendations());
assertTrue(!rpRec.getTargetRecommendations().isEmpty());
for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
assertNotNull(targetRec.getSourceStoragePool());
assertTrue("vmax2".equals(targetRec.getSourceStorageSystem().toString()));
assertTrue("site2".equals(targetRec.getInternalSiteName()));
assertTrue("pool5".equals(targetRec.getSourceStoragePool().toString()) || "pool4".equals(targetRec.getSourceStoragePool().toString()));
}
}
// source journal
assertNotNull(rec.getSourceJournalRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
assertTrue(("pool2".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
// target journal
assertNotNull(rec.getTargetJournalRecommendations());
assertNotNull(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec.getSourceStoragePool());
assertTrue("pool5".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool4".equals(targetJournalRec.getSourceStoragePool().toString()));
assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
assertTrue("vmax2".equals(targetJournalRec.getSourceStorageSystem().toString()));
}
_log.info(rec.toString(_dbClient));
}
}
use of com.emc.storageos.volumecontroller.RPRecommendation in project coprhd-controller by CoprHD.
the class PlacementTests method testRpVplexConnectivtyAndPlacement.
/**
* RP VPLEX connectivity with only the vplex is visible to the rpsites
*/
@Test
public void testRpVplexConnectivtyAndPlacement() {
// Create Tenant
TenantOrg tenant = new TenantOrg();
tenant.setId(URI.create("tenant"));
_dbClient.createObject(tenant);
// Create a project object
Project project = new Project();
project.setId(URI.create("project"));
project.setLabel("project");
project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
_dbClient.createObject(project);
// Create block consistency group
BlockConsistencyGroup cg = new BlockConsistencyGroup();
cg.setProject(new NamedURI(project.getId(), project.getLabel()));
cg.setId(URI.create("blockCG"));
_dbClient.createObject(cg);
// Create capabilities
VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("5GB", 4, cg);
StringMap siteVolCap = new StringMap();
siteVolCap.put("site1", "3221225472");
siteVolCap.put("site2", "3221225472");
StringMap siteVolCnt = new StringMap();
siteVolCnt.put("site1", "10");
siteVolCnt.put("site2", "10");
String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
// Create Virtual Array1
VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
// Create 2 Networks
StringSet connVA = new StringSet();
connVA.add(varray1.getId().toString());
Network networkFE1 = PlacementTestUtils.createNetwork(_dbClient, (String[]) ArrayUtils.addAll(vplex1FE, rp1FE), "VSANFE1", "FC+BROCADE+FE", connVA);
Network networkBE1 = PlacementTestUtils.createNetwork(_dbClient, vplex1BE, "VSANBE1", "FC+BROCADE+BE", connVA);
// Create storage system
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
// Create two front-end storage ports VMAX1
List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1FE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, networkBE1, vmax1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "C0+FC0" + i));
}
// Create VPLEX storage system
StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
// Create two front-end storage ports VPLEX1
List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1FE.length; i++) {
fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, networkFE1, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
}
// Create two back-end storage ports VPLEX1
List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1BE.length; i++) {
bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, networkBE1, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
}
// Create RP system
AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
for (int i = 0; i < rp1FE.length; i++) {
wwnSite1.add(rp1FE[i]);
}
StringSetMap initiatorsSiteMap = new StringSetMap();
initiatorsSiteMap.put("site1", wwnSite1);
AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
for (int i = 0; i < rp2FE.length; i++) {
wwnSite2.add(rp2FE[i]);
}
initiatorsSiteMap.put("site2", wwnSite2);
StringSet storSystems = new StringSet();
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex1cluster1"));
ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, null, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
// RP Site Array objects
RPSiteArray rpSiteArray1 = new RPSiteArray();
rpSiteArray1.setId(URI.create("rsa1"));
rpSiteArray1.setStorageSystem(URI.create("vplex1"));
rpSiteArray1.setRpInternalSiteName("site1");
rpSiteArray1.setRpSiteName("site1");
rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray1);
RPSiteArray rpSiteArray2 = new RPSiteArray();
rpSiteArray2.setId(URI.create("rsa2"));
rpSiteArray2.setStorageSystem(URI.create("vplex1"));
rpSiteArray2.setRpInternalSiteName("site2");
rpSiteArray2.setRpSiteName("site2");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
ConnectivityUtil.updateRpSystemConnectivity(rpSystem, _dbClient);
StringSet virtualArrays = rpSystem.getVirtualArrays();
assertNotNull(virtualArrays);
assertTrue(!virtualArrays.isEmpty());
for (String varrayURIStr : virtualArrays) {
_log.info("Protection is possible to Virtual Array: " + varrayURIStr);
}
// Create a storage pool for vmax1
StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 500), Long.valueOf(SIZE_GB * 500), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a base RP virtual pool
VirtualPool tgtVpool = new VirtualPool();
tgtVpool.setId(URI.create("vpoolRP"));
tgtVpool.setLabel("vpoolRP");
tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
tgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
StringSet matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
tgtVpool.setMatchedStoragePools(matchedPools);
tgtVpool.setUseMatchedPools(true);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(varray1.getId().toString());
tgtVpool.setVirtualArrays(virtualArrays1);
_dbClient.createObject(tgtVpool);
// Create a RP VPLEX virtual pool
VirtualPool rpSrcVpool = new VirtualPool();
rpSrcVpool.setId(URI.create("rpVplexVpool"));
rpSrcVpool.setLabel("rpVplexVpool");
rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
rpSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
rpSrcVpool.setJournalSize("10GB");
VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
protectionSettings.setVirtualPool(tgtVpool.getId());
protectionSettings.setJournalSize("10GB");
protectionSettings.setId(URI.create("protectionSettings"));
_dbClient.createObject(protectionSettings);
List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
protectionSettingsList.add(protectionSettings);
StringMap protectionVarray = new StringMap();
protectionVarray.put(varray1.getId().toString(), protectionSettingsList.get(0).getId().toString());
rpSrcVpool.setProtectionVarraySettings(protectionVarray);
rpSrcVpool.setRpCopyMode("SYNCHRONOUS");
rpSrcVpool.setRpRpoType("MINUTES");
rpSrcVpool.setRpRpoValue(Long.valueOf("5"));
matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
rpSrcVpool.setMatchedStoragePools(matchedPools);
rpSrcVpool.setUseMatchedPools(true);
StringSet virtualArrays2 = new StringSet();
virtualArrays2.add(varray1.getId().toString());
rpSrcVpool.setVirtualArrays(virtualArrays2);
_dbClient.createObject(rpSrcVpool);
List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray1, project, rpSrcVpool, capabilities);
assertNotNull(recommendations);
assertTrue(!recommendations.isEmpty());
assertNotNull(recommendations.get(0));
RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
for (RPRecommendation rpVplexRec : rec.getSourceRecommendations()) {
assertNotNull(rpVplexRec.getVirtualVolumeRecommendation());
assertNotNull(rpVplexRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertNotNull(rpVplexRec.getSourceStoragePool());
assertNotNull(rpVplexRec.getSourceStorageSystem());
assertNotNull(rpVplexRec.getTargetRecommendations());
assertTrue(!rpVplexRec.getTargetRecommendations().isEmpty());
assertNotNull(rpVplexRec.getInternalSiteName());
assertTrue("site1".equals(rpVplexRec.getInternalSiteName()));
assertTrue("vmax1".equals(rpVplexRec.getSourceStorageSystem().toString()));
assertTrue(("pool1".equals(rpVplexRec.getSourceStoragePool().toString())));
assertTrue("vplex1".equals(rpVplexRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
for (RPRecommendation targetRec : rpVplexRec.getTargetRecommendations()) {
assertNotNull(targetRec.getSourceStoragePool());
assertNotNull(targetRec.getInternalSiteName());
assertNotNull(targetRec.getSourceStorageSystem());
assertNotNull(targetRec.getVirtualPool());
assertTrue("vpoolRP".equals(targetRec.getVirtualPool().getId().toString()));
assertTrue("varray1".equals(targetRec.getVirtualArray().toString()));
assertTrue("site1".equals(targetRec.getInternalSiteName()));
assertTrue("vplex1".equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue("vmax1".equals(targetRec.getSourceStorageSystem().toString()));
assertTrue(("pool1".equals(targetRec.getSourceStoragePool().toString())));
}
}
assertNotNull(rec.getSourceJournalRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStorageSystem());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
if (rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation() != null) {
assertTrue("vplex1".equals(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
}
assertTrue("site1".equals(rec.getSourceJournalRecommendation().getInternalSiteName().toString()));
assertTrue(("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
assertNotNull(rec.getTargetJournalRecommendations());
assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec.getVirtualArray());
assertNotNull(targetJournalRec.getInternalSiteName());
assertNotNull(targetJournalRec.getSourceStorageSystem());
assertNotNull(targetJournalRec.getSourceStoragePool());
assertTrue("varray1".equals(targetJournalRec.getVirtualArray().toString()));
assertTrue("vmax1".equals(targetJournalRec.getSourceStorageSystem().toString()));
assertTrue("site1".equals(targetJournalRec.getInternalSiteName().toString()));
assertTrue(("pool1".equals(targetJournalRec.getSourceStoragePool().toString())));
assertTrue("vplex1".equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
}
_log.info(rec.toString(_dbClient));
}
Aggregations