Search in sources :

Example 1 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOCommunicationInterface method discoverArrayAffinity.

@Override
public void discoverArrayAffinity(AccessProfile accessProfile) throws BaseCollectionException {
    _logger.info("XtremIO Array Affinity discovery started for : {}", accessProfile.toString());
    boolean errorOccurred = false;
    StringBuilder errorStrBldr = new StringBuilder();
    try {
        XtremIOClient xtremIOClient = (XtremIOClient) xtremioRestClientFactory.getXtremIOV1Client(URI.create(XtremIOConstants.getXIOBaseURI(accessProfile.getIpAddress(), accessProfile.getPortNumber())), accessProfile.getUserName(), accessProfile.getPassword(), true);
        List<XtremIOSystem> xioSystems = xtremIOClient.getXtremIOSystemInfo();
        _logger.info("Found {} clusters for XMS {}", xioSystems.size(), accessProfile.getIpAddress());
        for (XtremIOSystem xioSystem : xioSystems) {
            try {
                String sysNativeGuid = NativeGUIDGenerator.generateNativeGuid(DiscoveredDataObject.Type.xtremio.name(), xioSystem.getSerialNumber());
                // check if system registered in ViPR
                List<StorageSystem> systems = CustomQueryUtility.getActiveStorageSystemByNativeGuid(_dbClient, sysNativeGuid);
                if (systems.isEmpty()) {
                    _logger.info("No Storage System found in database for {}, hence skipping..", sysNativeGuid);
                    continue;
                }
                StorageSystem system = systems.get(0);
                // Host based array affinity discovery
                if (accessProfile.getProps() != null && accessProfile.getProps().get(Constants.HOST_IDS) != null) {
                    String hostIdsStr = accessProfile.getProps().get(Constants.HOST_IDS);
                    _logger.info("Array Affinity Discovery started for Hosts {}, for XtremIO system {}", hostIdsStr, system.getNativeGuid());
                    String[] hostIds = hostIdsStr.split(Constants.ID_DELIMITER);
                    for (String hostId : hostIds) {
                        _logger.info("Processing Host {}", hostId);
                        Host host = _dbClient.queryObject(Host.class, URI.create(hostId));
                        if (host != null && !host.getInactive()) {
                            arrayAffinityDiscoverer.findAndUpdatePreferredPoolsForHost(system, host, _dbClient);
                        }
                    }
                } else {
                    // Storage system based array affinity discovery
                    _logger.info("Array Affinity Discovery started for XtremIO system {}", system.getNativeGuid());
                    arrayAffinityDiscoverer.findAndUpdatePreferredPools(system, _dbClient, _partitionManager);
                }
            } catch (Exception ex) {
                String errMsg = String.format("Error discovering Array Affinity for XtremIO system %s. Reason: %s", xioSystem.getSerialNumber(), ex.getMessage());
                _logger.error(errMsg, ex);
                errorOccurred = true;
                errorStrBldr.append(errMsg);
            }
        }
    } catch (Exception e) {
        _logger.error("Error discovering Array Affinity for XtremIO Provider {}", accessProfile.getIpAddress(), e);
        throw XtremIOApiException.exceptions.discoveryFailed(accessProfile.getIpAddress());
    } finally {
        if (errorOccurred) {
            _logger.error("Array Affinity discovery for XtremIO Provider {} failed. {}", accessProfile.getIpAddress(), errorStrBldr.toString());
            throw XtremIOApiException.exceptions.discoveryFailed(accessProfile.getIpAddress());
        }
    }
    _logger.info("XtremIO Array Affinity discovery ended");
}
Also used : XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) XtremIOClient(com.emc.storageos.xtremio.restapi.XtremIOClient) Host(com.emc.storageos.db.client.model.Host) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOCommunicationInterface method scan.

@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
    _logger.info("Scanning started for provider: {}", accessProfile.getSystemId());
    StorageProvider.ConnectionStatus cxnStatus = StorageProvider.ConnectionStatus.CONNECTED;
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
    XtremIOClient xtremIOClient = null;
    try {
        xtremIOClient = (XtremIOClient) xtremioRestClientFactory.getXtremIOV1Client(URI.create(XtremIOConstants.getXIOBaseURI(accessProfile.getIpAddress(), accessProfile.getPortNumber())), accessProfile.getUserName(), accessProfile.getPassword(), true);
        String xmsVersion = xtremIOClient.getXtremIOXMSVersion();
        String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(StorageSystem.Type.xtremio).replace("-", ".");
        String compatibility = (VersionChecker.verifyVersionDetails(minimumSupportedVersion, xmsVersion) < 0) ? StorageSystem.CompatibilityStatus.INCOMPATIBLE.name() : StorageSystem.CompatibilityStatus.COMPATIBLE.name();
        provider.setCompatibilityStatus(compatibility);
        provider.setVersionString(xmsVersion);
        String systemType = StorageSystem.Type.xtremio.name();
        List<XtremIOSystem> xioSystems = xtremIOClient.getXtremIOSystemInfo();
        _logger.info("Found {} clusters during scan of XMS {}", xioSystems.size(), accessProfile.getIpAddress());
        Map<String, StorageSystemViewObject> storageSystemsCache = accessProfile.getCache();
        for (XtremIOSystem system : xioSystems) {
            String arrayNativeGUID = NativeGUIDGenerator.generateNativeGuid(DiscoveredDataObject.Type.xtremio.name(), system.getSerialNumber());
            StorageSystemViewObject viewObject = storageSystemsCache.get(arrayNativeGUID);
            if (viewObject == null) {
                viewObject = new StorageSystemViewObject();
            }
            viewObject.setDeviceType(systemType);
            viewObject.addprovider(accessProfile.getSystemId().toString());
            viewObject.setProperty(StorageSystemViewObject.SERIAL_NUMBER, system.getSerialNumber());
            viewObject.setProperty(StorageSystemViewObject.VERSION, system.getVersion());
            viewObject.setProperty(StorageSystemViewObject.STORAGE_NAME, arrayNativeGUID);
            storageSystemsCache.put(arrayNativeGUID, viewObject);
        }
    } catch (Exception ex) {
        _logger.error("Error scanning XMS", ex);
        cxnStatus = StorageProvider.ConnectionStatus.NOTCONNECTED;
        // throw exception only if system discovery failed.
        throw XtremIOApiException.exceptions.discoveryFailed(provider.toString());
    } finally {
        provider.setConnectionStatus(cxnStatus.name());
        _dbClient.persistObject(provider);
        if (xtremIOClient != null) {
            xtremIOClient.close();
        }
        _logger.info("Completed scan of XtremIO StorageProvider. IP={}", accessProfile.getIpAddress());
    }
}
Also used : XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) XtremIOClient(com.emc.storageos.xtremio.restapi.XtremIOClient) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 3 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOCommunicationInterface method discoverXtremIOSystem.

private void discoverXtremIOSystem(XtremIOClient restClient, StorageSystem systemInDB) {
    try {
        List<StoragePool> pools = new ArrayList<StoragePool>();
        XtremIOSystem clusterObject = restClient.getClusterDetails(systemInDB.getSerialNumber());
        updateStorageSystemAndPools(clusterObject, systemInDB, pools);
        Map<String, List<StoragePort>> portMap = discoverPorts(restClient, systemInDB);
        List<StoragePort> allPorts = new ArrayList<StoragePort>();
        allPorts.addAll(portMap.get(NEW));
        allPorts.addAll(portMap.get(EXISTING));
        List<StoragePort> notVisiblePorts = DiscoveryUtils.checkStoragePortsNotVisible(allPorts, _dbClient, systemInDB.getId());
        List<StoragePort> allExistingPorts = new ArrayList<StoragePort>(portMap.get(EXISTING));
        if (notVisiblePorts != null && !notVisiblePorts.isEmpty()) {
            allExistingPorts.addAll(notVisiblePorts);
        }
        StoragePortAssociationHelper.runUpdatePortAssociationsProcess(portMap.get(NEW), allExistingPorts, _dbClient, _coordinator, pools);
        discoverInitiators(restClient, systemInDB);
    } catch (Exception e) {
        _logger.error("Error discovering XtremIO cluster", e);
        // throw exception only if system discovery failed.
        throw XtremIOApiException.exceptions.discoveryFailed(systemInDB.toString());
    }
}
Also used : XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) StoragePool(com.emc.storageos.db.client.model.StoragePool) ArrayList(java.util.ArrayList) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) List(java.util.List) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 4 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOV2Client method getXtremIOSystemInfo.

@Override
public List<XtremIOSystem> getXtremIOSystemInfo() throws Exception {
    ClientResponse response = get(XtremIOConstants.XTREMIO_V2_BASE_CLUSTERS_URI);
    XtremIOClusters xioClusters = getResponseObject(XtremIOClusters.class, response);
    log.info("Returned Clusters : {}", xioClusters.getClusters().length);
    List<XtremIOSystem> discoveredXIOSystems = new ArrayList<XtremIOSystem>();
    for (XtremIOCluster cluster : xioClusters.getClusters()) {
        URI clusterURI = URI.create(URIUtil.getFromPath(cluster.getHref()));
        response = get(clusterURI);
        XtremIOClusterInfo xioSystem = getResponseObject(XtremIOClusterInfo.class, response);
        log.info("System {}", xioSystem.getContent().getName() + "-" + xioSystem.getContent().getSerialNumber() + "-" + xioSystem.getContent().getVersion());
        discoveredXIOSystems.add(xioSystem.getContent());
    }
    return discoveredXIOSystems;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOClusters(com.emc.storageos.xtremio.restapi.model.response.XtremIOClusters) XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) ArrayList(java.util.ArrayList) XtremIOCluster(com.emc.storageos.xtremio.restapi.model.response.XtremIOCluster) URI(java.net.URI) XtremIOClusterInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOClusterInfo)

Example 5 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOV1Client method getXtremIOSystemInfo.

@Override
public List<XtremIOSystem> getXtremIOSystemInfo() throws Exception {
    ClientResponse response = get(XtremIOConstants.XTREMIO_BASE_CLUSTERS_URI);
    XtremIOClusters xioClusters = getResponseObject(XtremIOClusters.class, response);
    log.info("Returned Clusters : {}", xioClusters.getClusters().length);
    List<XtremIOSystem> discoveredXIOSystems = new ArrayList<XtremIOSystem>();
    for (XtremIOCluster cluster : xioClusters.getClusters()) {
        URI clusterURI = URI.create(URIUtil.getFromPath(cluster.getHref()));
        response = get(clusterURI);
        XtremIOClusterInfo xioSystem = getResponseObject(XtremIOClusterInfo.class, response);
        log.info("System {}", xioSystem.getContent().getName() + "-" + xioSystem.getContent().getSerialNumber() + "-" + xioSystem.getContent().getVersion());
        discoveredXIOSystems.add(xioSystem.getContent());
    }
    return discoveredXIOSystems;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOClusters(com.emc.storageos.xtremio.restapi.model.response.XtremIOClusters) XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) ArrayList(java.util.ArrayList) XtremIOCluster(com.emc.storageos.xtremio.restapi.model.response.XtremIOCluster) URI(java.net.URI) XtremIOClusterInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOClusterInfo)

Aggregations

XtremIOSystem (com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem)6 XtremIOApiException (com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException)4 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 ArrayList (java.util.ArrayList)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 XtremIOClient (com.emc.storageos.xtremio.restapi.XtremIOClient)2 XtremIOCluster (com.emc.storageos.xtremio.restapi.model.response.XtremIOCluster)2 XtremIOClusterInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOClusterInfo)2 XtremIOClusters (com.emc.storageos.xtremio.restapi.model.response.XtremIOClusters)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 URI (java.net.URI)2 Host (com.emc.storageos.db.client.model.Host)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StoragePort (com.emc.storageos.db.client.model.StoragePort)1 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)1 List (java.util.List)1