use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.
the class VPlexCommunicationInterface method scan.
/**
* Implementation for scan for VPlex storage systems.
*
* @param accessProfile
*
* @throws BaseCollectionException
*/
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
URI mgmntServerURI = accessProfile.getSystemId();
StorageProvider mgmntServer = null;
String scanStatusMessage = "Unknown Status";
VPlexApiClient client = null;
try {
// Get the storage provider representing a VPLEX management server.
mgmntServer = _dbClient.queryObject(StorageProvider.class, mgmntServerURI);
// Get the Http client for getting information about the VPLEX
// cluster(s) managed by the VPLEX management server.
client = getVPlexAPIClient(accessProfile);
s_logger.debug("Got handle to VPlex API client");
// Verify the connectivity to the VPLEX management server.
verifyConnectivity(client, mgmntServer);
// Verify the VPLEX system firmware version is supported.
verifyMinimumSupportedFirmwareVersion(client, mgmntServer);
// Determine the VPLEX system managed by this management server.
Map<String, StorageSystemViewObject> scanCache = accessProfile.getCache();
s_logger.info("Storage System scanCache before scanning:" + scanCache);
scanManagedSystems(client, mgmntServer, scanCache);
s_logger.info("Storage System scanCache after scanning:" + scanCache);
scanStatusMessage = String.format("Scan job completed successfully for " + "VPLEX management server: %s", mgmntServerURI.toString());
} catch (Exception e) {
if (null != client) {
// clear cached discovery data in the VPlexApiClient
client.clearCaches();
}
VPlexCollectionException vce = VPlexCollectionException.exceptions.failedScan(mgmntServer.getIPAddress(), e.getLocalizedMessage());
scanStatusMessage = vce.getLocalizedMessage();
throw vce;
} finally {
if (mgmntServer != null) {
try {
mgmntServer.setLastScanStatusMessage(scanStatusMessage);
_dbClient.updateObject(mgmntServer);
} catch (Exception e) {
s_logger.error("Error persisting scan status message for management server {}", mgmntServerURI.toString(), e);
}
}
}
}
use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.
the class ModelProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CIMInstance modelInstance = null;
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
Map<String, StorageSystemViewObject> storageSystemsCache = (Map<String, StorageSystemViewObject>) keyMap.get(Constants.SYSTEMCACHE);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
String deviceType = null;
while (it.hasNext()) {
modelInstance = it.next();
String model = modelInstance.getPropertyValue(MODEL).toString();
// TODO should CIM_Chassis.SerialNumber be used instead of Tag?
String tag = modelInstance.getPropertyValue(TAG).toString();
String serialID = null;
if (isIBMInstance(modelInstance)) {
String typeDesc = modelInstance.getPropertyValue(TYPE_DESC).toString();
if (Constants.XIV.equalsIgnoreCase(typeDesc)) {
deviceType = DiscoveredDataObject.Type.ibmxiv.name();
// e.g., IBM.2810-7825363
serialID = tag;
} else {
_logger.warn("Array {} is of model {} ---> not XIV, hence will not be added to ViPR", tag, model);
continue;
}
} else {
if (model.toLowerCase().contains(VNX)) {
deviceType = VNXBLOCK;
} else if (model.toLowerCase().contains(VMAX) || model.toLowerCase().contains(POWERMAX) || model.toLowerCase().contains(PMAX)) {
deviceType = VMAX;
} else {
_logger.warn("Array {} is of model {} ---> neither VMAX nor VNX, hence will not be added to ViPR", tag, model);
continue;
}
serialID = tag.split(Constants.PATH_DELIMITER_REGEX)[1];
}
keyMap.put(Constants.ARRAYTYPE, deviceType);
StorageSystemViewObject systemVO = null;
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(deviceType, serialID);
if (storageSystemsCache.containsKey(nativeGuid)) {
systemVO = storageSystemsCache.get(nativeGuid);
} else {
systemVO = new StorageSystemViewObject();
}
systemVO.setDeviceType(deviceType);
systemVO.addprovider(profile.getSystemId().toString());
systemVO.setProperty(StorageSystemViewObject.MODEL, model);
systemVO.setProperty(StorageSystemViewObject.SERIAL_NUMBER, serialID);
systemVO.setProperty(StorageSystemViewObject.STORAGE_NAME, nativeGuid);
storageSystemsCache.put(nativeGuid, systemVO);
}
_logger.info("Found {} systems during scanning for ip {}", storageSystemsCache.size(), profile.getIpAddress());
resultObj = null;
} catch (Exception e) {
_logger.error(e.getMessage(), e);
_logger.error("Model Extraction failed for {}-->{}", modelInstance.getObjectPath(), getMessage(e));
}
}
use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.
the class SMICommunicationInterfaceTest method testXIVBlockPlugin.
// Need to start coordinator & DB service, before running this test
@Test
public void testXIVBlockPlugin() {
StorageProvider provider = createXIVProvider();
try {
Map<String, Object> cache = new ConcurrentHashMap<String, Object>();
Set<String> idset = new HashSet<String>();
idset.add("SYMMETRIX+000194900404+VOLUME+00000");
cache.put("000194900404-block-Volumes", idset);
xiv.injectCache(cache);
xiv.injectDBClient(_dbClient);
xiv.injectCoordinatorClient(coordinator);
// scanTest(_smiplugin);
AccessProfile profile = populateSMISAccessProfile(provider);
verifyDB(profile);
Map<String, StorageSystemViewObject> storageSystemsCache = Collections.synchronizedMap(new HashMap<String, StorageSystemViewObject>());
profile.setCache(storageSystemsCache);
xiv.scan(profile);
DataCollectionJobUtil util = new DataCollectionJobUtil();
util.setDbClient(_dbClient);
util.setConfigInfo(configinfo);
List<URI> providerList = new ArrayList<URI>();
providerList.add(provider.getId());
util.performBookKeeping(storageSystemsCache, providerList);
// provider.getStorageSystems();
// profile.setSystemId(provider.getSystemId());
profile.setserialID(profile.getserialID());
xiv.discover(profile);
} catch (Exception e) {
_LOGGER.error(e.getMessage(), e);
}
}
Aggregations