Search in sources :

Example 1 with VNXeStorageProcessor

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;
}
Also used : HashMap(java.util.HashMap) VNXeStorageProcessor(com.emc.storageos.vnxe.models.VNXeStorageProcessor) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 2 with VNXeStorageProcessor

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;
}
Also used : HashMap(java.util.HashMap) VNXeStorageProcessor(com.emc.storageos.vnxe.models.VNXeStorageProcessor) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Aggregations

URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)2 VNXeStorageProcessor (com.emc.storageos.vnxe.models.VNXeStorageProcessor)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 URI (java.net.URI)1