use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class FileSnapshotService method share.
/**
* Creates SMB file share.
* <p>
* Note: This is an asynchronous operation.
*
* @param id
* the URN of a ViPR Snapshot
* @param param
* File system share parameters
* @brief Create file snapshot SMB share
* @return Task resource representation
* @throws InternalException
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/shares")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.ANY })
public TaskResourceRep share(@PathParam("id") URI id, FileSystemShareParam param) throws InternalException {
String task = UUID.randomUUID().toString();
ArgValidator.checkFieldUriType(id, Snapshot.class, "id");
ArgValidator.checkFieldNotNull(param.getShareName(), "name");
ArgValidator.checkFieldNotEmpty(param.getShareName(), "name");
Snapshot snap = queryResource(id);
FileShare fs = _permissionsHelper.getObjectById(snap.getParent(), FileShare.class);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, fs.getStorageDevice());
FileController controller = getController(FileController.class, device.getSystemType());
ArgValidator.checkEntity(snap, id, isIdEmbeddedInURL(id));
// Let us make sure that a share with the same name does not already exist.
String shareName = param.getShareName();
if (CifsShareUtility.doesShareExist(snap, shareName)) {
_log.error("CIFS share: {}, already exists", shareName);
throw APIException.badRequests.duplicateEntityWithField("CIFS share", "name");
}
// If value of permission is not provided, set the value to read-only
if (param.getPermission() == null || param.getPermission().isEmpty()) {
param.setPermission(FileSMBShare.Permission.read.name());
}
if (!param.getPermission().equals(FileSMBShare.Permission.read.name())) {
throw APIException.badRequests.snapshotSMBSharePermissionReadOnly();
}
// Locate storage port for sharing snapshot
// Select IP port of the storage array, owning the parent file system, which belongs to the same varray as the
// file system.
// We use file system in the call since file snap belongs to the same neighbourhood as its parent file system
StoragePort sport = _fileScheduler.placeFileShareExport(fs, StorageProtocol.File.CIFS.name(), null);
// Check if maxUsers is "unlimited" and set it to -1 in this case.
if (param.getMaxUsers().equalsIgnoreCase(FileService.UNLIMITED_USERS)) {
param.setMaxUsers("-1");
}
String path = snap.getPath();
_log.info("Path {}", path);
_log.info("Param Share Name : {} SubDirectory : {}", param.getShareName(), param.getSubDirectory());
boolean isSubDirPath = false;
if (ArgValidator.checkSubDirName("subDirectory", param.getSubDirectory())) {
path += "/" + param.getSubDirectory();
isSubDirPath = true;
_log.info("Sub-directory path {}", path);
}
FileSMBShare smbShare = new FileSMBShare(param.getShareName(), param.getDescription(), param.getPermissionType(), param.getPermission(), param.getMaxUsers(), null, path);
smbShare.setStoragePortName(sport.getPortName());
smbShare.setStoragePortNetworkId(sport.getPortNetworkId());
smbShare.setStoragePortGroup(sport.getPortGroup());
smbShare.setSubDirPath(isSubDirPath);
_log.info(String.format("Create snapshot share --- Snap id: %1$s, Share name: %2$s, StoragePort: %3$s, PermissionType: %4$s, " + "Permissions: %5$s, Description: %6$s, maxUsers: %7$s", id, smbShare.getName(), sport.getPortName(), smbShare.getPermissionType(), smbShare.getPermission(), smbShare.getDescription(), smbShare.getMaxUsers()));
_log.info("SMB share path: {}", smbShare.getPath());
Operation op = _dbClient.createTaskOpStatus(Snapshot.class, snap.getId(), task, ResourceOperationTypeEnum.CREATE_FILE_SNAPSHOT_SHARE);
FileServiceApi fileServiceApi = FileService.getFileShareServiceImpl(fs, _dbClient);
fileServiceApi.share(device.getId(), snap.getId(), smbShare, task);
auditOp(OperationTypeEnum.CREATE_FILE_SNAPSHOT_SHARE, true, AuditLogManager.AUDITOP_BEGIN, smbShare.getName(), smbShare.getPermissionType(), smbShare.getPermission(), smbShare.getMaxUsers(), smbShare.getDescription(), snap.getId().toString());
return toTask(snap, task, op);
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class ExportGroupService method validatePathAdjustment.
/**
* Validate the path adjustment request parameters
*
* @param exportGroup ExportGroup object
* @param system StorageSystem object
* @param param Export Path Adjustment Parameters
* @param varray URI of the virtual array, used to check any supplied ports are in correct varray
*/
private void validatePathAdjustment(ExportGroup exportGroup, StorageSystem system, ExportPathsAdjustmentParam param, URI varray) {
String systemType = system.getSystemType();
if (!Type.vmax.name().equalsIgnoreCase(systemType) && !Type.vplex.name().equalsIgnoreCase(systemType)) {
throw APIException.badRequests.exportPathAdjustmentSystemNotSupported(systemType);
}
List<ExportMask> exportMasks = ExportMaskUtils.getExportMasks(_dbClient, exportGroup, system.getId());
if (exportMasks.isEmpty()) {
throw APIException.badRequests.exportPathAdjustmentSystemExportGroupNotMatch(exportGroup.getLabel(), system.getNativeGuid());
}
ExportPathParameters pathParam = param.getExportPathParameters();
if (pathParam == null) {
throw APIException.badRequests.exportPathAdjustementNoPathParameters();
}
URI pgURI = pathParam.getPortGroup();
// Check if exportMask has existing volumes, if it does, make sure no remove paths.
for (ExportMask exportMask : exportMasks) {
List<InitiatorPathParam> removePaths = param.getRemovedPaths();
if (removePaths.isEmpty() || !exportMask.hasAnyExistingVolumes()) {
continue;
}
Map<URI, List<URI>> removes = new HashMap<URI, List<URI>>();
for (InitiatorPathParam initPath : removePaths) {
removes.put(initPath.getInitiator(), initPath.getStoragePorts());
}
Map<URI, List<URI>> removedPathForMask = ExportMaskUtils.getRemovePathsForExportMask(exportMask, removes);
if (removedPathForMask != null && !removedPathForMask.isEmpty() && pgURI == null) {
_log.error("It has removed path for the ExportMask with existing volumes: " + exportMask.getMaskName());
throw APIException.badRequests.externallyAddedVolumes(exportMask.getMaskName(), exportMask.getExistingVolumes().toString());
}
}
// check adjusted paths are valid. initiators are in the export group, and the targets are in the storage system, and
// in valid state.
Map<URI, List<URI>> adjustedPaths = convertInitiatorPathParamToMap(param.getAdjustedPaths());
List<URI> pathInitiatorURIs = new ArrayList<URI>(adjustedPaths.keySet());
StringSet initiatorIds = exportGroup.getInitiators();
if (!initiatorIds.containsAll(StringSetUtil.uriListToStringSet(pathInitiatorURIs))) {
// Determine all the host URIs for the egInitiators
Set<URI> egHostURIs = new HashSet<URI>();
List<Initiator> egInitiators = ExportUtils.getExportGroupInitiators(exportGroup, _dbClient);
for (Initiator egInitiator : egInitiators) {
if (!NullColumnValueGetter.isNullURI(egInitiator.getHost())) {
egHostURIs.add(egInitiator.getHost());
}
}
// Now, only throw error if there are initiators that are not of any of the egHostURIs
List<Initiator> pathInitiators = _dbClient.queryObject(Initiator.class, pathInitiatorURIs);
List<String> badInitiators = new ArrayList<String>();
for (Initiator pathInitiator : pathInitiators) {
// Bad if not in the EG initiatorIds AND not from an identifiable host or not from a host in EG
if (!initiatorIds.contains(pathInitiator.getId().toString())) {
if (pathInitiator.getHost() == null || !egHostURIs.contains(pathInitiator.getHost())) {
badInitiators.add(pathInitiator.getHostName() + "-" + pathInitiator.getInitiatorPort());
}
}
}
if (!badInitiators.isEmpty()) {
throw APIException.badRequests.exportPathAdjustmentAdjustedPathNotValid(Joiner.on(", ").join(badInitiators));
}
}
Set<URI> pathTargets = new HashSet<URI>();
for (List<URI> targets : adjustedPaths.values()) {
pathTargets.addAll(targets);
}
Set<URI> systemPorts = new HashSet<URI>();
URIQueryResultList storagePortURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(system.getId()), storagePortURIs);
// Validate the targets to be provisioned have a valid state (COMPATIBLE, REGISTERED, and VISIBLE) and
// that their tagged virtual array contains our varray.
List<StoragePort> storagePorts = _dbClient.queryObject(StoragePort.class, storagePortURIs);
for (StoragePort port : storagePorts) {
if (!port.getInactive() && port.getCompatibilityStatus().equals(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name()) && port.getRegistrationStatus().equals(StoragePort.RegistrationStatus.REGISTERED.name()) && port.getDiscoveryStatus().equals(DiscoveryStatus.VISIBLE.name()) && port.getTaggedVirtualArrays() != null && port.getTaggedVirtualArrays().contains(varray.toString())) {
systemPorts.add(port.getId());
}
}
if (!systemPorts.containsAll(pathTargets)) {
// List only the invalid targets
pathTargets.removeAll(systemPorts);
throw APIException.badRequests.exportPathAdjustmentAdjustedPathNotValid(Joiner.on(",").join(pathTargets));
}
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class ExportGroupService method validateExportPathParmPorts.
/**
* Validate that if ports are supplied in the ExportPathParameters, then ports are supplied
* for every array in the list of volumes to be provisioned. Also verify
* the ports can be located, and there are at least as many ports as maxPaths.
*
* @param param ExportPathParameters block
* @param exportGroup
* @param StorageArrays Collection<URI> Arrays that will be used for the Exports
*/
private void validateExportPathParmPorts(ExportPathParameters param, ExportGroup exportGroup, Collection<URI> storageArrays) {
if (param.getClass() == null || param.getStoragePorts() == null || param.getStoragePorts().isEmpty()) {
return;
}
// Get database entries for all the ports in a map of array URI to set of StoragePort.
Map<URI, Set<StoragePort>> arrayToStoragePorts = new HashMap<URI, Set<StoragePort>>();
for (URI portURI : param.getStoragePorts()) {
StoragePort port = _dbClient.queryObject(StoragePort.class, portURI);
ArgValidator.checkEntityNotNull(port, portURI, false);
URI arrayURI = port.getStorageDevice();
if (!arrayToStoragePorts.containsKey(arrayURI)) {
arrayToStoragePorts.put(arrayURI, new HashSet<StoragePort>());
}
arrayToStoragePorts.get(arrayURI).add(port);
}
// Check that there are entries for all the arrays used by the volumes.
for (URI storageArray : storageArrays) {
if (!arrayToStoragePorts.containsKey(storageArray)) {
throw APIException.badRequests.pathParameterPortsDoNotIncludeArray(storageArray);
}
}
// Now check that each array has at least maxpaths number of ports supplied.
for (Map.Entry<URI, Set<StoragePort>> entry : arrayToStoragePorts.entrySet()) {
if (entry.getValue().size() < param.getMaxPaths()) {
throw APIException.badRequests.notEnoughPortsForMaxpath(entry.getKey(), entry.getValue().size(), param.getMaxPaths());
}
}
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class PlacementTests method testPlacementRpXIONoVplex.
/**
* RP placement tests with XIO (no VPLEX)
*/
@Test
public void testPlacementRpXIONoVplex() {
String[] xio1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] xio2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
String[] xio3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
String[] xio4FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
String[] xio5FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
String[] xio6FE = { "55:FE:FE:FE:FE:FE:FE:00", "55:FE:FE:FE:FE:FE:FE:01" };
String[] rp1FE = { "56:FE:FE:FE:FE:FE:FE:00", "56:FE:FE:FE:FE:FE:FE:01" };
String[] rp2FE = { "57:FE:FE:FE:FE:FE:FE:00", "57:FE:FE:FE:FE:FE:FE:01" };
// Create 2 Virtual Arrays
VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
// Create 2 Networks
StringSet connVA = new StringSet();
connVA.add(varray1.getId().toString());
Network network1 = PlacementTestUtils.createNetwork(_dbClient, rp1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
connVA = new StringSet();
connVA.add(varray2.getId().toString());
Network network2 = PlacementTestUtils.createNetwork(_dbClient, rp2FE, "VSANSite2", "FC+CISCO+FE", connVA);
// Create 6 storage systems
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio1");
StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio2");
StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio3");
StorageSystem storageSystem4 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio4");
StorageSystem storageSystem5 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio5");
StorageSystem storageSystem6 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio6");
// Create two front-end storage ports XIO1
List<StoragePort> xio1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio1FE.length; i++) {
xio1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network1, xio1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio1" + i, "C0+FC0" + i));
}
// Create two front-end storage ports XIO2
List<StoragePort> xio2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio2FE.length; i++) {
xio2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network1, xio2FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio2" + i, "D0+FC0" + i));
}
// Create two front-end storage ports XIO3
List<StoragePort> xio3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio3FE.length; i++) {
xio3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network1, xio3FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio3" + i, "E0+FC0" + i));
}
// Create two front-end storage ports XIO4
List<StoragePort> xio4Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio4FE.length; i++) {
xio4Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem4, network2, xio4FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio4" + i, "F0+FC0" + i));
}
// Create two front-end storage ports XIO5
List<StoragePort> xio5Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio5FE.length; i++) {
xio5Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem5, network2, xio5FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio5" + i, "G0+FC0" + i));
}
// Create two front-end storage ports XIO6
List<StoragePort> xio6Ports = new ArrayList<StoragePort>();
for (int i = 0; i < xio6FE.length; i++) {
xio6Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem6, network2, xio6FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio6" + i, "H0+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("site1", storageSystem2.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem3.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem4.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem5.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem6.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("xtremio1"));
rpSiteArray1.setRpInternalSiteName("site1");
rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray1);
RPSiteArray rpSiteArray2 = new RPSiteArray();
rpSiteArray2.setId(URI.create("rsa2"));
rpSiteArray2.setStorageSystem(URI.create("xtremio2"));
rpSiteArray2.setRpInternalSiteName("site1");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
RPSiteArray rpSiteArray3 = new RPSiteArray();
rpSiteArray3.setId(URI.create("rsa3"));
rpSiteArray3.setStorageSystem(URI.create("xtremio3"));
rpSiteArray3.setRpInternalSiteName("site1");
rpSiteArray3.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray3);
RPSiteArray rpSiteArray4 = new RPSiteArray();
rpSiteArray4.setId(URI.create("rsa4"));
rpSiteArray4.setStorageSystem(URI.create("xtremio4"));
rpSiteArray4.setRpInternalSiteName("site2");
rpSiteArray4.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray4);
RPSiteArray rpSiteArray5 = new RPSiteArray();
rpSiteArray5.setId(URI.create("rsa5"));
rpSiteArray5.setStorageSystem(URI.create("xtremio5"));
rpSiteArray5.setRpInternalSiteName("site2");
rpSiteArray5.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray5);
RPSiteArray rpSiteArray6 = new RPSiteArray();
rpSiteArray6.setId(URI.create("rsa6"));
rpSiteArray6.setStorageSystem(URI.create("xtremio6"));
rpSiteArray6.setRpInternalSiteName("site2");
rpSiteArray6.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray6);
// Create a storage pool for xio1
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 xio2
StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem2, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for xio3
StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem3, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for xio4
StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem4, "pool4", "Pool4", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for xio5
StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem5, "pool5", "Pool5", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for xio6
StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem6, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a RP virtual pool
VirtualPool rpVpool = new VirtualPool();
rpVpool.setId(URI.create("rpVpool"));
rpVpool.setLabel("rpVpool");
rpVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpVpool.setDriveType(SupportedDriveTypes.FC.name());
VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
protectionSettings.setVirtualPool(URI.create("vpool"));
protectionSettings.setId(URI.create("protectionSettings"));
_dbClient.createObject(protectionSettings);
List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
protectionSettingsList.add(protectionSettings);
StringMap protectionVarray = new StringMap();
protectionVarray.put(varray2.getId().toString(), protectionSettingsList.get(0).getId().toString());
rpVpool.setProtectionVarraySettings(protectionVarray);
rpVpool.setRpCopyMode("SYNCHRONOUS");
rpVpool.setRpRpoType("MINUTES");
rpVpool.setRpRpoValue(Long.valueOf("5"));
StringSet matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
matchedPools.add(pool2.getId().toString());
matchedPools.add(pool3.getId().toString());
rpVpool.setMatchedStoragePools(matchedPools);
rpVpool.setUseMatchedPools(true);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(varray1.getId().toString());
rpVpool.setVirtualArrays(virtualArrays1);
_dbClient.createObject(rpVpool);
// Create a virtual pool
VirtualPool vpool = new VirtualPool();
vpool.setId(URI.create("vpool"));
vpool.setLabel("vpool");
vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
vpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(pool4.getId().toString());
matchedPools.add(pool5.getId().toString());
matchedPools.add(pool6.getId().toString());
vpool.setMatchedStoragePools(matchedPools);
vpool.setUseMatchedPools(true);
StringSet virtualArrays2 = new StringSet();
virtualArrays2.add(varray2.getId().toString());
vpool.setVirtualArrays(virtualArrays2);
_dbClient.createObject(vpool);
// 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, varray1, project, rpVpool, 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 sourceRec : rec.getSourceRecommendations()) {
assertNotNull(sourceRec);
assertNotNull(sourceRec.getInternalSiteName());
assertNotNull(sourceRec.getSourceStorageSystem());
assertNotNull(sourceRec.getSourceStoragePool());
assertTrue(sourceRec.getVirtualArray().toString().equals("varray1"));
assertTrue("site1".equals(sourceRec.getInternalSiteName()));
assertTrue("xtremio2".equals(sourceRec.getSourceStorageSystem().toString()));
assertTrue(("pool2".equals(sourceRec.getSourceStoragePool().toString())) || ("pool1".equals(sourceRec.getSourceStoragePool().toString())));
assertNotNull(sourceRec.getTargetRecommendations());
assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
assertNotNull(targetRec.getSourceStoragePool());
assertTrue("xtremio4".equals(targetRec.getSourceStorageSystem().toString()));
assertTrue("site2".equals(targetRec.getInternalSiteName()));
assertTrue(targetRec.getVirtualArray().toString().equals("varray2"));
assertTrue("pool4".equals(targetRec.getSourceStoragePool().toString()) || "pool5".equals(targetRec.getSourceStoragePool().toString()));
}
}
// source journal
assertNotNull(rec.getSourceJournalRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
assertTrue(("pool2".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
// target journal
assertNotNull(rec.getTargetJournalRecommendations());
assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec.getSourceStoragePool());
assertTrue(targetJournalRec.getVirtualArray().toString().equals("varray2"));
assertTrue("pool4".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool5".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool6".equals(targetJournalRec.getSourceStoragePool().toString()));
assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
assertTrue("xtremio4".equals(targetJournalRec.getSourceStorageSystem().toString()) || "xtremio5".equals(targetJournalRec.getSourceStorageSystem().toString()) || "xtremio6".equals(targetJournalRec.getSourceStorageSystem().toString()));
}
_log.info(rec.toString(_dbClient));
}
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class PlacementTests method testPlacementRpMetropointCrr.
/**
* Metropoint placement - Single remote copy
*/
@Test
public void testPlacementRpMetropointCrr() {
String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] vmax1BE = { "50:BE:BE:BE:BE:BE:BE:00", "50:BE:BE:BE:BE:BE:BE:01" };
String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
String[] vmax2BE = { "51:BE:BE:BE:BE:BE:BE:00", "51:BE:BE:BE:BE:BE:BE:01" };
String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
String[] vmax3BE = { "52:BE:BE:BE:BE:BE:BE:00", "52:BE:BE:BE:BE:BE:BE:01" };
String[] vnx1FE = { "60:FE:FE:FE:FE:FE:FE:00", "60:FE:FE:FE:FE:FE:FE:01" };
String[] vnx1BE = { "60:BE:BE:BE:BE:BE:BE:00", "60:BE:BE:BE:BE:BE:BE:01" };
String[] vnx2FE = { "61:FE:FE:FE:FE:FE:FE:00", "61:FE:FE:FE:FE:FE:FE:01" };
String[] vnx2BE = { "61:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE:01" };
String[] vnx3FE = { "62:FE:FE:FE:FE:FE:FE:00", "62:FE:FE:FE:FE:FE:FE:01" };
String[] vnx3BE = { "62:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE: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[] rp3FE = { "55:FE:FE:FE:FE:FE:FE:00", "55:FE:FE:FE:FE:FE:FE:01" };
// vplex1 cluster1
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" };
// vplex1 cluster2
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" };
// vplex2 cluster1
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 srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
VirtualArray haVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haVarray");
VirtualArray tgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtVarray");
// Create Journal Varrays
VirtualArray srcJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcJournalVarray");
VirtualArray haJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haJournalVarray");
VirtualArray tgtJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtJournalVarray");
// Create 1 Network
StringSet connVA = new StringSet();
connVA.add(srcVarray.getId().toString());
connVA.add(haVarray.getId().toString());
connVA.add(tgtVarray.getId().toString());
connVA.add(srcJournalVarray.getId().toString());
connVA.add(haJournalVarray.getId().toString());
connVA.add(tgtJournalVarray.getId().toString());
Network network = PlacementTestUtils.createNetwork(_dbClient, vplex1FE, "VSAN", "FC+BROCADE", connVA);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex3BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex3FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex1BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex2BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vplex2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, rp1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, rp2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, rp3FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax1BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax2BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax3FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vmax3BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx1FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx1BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx2FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx2BE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx3FE);
PlacementTestUtils.addEndpoints(_dbClient, network, vnx3BE);
// Create 3 storage systems
StorageSystem vmaxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
StorageSystem vmaxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
StorageSystem vmaxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
StorageSystem vnxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx1");
StorageSystem vnxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx2");
StorageSystem vnxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx3");
// 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 VMAX1
List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1FE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem1, network, vmax1FE[i], srcVarray, 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, vmaxStorageSystem2, network, vmax2FE[i], haVarray, 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, vmaxStorageSystem3, network, vmax3FE[i], tgtVarray, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
}
// Create two front-end storage ports VNX1
List<StoragePort> vnx1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx1FE.length; i++) {
vnx1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem1, network, vnx1FE[i], srcJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx1" + i, "C1+FC1" + i));
}
// Create two front-end storage ports VNX2
List<StoragePort> vnx2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx2FE.length; i++) {
vnx2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem2, network, vnx2FE[i], haJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx2" + i, "D1+FC1" + i));
}
// Create two front-end storage ports VNX3
List<StoragePort> vnx3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx1FE.length; i++) {
vnx3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem3, network, vnx3FE[i], tgtJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx3" + i, "E1+FC1" + i));
}
// Create two back-end storage ports VPLEX1cluster1
List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1FE.length; i++) {
fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
}
// Create two back-end storage ports VPLEX1cluster1
List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex1BE.length; i++) {
bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1BE[i], srcVarray, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
}
// Create two front-end storage ports VPLEX1cluster2
List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex2FE.length; i++) {
fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2FE[i], haVarray, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
}
// Create two back-end storage ports VPLEX1cluster2
List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex2BE.length; i++) {
bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2BE[i], haVarray, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
}
// Create two front-end storage ports VPLEX2cluster1
List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex3FE.length; i++) {
fePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3FE[i], tgtVarray, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
}
// Create two back-end storage ports VPLEX2cluster1
List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex3BE.length; i++) {
bePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3BE[i], tgtVarray, 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);
AbstractChangeTrackingSet<String> wwnSite3 = new StringSet();
for (int i = 0; i < rp3FE.length; i++) {
wwnSite3.add(rp3FE[i]);
}
initiatorsSiteMap.put("site3", wwnSite3);
StringSet storSystems = new StringSet();
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vnxStorageSystem1.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vmaxStorageSystem1.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex1cluster2"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vnxStorageSystem2.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vmaxStorageSystem2.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site3", "vplex2cluster1"));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site3", vnxStorageSystem3.getSerialNumber()));
storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site3", vmaxStorageSystem3.getSerialNumber()));
StringSetMap rpVisibleSystems = new StringSetMap();
StringSet storageIds = new StringSet();
storageIds.add(vplexStorageSystem1.getId().toString());
storageIds.add(vmaxStorageSystem1.getId().toString());
storageIds.add(vnxStorageSystem1.getId().toString());
rpVisibleSystems.put("site1", storageIds);
StringSet storageIds2 = new StringSet();
storageIds2.add(vplexStorageSystem1.getId().toString());
storageIds2.add(vmaxStorageSystem2.getId().toString());
storageIds2.add(vnxStorageSystem2.getId().toString());
rpVisibleSystems.put("site2", storageIds2);
StringSet storageIds3 = new StringSet();
storageIds3.add(vplexStorageSystem2.getId().toString());
storageIds3.add(vmaxStorageSystem3.getId().toString());
storageIds3.add(vnxStorageSystem3.getId().toString());
rpVisibleSystems.put("site3", storageIds3);
StringMap siteVolCap = new StringMap();
siteVolCap.put("site1", "3221225472");
siteVolCap.put("site2", "3221225472");
siteVolCap.put("site3", "3221225472");
StringMap siteVolCnt = new StringMap();
siteVolCnt.put("site1", "10");
siteVolCnt.put("site2", "10");
siteVolCnt.put("site3", "10");
ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", "site3", "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("vplex1"));
rpSiteArray2.setRpInternalSiteName("site2");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
RPSiteArray rpSiteArray3 = new RPSiteArray();
rpSiteArray3.setId(URI.create("rsa3"));
rpSiteArray3.setStorageSystem(URI.create("vplex2"));
rpSiteArray3.setRpInternalSiteName("site3");
rpSiteArray3.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray3);
// Create a storage pool for vmax1
StoragePool srcPool1 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool1", "SrcPool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool srcPool2 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool2", "SrcPool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool srcPool3 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool3", "SrcPool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool haPool4 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool4", "HaPool4", Long.valueOf(1024 * 1024 * 1024), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool haPool5 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool5", "HaPool5", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool haPool6 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "Hapool6", "HaPool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool tgtPool7 = PlacementTestUtils.createStoragePool(_dbClient, tgtVarray, vmaxStorageSystem3, "TgtPool7", "TgtPool7", Long.valueOf(1024 * 1024 * 30), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool tgtPool8 = PlacementTestUtils.createStoragePool(_dbClient, tgtVarray, vmaxStorageSystem3, "Tgtpool8", "TgtPool8", Long.valueOf(1024 * 1024 * 30), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool sjPool9 = PlacementTestUtils.createStoragePool(_dbClient, srcJournalVarray, vnxStorageSystem1, "Sjpool9", "SjPool9", Long.valueOf(1024 * 1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool hajPool10 = PlacementTestUtils.createStoragePool(_dbClient, haJournalVarray, vnxStorageSystem2, "HaJpool10", "HaJPool10", Long.valueOf(1024 * 1024 * 1024), Long.valueOf(1024 * 1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool tjPool11 = PlacementTestUtils.createStoragePool(_dbClient, tgtJournalVarray, vnxStorageSystem3, "Tjpool11", "TjPool11", Long.valueOf(1024 * 1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create HA vpool
// haPool6 should never be selected by placement
VirtualPool haVpool = new VirtualPool();
haVpool.setId(URI.create("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1"));
haVpool.setLabel("haVpool");
haVpool.setType("block");
haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
haVpool.setDriveType(SupportedDriveTypes.FC.name());
haVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
StringSet matchedPools = new StringSet();
matchedPools.add(haPool4.getId().toString());
matchedPools.add(haPool5.getId().toString());
haVpool.setMatchedStoragePools(matchedPools);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(haVarray.getId().toString());
haVpool.setVirtualArrays(virtualArrays1);
haVpool.setUseMatchedPools(true);
_dbClient.createObject(haVpool);
// Create HA Journal Vpool
VirtualPool haJournalVpool = new VirtualPool();
haJournalVpool.setId(URI.create("haJournalVpool"));
haJournalVpool.setLabel("haJournalVpool");
haJournalVpool.setType("block");
haJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
// haJournalVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name()); //Uncomment this line to fail placement.
// haJournalVpool doesnt have a storagesystem that VPLEX can see
haJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(hajPool10.getId().toString());
haJournalVpool.setMatchedStoragePools(matchedPools);
StringSet haJournalVarrays = new StringSet();
haJournalVarrays.add(haJournalVarray.getId().toString());
haJournalVpool.setVirtualArrays(haJournalVarrays);
haJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(haJournalVpool);
// Create tgt journal vpool
VirtualPool tgtJournalVpool = new VirtualPool();
tgtJournalVpool.setId(URI.create("tgtJournalVpool"));
tgtJournalVpool.setLabel("tgtJournalVpool");
tgtJournalVpool.setType("block");
tgtJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
tgtJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(tjPool11.getId().toString());
tgtJournalVpool.setMatchedStoragePools(matchedPools);
StringSet tgtJournalVarrays = new StringSet();
tgtJournalVarrays.add(tgtJournalVarray.getId().toString());
tgtJournalVpool.setVirtualArrays(tgtJournalVarrays);
tgtJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(tgtJournalVpool);
// Create src journal vpool
VirtualPool srcJournalVpool = new VirtualPool();
srcJournalVpool.setId(URI.create("srcJournalVpool"));
srcJournalVpool.setLabel("srcJournalVpool");
srcJournalVpool.setType("block");
srcJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
srcJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(sjPool9.getId().toString());
srcJournalVpool.setMatchedStoragePools(matchedPools);
StringSet srcJournalVarrays = new StringSet();
srcJournalVarrays.add(srcJournalVarray.getId().toString());
srcJournalVpool.setVirtualArrays(srcJournalVarrays);
srcJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(srcJournalVpool);
// Create RP MetroPoint target vpool
VirtualPool mpTgtVpool = new VirtualPool();
mpTgtVpool.setId(URI.create("mpTargetVpool"));
mpTgtVpool.setLabel("mpTargetVpool");
mpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
mpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
// mpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
matchedPools = new StringSet();
matchedPools.add(tgtPool7.getId().toString());
matchedPools.add(tgtPool8.getId().toString());
mpTgtVpool.setMatchedStoragePools(matchedPools);
mpTgtVpool.setUseMatchedPools(true);
StringSet tgtVarrays = new StringSet();
tgtVarrays.add(tgtVarray.getId().toString());
mpTgtVpool.setVirtualArrays(tgtVarrays);
_dbClient.createObject(mpTgtVpool);
// Create a RP VPLEX virtual pool
// srcPool3 should never be chosen during placement
VirtualPool mpSrcVpool = new VirtualPool();
mpSrcVpool.setId(URI.create("mpSrcVpool"));
mpSrcVpool.setLabel("mpSrcVpool");
mpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
mpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
mpSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
matchedPools = new StringSet();
matchedPools.add(srcPool1.getId().toString());
matchedPools.add(srcPool2.getId().toString());
mpSrcVpool.setMatchedStoragePools(matchedPools);
mpSrcVpool.setUseMatchedPools(true);
mpSrcVpool.setJournalVarray(srcJournalVarray.getId().toString());
mpSrcVpool.setJournalVpool(srcJournalVpool.getId().toString());
mpSrcVpool.setStandbyJournalVarray(haJournalVarray.getId().toString());
mpSrcVpool.setStandbyJournalVpool(haJournalVpool.getId().toString());
mpSrcVpool.setJournalSize("2X");
StringMap vavpMap = new StringMap();
vavpMap.put(haVarray.getId().toString(), haVpool.getId().toString());
mpSrcVpool.setHaVarrayVpoolMap(vavpMap);
mpSrcVpool.setMetroPoint(true);
VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
protectionSettings.setVirtualPool(mpTgtVpool.getId());
protectionSettings.setId(URI.create("protectionSettings"));
protectionSettings.setJournalVarray(tgtJournalVarray.getId());
protectionSettings.setJournalVpool(tgtJournalVpool.getId());
mpSrcVpool.setHaVarrayConnectedToRp(haVarray.getId().toString());
_dbClient.createObject(protectionSettings);
List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
protectionSettingsList.add(protectionSettings);
StringMap protectionVarray = new StringMap();
protectionVarray.put(tgtVarray.getId().toString(), protectionSettingsList.get(0).getId().toString());
mpSrcVpool.setProtectionVarraySettings(protectionVarray);
mpSrcVpool.setRpCopyMode("SYNCHRONOUS");
mpSrcVpool.setRpRpoType("MINUTES");
mpSrcVpool.setRpRpoValue(Long.valueOf("5"));
StringSet srcVarrays = new StringSet();
srcVarrays.add(srcVarray.getId().toString());
mpSrcVpool.setVirtualArrays(srcVarrays);
_dbClient.createObject(mpSrcVpool);
// 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", 8, 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, srcVarray, project, mpSrcVpool, capabilities);
assertNotNull(recommendations);
assertTrue(!recommendations.isEmpty());
assertNotNull(recommendations.get(0));
RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
for (RPRecommendation rpRec : rec.getSourceRecommendations()) {
assertNotNull(rpRec.getVirtualArray());
assertNotNull(rpRec.getVirtualPool());
assertNotNull(rpRec.getInternalSiteName());
assertNotNull(rpRec.getSourceStorageSystem());
assertNotNull(rpRec.getSourceStoragePool());
assertTrue("site1".equals(rpRec.getInternalSiteName()));
assertTrue(vmaxStorageSystem1.getId().toString().equals(rpRec.getSourceStorageSystem().toString()));
assertTrue((srcPool1.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool2.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool3.getId().toString().equals(rpRec.getSourceStoragePool().toString())));
assertNotNull(rpRec.getVirtualVolumeRecommendation());
assertNotNull(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue("vplex1".equals(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertNotNull(rpRec.getHaRecommendation());
assertNotNull(rpRec.getHaRecommendation().getInternalSiteName());
assertTrue("vplex1".equals(rpRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue("site2".equals(rpRec.getHaRecommendation().getInternalSiteName()));
assertTrue(haVarray.getId().toString().equals(rpRec.getHaRecommendation().getVirtualArray().toString()));
assertTrue("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1".equals(rpRec.getHaRecommendation().getVirtualPool().getId().toString()));
assertTrue(vmaxStorageSystem2.getId().toString().equals(rpRec.getHaRecommendation().getSourceStorageSystem().toString()));
assertTrue((haPool4.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool5.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool6.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())));
assertNotNull(rpRec.getTargetRecommendations());
assertTrue(!rpRec.getTargetRecommendations().isEmpty());
for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
assertNotNull(targetRec.getInternalSiteName());
assertNotNull(targetRec.getVirtualArray());
assertNotNull(targetRec.getVirtualPool());
assertNotNull(targetRec.getSourceStorageSystem());
assertNotNull(targetRec.getSourceStoragePool());
if (VirtualPool.vPoolSpecifiesHighAvailability(mpTgtVpool)) {
assertNotNull(targetRec.getVirtualVolumeRecommendation());
assertNotNull(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem2.getId().toString().equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
assertTrue(vmaxStorageSystem3.getId().toString().equals(targetRec.getSourceStorageSystem().toString()));
assertTrue(tgtVarray.getId().toString().equals(targetRec.getVirtualArray().toString()));
assertTrue("site3".equals(targetRec.getInternalSiteName()));
assertTrue(mpTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
assertTrue((tgtPool7.getId().toString().equals(targetRec.getSourceStoragePool().toString())) || (tgtPool8.getId().toString().equals(targetRec.getSourceStoragePool().toString())));
}
}
// Source journal
assertNotNull(rec.getSourceJournalRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStorageSystem());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualArray());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualPool());
assertTrue("site1".equals(rec.getSourceJournalRecommendation().getInternalSiteName()));
assertTrue(vnxStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStorageSystem().toString()));
assertTrue((sjPool9.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(srcJournalVpool)) {
assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
// Source HA journal
assertNotNull(rec.getStandbyJournalRecommendation());
assertNotNull(rec.getStandbyJournalRecommendation().getInternalSiteName());
assertNotNull(rec.getStandbyJournalRecommendation().getSourceStoragePool());
assertNotNull(rec.getStandbyJournalRecommendation().getSourceStorageSystem());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualArray());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualPool());
assertTrue("site2".equals(rec.getStandbyJournalRecommendation().getInternalSiteName()));
assertTrue(vnxStorageSystem2.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStorageSystem().toString()));
assertTrue((hajPool10.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(haJournalVpool)) {
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
// TargetJournal
assertNotNull(rec.getTargetJournalRecommendations());
assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec);
assertNotNull(targetJournalRec.getInternalSiteName());
assertNotNull(targetJournalRec.getSourceStoragePool());
assertNotNull(targetJournalRec.getSourceStorageSystem());
assertNotNull(targetJournalRec.getVirtualArray());
assertNotNull(targetJournalRec.getVirtualPool());
assertTrue("site3".equals(targetJournalRec.getInternalSiteName()));
assertTrue(vnxStorageSystem3.getId().toString().equals(targetJournalRec.getSourceStorageSystem().toString()));
assertTrue((tjPool11.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(tgtJournalVpool)) {
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem2.getId().toString().equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
}
_log.info(String.format("Placement results (#%s) : \n %s", i, rec.toString(_dbClient)));
}
_log.info("### PASS ###");
}
Aggregations