use of com.emc.storageos.db.client.model.RPSiteArray in project coprhd-controller by CoprHD.
the class RPCommunicationInterface method discoverRPSiteArrays.
@SuppressWarnings("unchecked")
private void discoverRPSiteArrays(ProtectionSystem rpSystem) throws RecoverPointCollectionException {
_log.info("BEGIN RecoverPointProtection.discoveryProtectionSystem()");
// Retrieve the storage device info from the database.
ProtectionSystem storageObj = rpSystem;
// Wait for any storage system discovery to complete
waitForStorageSystemDiscovery();
// Get the rp system's array mappings from the RP client
BiosCommandResult result = getRPArrayMappings(storageObj);
_log.info(String.format("discoverProtectionSystem(): after rpa array mappings with result: [%s] ", result.getCommandStatus()));
RPSiteArray rpSiteArray = null;
if (result.getCommandSuccess()) {
// Current implementation:
// 1. Clear out any of its entries regarding associations
// 2. For each RPSite object, there is an associated RP storage system
// 3. Find the storage system in the database
// 4. Fill in associations
List<URI> ids = _dbClient.queryByType(RPSiteArray.class, true);
for (URI id : ids) {
_log.info("discoverProtectionSystem(): reading RPSiteArray: " + id.toASCIIString());
rpSiteArray = _dbClient.queryObject(RPSiteArray.class, id);
if (rpSiteArray == null) {
continue;
}
if ((rpSiteArray.getRpProtectionSystem() != null) && (rpSiteArray.getRpProtectionSystem().equals(storageObj.getId()))) {
_log.info(String.format("discoverProtectionSystem(): removing RPSiteArray[%s](%s) " + "entry for Storage System [%s].", rpSiteArray.getLabel(), rpSiteArray.getId().toASCIIString(), rpSiteArray.getArraySerialNumber()));
_dbClient.markForDeletion(rpSiteArray);
} else if (rpSiteArray.getRpProtectionSystem() == null) {
_log.error("RPSiteArray " + id.toASCIIString() + " does not have a parent assigned, therefore it is an orphan.");
}
}
// Store any unmatched WWNs for logging purposes
StringBuffer unmatchedWWNs = new StringBuffer();
// Map the information from the RP client to information in our database
for (SiteArrays siteArray : (List<SiteArrays>) result.getObjectList().get(0)) {
for (String wwn : siteArray.getArrays()) {
// Find the array that corresponds to the wwn endpoint we found
URIQueryResultList storagePortList = new URIQueryResultList();
StoragePort storagePort = null;
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStoragePortEndpointConstraint(WwnUtils.convertWWN(wwn, WwnUtils.FORMAT.COLON)), storagePortList);
List<URI> storagePortURIs = new ArrayList<URI>();
for (URI uri : storagePortList) {
storagePort = _dbClient.queryObject(StoragePort.class, uri);
if (storagePort != null && !storagePort.getInactive() && storagePort.getRegistrationStatus().equals(RegistrationStatus.REGISTERED.name())) {
// ignore cinder managed storage system's port
StorageSystem system = _dbClient.queryObject(StorageSystem.class, storagePort.getStorageDevice());
if (!DiscoveredDataObject.Type.openstack.name().equals(system.getSystemType())) {
storagePortURIs.add(uri);
}
}
}
if (!storagePortURIs.isEmpty()) {
storagePort = _dbClient.queryObject(StoragePort.class, storagePortURIs).get(0);
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storagePort.getStorageDevice());
rpSiteArray = new RPSiteArray();
rpSiteArray.setInactive(false);
rpSiteArray.setLabel(siteArray.getSite().getSiteName() + ":" + wwn);
rpSiteArray.setRpProtectionSystem(storageObj.getId());
rpSiteArray.setStorageSystem(storagePort.getStorageDevice());
rpSiteArray.setArraySerialNumber(storageSystem.getSerialNumber());
rpSiteArray.setRpInternalSiteName(siteArray.getSite().getInternalSiteName());
rpSiteArray.setRpSiteName(siteArray.getSite().getSiteName());
rpSiteArray.setId(URIUtil.createId(RPSiteArray.class));
_log.info(String.format("discoverProtectionSystem(): adding RPSiteArray[%s](%s) " + "entry for Storage System [%s].", rpSiteArray.getLabel(), rpSiteArray.getId().toASCIIString(), rpSiteArray.getArraySerialNumber()));
_dbClient.createObject(rpSiteArray);
} else {
unmatchedWWNs.append("\n" + wwn);
}
}
}
if (!StringUtils.isEmpty(unmatchedWWNs.toString())) {
_log.warn(String.format("Discovery of RecoverPoint Protection System [%s](%s) found the following endpoints, however " + "they could not be aligned with existing configured arrays. Note this is not an error and that some could be Host " + "endpoints but please ensure all arrays are registered before registering/running discovery of " + "RecoverPoint: [%s]", rpSystem.getLabel(), rpSystem.getId(), unmatchedWWNs));
}
} else {
_log.warn(String.format("RPA array mappings did not return a successful result, " + "please check network connectivity for RecoverPoint Protection System [%s](%s)."), rpSystem.getLabel(), rpSystem.getId());
}
_log.info("END RecoverPointProtection.discoveryProtectionSystem()");
}
use of com.emc.storageos.db.client.model.RPSiteArray in project coprhd-controller by CoprHD.
the class RPCommunicationInterface method discoverAssociatedStorageSystems.
/**
* Discovers the Storage Systems associated to the Protection System.
*
* @param protectionSystem A reference to the Protection System
*/
private void discoverAssociatedStorageSystems(ProtectionSystem protectionSystem) {
// Find all the RPSiteArrays that are associated to this protection system
List<RPSiteArray> siteArrays = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, RPSiteArray.class, AlternateIdConstraint.Factory.getConstraint(RPSiteArray.class, "rpProtectionSystem", protectionSystem.getId().toString()));
// For each RPSiteArray, if there is a Storage System, add it to the list of
// associated Storage Systems for this Protection System
// TODO: May not be the most efficient way to do this; suggested that we have a way to determine
// which objects in the StringSet are new, modified, or old and go from there. It could be that
// nothing really changed.
// But for now, force the associatedStorageSystems StringSet to be cleared and
// use the setter so that setChanged(true) is invoked for Cassandra.
StringSet associatedStorageSystems = protectionSystem.getAssociatedStorageSystems();
associatedStorageSystems.clear();
protectionSystem.setAssociatedStorageSystems(associatedStorageSystems);
for (RPSiteArray siteArray : siteArrays) {
if (siteArray != null && siteArray.getStorageSystem() != null) {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, siteArray.getStorageSystem());
String serialNumber = storageSystem.getSerialNumber();
// serial number from the storage system.
if (protectionSystem.getSiteVisibleStorageArrays() != null) {
for (Map.Entry<String, AbstractChangeTrackingSet<String>> clusterStorageSystemSerialNumberEntry : protectionSystem.getSiteVisibleStorageArrays().entrySet()) {
if (siteArray.getRpInternalSiteName().equals(clusterStorageSystemSerialNumberEntry.getKey())) {
for (String clusterSerialNumber : clusterStorageSystemSerialNumberEntry.getValue()) {
// Helper method to load the storage system by serial number
URI foundStorageSystemURI = ConnectivityUtil.findStorageSystemBySerialNumber(clusterSerialNumber, _dbClient, StorageSystemType.BLOCK);
if (storageSystem.getId().equals(foundStorageSystemURI)) {
serialNumber = clusterSerialNumber;
break;
}
}
}
}
}
// the VPLEX.
if (ConnectivityUtil.isAVPlex(storageSystem) && serialNumber.contains(":")) {
String[] splitSerialNumber = serialNumber.split(":");
String firstHalf = splitSerialNumber[0];
String secondHalf = splitSerialNumber[1];
// Check the network connectivity between the RP site and the storage array
if (isNetworkConnected(firstHalf, siteArray)) {
// Add first half
protectionSystem.getAssociatedStorageSystems().add(ProtectionSystem.generateAssociatedStorageSystem(siteArray.getRpInternalSiteName(), String.valueOf(firstHalf)));
}
// Second half to be added next
serialNumber = secondHalf;
}
// Check the network connectivity between the RP site and the storage array
if (isNetworkConnected(serialNumber, siteArray)) {
protectionSystem.getAssociatedStorageSystems().add(ProtectionSystem.generateAssociatedStorageSystem(siteArray.getRpInternalSiteName(), String.valueOf(serialNumber)));
}
}
}
_dbClient.updateObject(protectionSystem);
}
use of com.emc.storageos.db.client.model.RPSiteArray in project coprhd-controller by CoprHD.
the class ConnectivityUtil method getRPSystemStoragePools.
/**
* Get all of the storage pools associated with the RP System
*
* @param dbClient db client
* @param rpSystemId URI of the RP system
* @return list of storage pool URIs
*/
public static List<URI> getRPSystemStoragePools(DbClient dbClient, URI rpSystemId) {
List<URI> poolIds = new ArrayList<URI>();
// Get the rp system's array mappings from the RP client
URIQueryResultList sitelist = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getRPSiteArrayProtectionSystemConstraint(rpSystemId.toString()), sitelist);
Iterator<URI> it = sitelist.iterator();
while (it.hasNext()) {
URI rpSiteArrayId = it.next();
RPSiteArray siteArray = dbClient.queryObject(RPSiteArray.class, rpSiteArrayId);
if (siteArray != null && !siteArray.getInactive()) {
// Find all the Storage Pools associated to this RPSiteArray
URIQueryResultList storagePoolURIs = new URIQueryResultList();
dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePoolConstraint(siteArray.getStorageSystem()), storagePoolURIs);
Iterator<URI> storagePoolIter = storagePoolURIs.iterator();
while (storagePoolIter.hasNext()) {
URI storagePoolURI = storagePoolIter.next();
poolIds.add(storagePoolURI);
}
}
}
return poolIds;
}
use of com.emc.storageos.db.client.model.RPSiteArray in project coprhd-controller by CoprHD.
the class ConnectivityUtil method getRPSystemVirtualArrays.
/**
* Get all of the virtual arrays associated with the RP system. RP System ->
* Storage System -> Storage Pools -> Virtual Arrays
*
* @param dbClient - db client
* @param rpSystemId - URI of RP system
* @return list of virtual array URIs
*/
public static List<URI> getRPSystemVirtualArrays(DbClient dbClient, URI rpSystemId) {
Set<URI> virtualArrayIdSet = new HashSet<URI>();
List<URI> virtualArrayIdList = new ArrayList<URI>();
// Get the rp system's array mappings from the RP client
URIQueryResultList sitelist = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getRPSiteArrayProtectionSystemConstraint(rpSystemId.toString()), sitelist);
Iterator<URI> it = sitelist.iterator();
List<String> serialNumberSiteName = new ArrayList<String>();
while (it.hasNext()) {
URI rpSiteArrayId = it.next();
RPSiteArray siteArray = dbClient.queryObject(RPSiteArray.class, rpSiteArrayId);
if (!serialNumberSiteName.contains(siteArray.getArraySerialNumber() + siteArray.getRpSiteName())) {
findAllVirtualArraysForRPSiteArray(dbClient, siteArray, virtualArrayIdSet);
serialNumberSiteName.add(siteArray.getArraySerialNumber() + siteArray.getRpSiteName());
}
}
// Convert to a list
virtualArrayIdList.addAll(virtualArrayIdSet);
return virtualArrayIdList;
}
use of com.emc.storageos.db.client.model.RPSiteArray in project coprhd-controller by CoprHD.
the class PlacementTests method testNegativeBasicRPPlacement.
/**
* Simple block placement with RP
* Basic RP Placement test - VMAX
* This is a negative test. Placement should fail.
*/
@Test
public void testNegativeBasicRPPlacement() {
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[] 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 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 2 storage systems
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
// 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], varray1, 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], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+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, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 1), Long.valueOf(SIZE_GB * 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(SIZE_GB * 1), Long.valueOf(SIZE_GB * 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(SIZE_GB * 1), Long.valueOf(SIZE_GB * 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 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool6", "Pool6", Long.valueOf(SIZE_GB * 1), Long.valueOf(SIZE_GB * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a RP virtual pool
VirtualPool rpTgtVpool = new VirtualPool();
rpTgtVpool.setId(URI.create("rpTgtVpool"));
rpTgtVpool.setLabel("rpTgtVpool");
rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpTgtVpool.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());
rpTgtVpool.setProtectionVarraySettings(protectionVarray);
rpTgtVpool.setRpCopyMode("SYNCHRONOUS");
rpTgtVpool.setRpRpoType("MINUTES");
rpTgtVpool.setRpRpoValue(Long.valueOf("5"));
StringSet matchedPools = new StringSet();
matchedPools.add(pool1.getId().toString());
matchedPools.add(pool2.getId().toString());
matchedPools.add(pool3.getId().toString());
rpTgtVpool.setMatchedStoragePools(matchedPools);
rpTgtVpool.setUseMatchedPools(true);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(varray1.getId().toString());
rpTgtVpool.setVirtualArrays(virtualArrays1);
_dbClient.createObject(rpTgtVpool);
// Create a virtual pool
VirtualPool rpSrcVpool = new VirtualPool();
rpSrcVpool.setId(URI.create("vpool"));
rpSrcVpool.setLabel("vpool");
rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(pool4.getId().toString());
matchedPools.add(pool5.getId().toString());
matchedPools.add(pool6.getId().toString());
rpSrcVpool.setMatchedStoragePools(matchedPools);
rpSrcVpool.setUseMatchedPools(true);
StringSet virtualArrays2 = new StringSet();
virtualArrays2.add(varray2.getId().toString());
rpSrcVpool.setVirtualArrays(virtualArrays2);
_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);
// requested size of volume.
for (int i = 0; i < 10; i++) {
boolean caught = false;
List recommendations = null;
try {
recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray1, project, rpTgtVpool, capabilities);
} catch (BadRequestException e) {
caught = true;
_log.info("Caught expected Exception", e);
}
assertTrue(caught);
}
}
Aggregations