use of com.emc.storageos.vnxe.models.VNXeStorageProcessor in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method discoverStorageProcessors.
/**
* Discover storage processors for the specified VNX unity storage array
*
* @param system
* storage system information including credentials.
* @param client
* The unity api client
* @param spIdMap
* Map of storage processor native ids
* @return map of all storage processors as StorageHADomain
*/
private HashMap<String, List<StorageHADomain>> discoverStorageProcessors(StorageSystem system, VNXeApiClient client, Map<String, URI> spIdMap) throws VNXeException {
HashMap<String, List<StorageHADomain>> result = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newSPs = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingSPs = new ArrayList<StorageHADomain>();
_logger.info("Start storage processor discovery for storage system {}", system.getId());
List<VNXeStorageProcessor> sps = client.getStorageProcessors();
for (VNXeStorageProcessor sp : sps) {
StorageHADomain haDomain = null;
if (null == sp) {
_logger.debug("Null sp in the list of storage processors.");
continue;
}
// Check if sp was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, sp.getId(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
Iterator<URI> it = results.iterator();
if (it.hasNext()) {
StorageHADomain tmpDomain = _dbClient.queryObject(StorageHADomain.class, it.next());
if (tmpDomain.getStorageDeviceURI().equals(system.getId())) {
haDomain = tmpDomain;
_logger.debug("Found existing {} ", sp.getId());
}
}
// If the sp was not previously discovered
if (haDomain == null) {
haDomain = new StorageHADomain();
haDomain.setId(URIUtil.createId(StorageHADomain.class));
haDomain.setNativeGuid(adapterNativeGuid);
haDomain.setStorageDeviceURI(system.getId());
haDomain.setAdapterName(sp.getId());
haDomain.setName(sp.getId());
haDomain.setSerialNumber(sp.getEmcSerialNumber());
newSPs.add(haDomain);
} else {
existingSPs.add(haDomain);
}
if (sp.getSlotNumber() != null) {
haDomain.setSlotNumber(sp.getSlotNumber().toString());
}
spIdMap.put(sp.getId(), haDomain.getId());
}
_logger.info("Storage processors discovery for storage system {} complete.", system.getId());
for (StorageHADomain newDomain : newSPs) {
_logger.info("New storage processor : {} : {}", newDomain.getNativeGuid(), newDomain.getId());
}
for (StorageHADomain domain : existingSPs) {
_logger.info("Existing storage processor : {} : {}", domain.getNativeGuid(), domain.getId());
}
result.put(NEW, newSPs);
result.put(EXISTING, existingSPs);
return result;
}
use of com.emc.storageos.vnxe.models.VNXeStorageProcessor in project coprhd-controller by CoprHD.
the class VNXeCommunicationInterface method discoverStorageProcessors.
private HashMap<String, List<StorageHADomain>> discoverStorageProcessors(StorageSystem system, VNXeApiClient client, Map<String, URI> spIdMap) throws VNXeException {
HashMap<String, List<StorageHADomain>> result = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newSPs = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingSPs = new ArrayList<StorageHADomain>();
_logger.info("Start storage processor discovery for storage system {}", system.getId());
List<VNXeStorageProcessor> sps = client.getStorageProcessors();
for (VNXeStorageProcessor sp : sps) {
StorageHADomain haDomain = null;
if (null == sp) {
_logger.debug("Null sp in the list of storage processors.");
continue;
}
// Check if sp was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, sp.getId(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
if (results.iterator().hasNext()) {
StorageHADomain tmpDomain = _dbClient.queryObject(StorageHADomain.class, results.iterator().next());
if (tmpDomain.getStorageDeviceURI().equals(system.getId())) {
haDomain = tmpDomain;
_logger.debug("Found existing {} ", sp.getId());
}
}
// If the sp was not previously discovered
if (haDomain == null) {
haDomain = new StorageHADomain();
haDomain.setId(URIUtil.createId(StorageHADomain.class));
haDomain.setNativeGuid(adapterNativeGuid);
haDomain.setStorageDeviceURI(system.getId());
haDomain.setAdapterName(sp.getId());
haDomain.setName(sp.getId());
haDomain.setSerialNumber(sp.getEmcSerialNumber());
newSPs.add(haDomain);
} else {
existingSPs.add(haDomain);
}
spIdMap.put(sp.getId(), haDomain.getId());
}
_logger.info("Storage processors discovery for storage system {} complete.", system.getId());
for (StorageHADomain newDomain : newSPs) {
_logger.info("New NasServer : {} : {}", newDomain.getNativeGuid(), newDomain.getId());
}
for (StorageHADomain domain : existingSPs) {
_logger.info("Existing NasServer : {} : {}", domain.getNativeGuid(), domain.getId());
}
result.put(NEW, newSPs);
result.put(EXISTING, existingSPs);
return result;
}
Aggregations