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");
}
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());
}
}
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());
}
}
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;
}
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;
}
Aggregations