Search in sources :

Example 11 with RPSite

use of com.emc.storageos.recoverpoint.objectmodel.RPSite in project coprhd-controller by CoprHD.

the class RPCommunicationInterface method getRPArrayMappings.

/**
 * For an RP configuration, determine the arrays that each site can see.
 *
 * @param system RP system
 * @return command result object, object list [0] has List<SiteArrays>
 * @throws RecoverPointException
 */
public BiosCommandResult getRPArrayMappings(ProtectionSystem system) throws RecoverPointException {
    _log.info("getRPArrayMappings {} - start", system.getId());
    RecoverPointClient rp = RPHelper.getRecoverPointClient(system);
    Set<RPSite> sites = rp.getAssociatedRPSites();
    // For determining which storage system to use with the RPA, we will look at the Network created as a result of
    // a NetworkSystem (aka switch or Fabric Manager) discovery. We look at each NetworkSystem to check if the RPA WWN(aka RP Initiator)
    // is in one of the
    // Networks/VSANs and if we do find a match then we look at the arrays in that Network/VSAN and determine which one to use.
    // For now, this code assumes there are Networks/VSANs created on the switch, might need to tweak this if there are no
    // Networks/VSANs.
    // One more important note : Networks/VSANs have be configured on the switch in order for zoning to work and NetworkSystem to
    // discover.
    // No Networks/VSANs on the switch means, none of this will work and zoning has to be done by the end-user prior to using StorageOS.
    // Get all the NetworkSystems already in the system (if there are any NetworkSystems configured).
    // Possible zoning candidates can be identified only if there is a NetworkSystem configured.
    List<SiteArrays> rpSiteArrays = new ArrayList<SiteArrays>();
    List<URI> networkSystemList = _dbClient.queryByType(NetworkSystem.class, true);
    boolean isNetworkSystemConfigured = false;
    if (networkSystemList.iterator().hasNext()) {
        List<URI> allNetworks = _dbClient.queryByType(Network.class, true);
        // Transfer to a reset-able list
        List<URI> networks = new ArrayList<>();
        for (URI networkURI : allNetworks) {
            networks.add(networkURI);
        }
        for (RPSite site : sites) {
            // Get the initiators for this site.
            Map<String, Map<String, String>> rpaWWNs = rp.getInitiatorWWNs(site.getInternalSiteName());
            SiteArrays siteArrays = new SiteArrays();
            siteArrays.setArrays(new HashSet<String>());
            siteArrays.setSite(site);
            // Add an RP site -> initiators entry to the protection system
            StringSet siteInitiators = new StringSet();
            for (String rpaId : rpaWWNs.keySet()) {
                siteInitiators.addAll(rpaWWNs.get(rpaId).keySet());
            }
            system.putSiteIntitiatorsEntry(site.getInternalSiteName(), siteInitiators);
            // trying to find a valid Storage Port (of which they will not return a result).
            for (String rpaId : rpaWWNs.keySet()) {
                _log.info(String.format("Discovering RPA %s initiators for RPA Cluster %s(%s)...", rpaId, site.getSiteName(), site.getInternalSiteName()));
                boolean foundNetworkForRPA = false;
                for (Map.Entry<String, String> rpaWWN : rpaWWNs.get(rpaId).entrySet()) {
                    Initiator initiator = new Initiator();
                    initiator.addInternalFlags(Flag.RECOVERPOINT);
                    // Remove all non alpha-numeric characters, excluding "_", from the hostname
                    String rpClusterName = site.getSiteName().replaceAll(NON_ALPHA_NUMERICS, "");
                    initiator.setClusterName(rpClusterName);
                    initiator.setProtocol("FC");
                    initiator.setIsManualCreation(false);
                    // Group RP initiators by their RPA. This will ensure that separate IGs are created for each RPA
                    // A child RP IG will be created containing all the RPA IGs
                    String hostName = rpClusterName + RPA + rpaId;
                    hostName = hostName.replaceAll(NON_ALPHA_NUMERICS, "");
                    initiator.setHostName(hostName);
                    initiator.setInitiatorPort(rpaWWN.getKey());
                    initiator.setInitiatorNode(rpaWWN.getValue());
                    // Either get the existing initiator or create a new if needed
                    initiator = getOrCreateNewInitiator(initiator);
                    _log.info(String.format("RPA Initiator %s detected: [port: %s, node: %s, host: %s, cluster: %s]", initiator.getInitiatorPort(), initiator.getInitiatorPort(), initiator.getInitiatorNode(), initiator.getHostName(), initiator.getClusterName()));
                    // Find the network associated with this initiator
                    for (URI networkURI : networks) {
                        Network network = _dbClient.queryObject(Network.class, networkURI);
                        StringMap discoveredEndpoints = network.getEndpointsMap();
                        if (discoveredEndpoints.containsKey(initiator.getInitiatorPort().toUpperCase())) {
                            _log.info(String.format("RPA Initiator %s is associated to Network %s.", initiator.getInitiatorPort().toUpperCase(), network.getLabel()));
                            // Set this to true as we found the RP initiators in a Network on the Network system
                            isNetworkSystemConfigured = true;
                            foundNetworkForRPA = true;
                            for (String discoveredEndpoint : discoveredEndpoints.keySet()) {
                                // in that NetworkVSAN.
                                if (discoveredEndpoint.startsWith(RP_INITIATOR_PREFIX)) {
                                    continue;
                                }
                                // Add the found endpoints to the list
                                siteArrays.getArrays().add(discoveredEndpoint);
                            }
                        }
                    }
                }
                if (!foundNetworkForRPA) {
                    // This is not an error to the end-user. When they add a network system, everything will rediscover correctly.
                    _log.warn(String.format("RPA %s initiators for RPA Cluster %s(%s) are not seen in any configured network.", rpaId, site.getSiteName(), site.getInternalSiteName()));
                }
            }
            // add to the list
            rpSiteArrays.add(siteArrays);
        }
    }
    // If its a non RP4.0 system, then query the normal way and find out the targets/arrays from the RPAs.
    if (!rp.getAssociatedRPSites().isEmpty()) {
        _log.info("site1 version: " + rp.getAssociatedRPSites().iterator().next().getSiteVersion());
    }
    if (!isNetworkSystemConfigured) {
        // This is not an error to the end-user. When they add a network system, everything will rediscover correctly.
        _log.warn("Network systems are required when configuring RecoverPoint.");
    }
    _log.info("getRPArrayMappings {} - complete", system.getId());
    BiosCommandResult result = new BiosCommandResult();
    result.setCommandSuccess(true);
    result.setCommandStatus(Operation.Status.ready.name());
    List<Object> returnList = new ArrayList<Object>();
    returnList.add(rpSiteArrays);
    result.setObjectList(returnList);
    return result;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) SiteArrays(com.emc.storageos.recoverpoint.objectmodel.SiteArrays) ArrayList(java.util.ArrayList) URI(java.net.URI) Initiator(com.emc.storageos.db.client.model.Initiator) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) RecoverPointClient(com.emc.storageos.recoverpoint.impl.RecoverPointClient) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StringMap(com.emc.storageos.db.client.model.StringMap)

Example 12 with RPSite

use of com.emc.storageos.recoverpoint.objectmodel.RPSite in project coprhd-controller by CoprHD.

the class RPStatisticsHelper method updateProtectionSystemMetrics.

/**
 * Update the protection system with the metrics associated with making smart
 * placement decisions.
 * <p>
 * Collects the RP System and Site metrics from within the <code>RecoverPointStatisticsResponse</code> object.
 *
 * @param rpSystem protection system to update
 * @param rpStat stat object to reflect in the protection system
 */
public void updateProtectionSystemMetrics(ProtectionSystem rpSystem, Set<RPSite> rpSites, RecoverPointStatisticsResponse response, DbClient dbClient) {
    // Update the metrics per cluster
    for (RPSite site : rpSites) {
        rpSystem.setCgCount(getParameter(response.getParamList(), NumberOfGroups, CurrentOrMax.CURRENT_VALUE));
        rpSystem.setCgCapacity(getParameter(response.getParamList(), NumberOfGroups, CurrentOrMax.MAX_VALUE));
        rpSystem.setRsetCount(getParameter(response.getParamList(), NumberOfReplicatingSets, CurrentOrMax.CURRENT_VALUE));
        rpSystem.setRsetCapacity(getParameter(response.getParamList(), NumberOfReplicatingSets, CurrentOrMax.MAX_VALUE));
        rpSystem.setRemoteReplicationGBCount(getParameter(response.getParamList(), RemoteReplicatedArray, CurrentOrMax.CURRENT_VALUE));
        rpSystem.setRemoteReplicationGBCapacity(getParameter(response.getParamList(), RemoteReplicatedArray, CurrentOrMax.MAX_VALUE));
        // Site specific entries are in a string map for easy database use
        // Key: Site ID, Value: Long->String
        StringMap localRepCountStringMap = new StringMap();
        localRepCountStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), LocalReplicatedArray, CurrentOrMax.CURRENT_VALUE, site.getSiteUID()));
        rpSystem.setSiteLocalReplicationGBCount(localRepCountStringMap);
        StringMap localRepCapacityStringMap = new StringMap();
        localRepCapacityStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), LocalReplicatedArray, CurrentOrMax.MAX_VALUE, site.getSiteUID()));
        rpSystem.setSiteLocalReplicationGBCapacity(localRepCapacityStringMap);
        StringMap sitePathCountStringMap = new StringMap();
        sitePathCountStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfWLPS, CurrentOrMax.CURRENT_VALUE, site.getSiteUID()));
        rpSystem.setSitePathCount(sitePathCountStringMap);
        StringMap sitePathCapacityStringMap = new StringMap();
        sitePathCapacityStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfWLPS, CurrentOrMax.MAX_VALUE, site.getSiteUID()));
        rpSystem.setSitePathCapacity(sitePathCapacityStringMap);
        StringMap siteVNXSplitterCountStringMap = new StringMap();
        siteVNXSplitterCountStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfClariionHosts, CurrentOrMax.CURRENT_VALUE, site.getSiteUID()));
        rpSystem.setSiteVNXSplitterCount(siteVNXSplitterCountStringMap);
        StringMap siteVNXSplitterCapacityStringMap = new StringMap();
        siteVNXSplitterCapacityStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfClariionHosts, CurrentOrMax.MAX_VALUE, site.getSiteUID()));
        rpSystem.setSiteVNXSplitterCapacity(siteVNXSplitterCapacityStringMap);
        StringMap siteVolumeCountStringMap = new StringMap();
        siteVolumeCountStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfGUIDS, CurrentOrMax.CURRENT_VALUE, site.getSiteUID()));
        rpSystem.setSiteVolumeCount(siteVolumeCountStringMap);
        StringMap siteVolumeCapacityStringMap = new StringMap();
        siteVolumeCapacityStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), NumberOfGUIDS, CurrentOrMax.MAX_VALUE, site.getSiteUID()));
        rpSystem.setSiteVolumeCapacity(siteVolumeCapacityStringMap);
        StringMap siteVolumesAttachedToSplitterCountStringMap = new StringMap();
        siteVolumesAttachedToSplitterCountStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), TotalNumberOfSplitterLUNs, CurrentOrMax.CURRENT_VALUE, site.getSiteUID()));
        rpSystem.setSiteVolumesAttachedToSplitterCount(siteVolumesAttachedToSplitterCountStringMap);
        StringMap siteVolumesAttachedToSplitterCapacityStringMap = new StringMap();
        siteVolumesAttachedToSplitterCapacityStringMap.put(site.getInternalSiteName(), "" + getParameter(response.getParamList(), TotalNumberOfSplitterLUNs, CurrentOrMax.MAX_VALUE, site.getSiteUID()));
        rpSystem.setSiteVolumesAttachedToSplitterCapacity(siteVolumesAttachedToSplitterCapacityStringMap);
        dbClient.persistObject(rpSystem);
    }
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite)

Example 13 with RPSite

use of com.emc.storageos.recoverpoint.objectmodel.RPSite in project coprhd-controller by CoprHD.

the class RPDeviceController method collectRPStatistics.

/**
 * Collects the RP statistics for the given <code>ProtectionSystem</code>.
 *
 * @param protectionSystem
 * @throws InternalException
 */
private void collectRPStatistics(ProtectionSystem protectionSystem) throws InternalException {
    RecoverPointClient rpClient = RPHelper.getRecoverPointClient(protectionSystem);
    Set<RPSite> rpSites = rpClient.getAssociatedRPSites();
    RecoverPointStatisticsResponse response = rpClient.getRPSystemStatistics();
    _rpStatsHelper.updateProtectionSystemMetrics(protectionSystem, rpSites, response, _dbClient);
}
Also used : RecoverPointClient(com.emc.storageos.recoverpoint.impl.RecoverPointClient) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) RecoverPointStatisticsResponse(com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse)

Aggregations

RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)13 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)6 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)5 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)5 HashSet (java.util.HashSet)5 ClusterUID (com.emc.fapiclient.ws.ClusterUID)4 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)4 CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)4 CreateVolumeParams (com.emc.storageos.recoverpoint.requests.CreateVolumeParams)4 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)3 StringMap (com.emc.storageos.db.client.model.StringMap)3 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)3 RPSystem (com.emc.storageos.recoverpoint.objectmodel.RPSystem)3 URISyntaxException (java.net.URISyntaxException)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)2 DeviceUID (com.emc.fapiclient.ws.DeviceUID)2 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)2 CreateRSetParams (com.emc.storageos.recoverpoint.requests.CreateRSetParams)2