Search in sources :

Example 1 with VNXeStorageSystem

use of com.emc.storageos.vnxe.models.VNXeStorageSystem in project coprhd-controller by CoprHD.

the class VNXUnityCommunicationInterface method discover.

/**
 * Implementation for VNX Unity storage systems discovery, both of block and
 * file
 *
 * @param accessProfile
 *
 * @throws VNXeException
 */
@Override
public void discover(AccessProfile accessProfile) throws VNXeException {
    URI storageSystemURI = accessProfile.getSystemId();
    StorageSystem viprStorageSystem = null;
    String detailedStatusMessage = "Unknown Status";
    try {
        _logger.info("Access Profile Details :  IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
        if (null != accessProfile.getnamespace() && (accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_VOLUMES.toString()) || accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_FILESYSTEMS.toString()))) {
            discoverUnmanagedObjects(accessProfile);
        } else {
            // Get the VNX Unity storage system from the database.
            viprStorageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
            _logger.info(String.format("Discover VnxUnity storage system %s at IP:%s, PORT:%s", storageSystemURI.toString(), accessProfile.getIpAddress(), accessProfile.getPortNumber()));
            // Get the vnx unity service client for getting information
            // about the Vnx Unity storage system.
            VNXeApiClient client = getVnxUnityClient(accessProfile);
            _logger.debug("Got handle to Vnx unity service client");
            // Get the serial number and the native guid and set into the
            // storage system.
            _logger.info("Discovering storage system properties.");
            VNXeStorageSystem system = client.getStorageSystem();
            boolean isFASTVPEnabled = client.isFASTVPEnabled();
            viprStorageSystem = discoverStorageSystemInfo(client, accessProfile, system, isFASTVPEnabled, viprStorageSystem);
            StringSet arraySupportedProtocols = new StringSet();
            // Discover the NasServers
            Map<String, URI> nasServerIdMap = new HashMap<String, URI>();
            Map<String, List<StorageHADomain>> nasServers = discoverNasServers(viprStorageSystem, client, nasServerIdMap, arraySupportedProtocols);
            _logger.info("No of newly discovered NasServers {}", nasServers.get(NEW).size());
            _logger.info("No of existing discovered NasServers {}", nasServers.get(EXISTING).size());
            if (!nasServers.get(NEW).isEmpty()) {
                _dbClient.createObject(nasServers.get(NEW));
            }
            if (!nasServers.get(EXISTING).isEmpty()) {
                _dbClient.updateObject(nasServers.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed NAS Server discovery");
            // Discover FileInterfaces
            List<StoragePort> allExistingPorts = new ArrayList<StoragePort>();
            List<StoragePort> allNewPorts = new ArrayList<StoragePort>();
            Map<String, List<StoragePort>> ports = discoverFileStoragePorts(viprStorageSystem, client, nasServerIdMap);
            if (ports.get(NEW) != null && !ports.get(NEW).isEmpty()) {
                allNewPorts.addAll(ports.get(NEW));
                _dbClient.createObject(ports.get(NEW));
            }
            if (ports.get(EXISTING) != null && !ports.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(ports.get(EXISTING));
                _dbClient.updateObject(ports.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed file ports discovery");
            // discover storage processors
            Map<String, URI> spIdMap = new HashMap<String, URI>();
            Map<String, List<StorageHADomain>> sps = discoverStorageProcessors(viprStorageSystem, client, spIdMap);
            if (!sps.get(NEW).isEmpty()) {
                _dbClient.createObject(sps.get(NEW));
            }
            if (!sps.get(EXISTING).isEmpty()) {
                _dbClient.updateObject(sps.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed storage processor discovery");
            // discover iscsi ports
            Map<String, List<StoragePort>> iscsiPorts = discoverIscsiPorts(viprStorageSystem, client, spIdMap);
            boolean hasIscsiPorts = false;
            if (iscsiPorts.get(NEW) != null && !iscsiPorts.get(NEW).isEmpty()) {
                allNewPorts.addAll(iscsiPorts.get(NEW));
                hasIscsiPorts = true;
                _dbClient.createObject(iscsiPorts.get(NEW));
            }
            if (iscsiPorts.get(EXISTING) != null && !iscsiPorts.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(iscsiPorts.get(EXISTING));
                hasIscsiPorts = true;
                _dbClient.updateObject(iscsiPorts.get(EXISTING));
            }
            if (hasIscsiPorts) {
                arraySupportedProtocols.add(StorageProtocol.Block.iSCSI.name());
            }
            _completer.statusPending(_dbClient, "Completed iscsi ports discovery");
            // discover fc ports
            Map<String, List<StoragePort>> fcPorts = discoverFcPorts(viprStorageSystem, client, spIdMap);
            boolean hasFcPorts = false;
            if (fcPorts.get(NEW) != null && !fcPorts.get(NEW).isEmpty()) {
                allNewPorts.addAll(fcPorts.get(NEW));
                hasFcPorts = true;
                _dbClient.createObject(fcPorts.get(NEW));
            }
            if (fcPorts.get(EXISTING) != null && !fcPorts.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(fcPorts.get(EXISTING));
                hasFcPorts = true;
                _dbClient.updateObject(fcPorts.get(EXISTING));
            }
            if (hasFcPorts) {
                arraySupportedProtocols.add(StorageProtocol.Block.FC.name());
            }
            _completer.statusPending(_dbClient, "Completed FC ports discovery");
            List<StoragePort> allPorts = new ArrayList<StoragePort>(allNewPorts);
            allPorts.addAll(allExistingPorts);
            // check if any port not visible in this discovery
            List<StoragePort> notVisiblePorts = DiscoveryUtils.checkStoragePortsNotVisible(allPorts, _dbClient, viprStorageSystem.getId());
            if (notVisiblePorts != null && !notVisiblePorts.isEmpty()) {
                allExistingPorts.addAll(notVisiblePorts);
            }
            /**
             * Discover the VNX Unity pool information.
             */
            _logger.info("Discovering storage pools.");
            List<StoragePool> poolsToMatchWithVpool = new ArrayList<StoragePool>();
            List<StoragePool> allPools = new ArrayList<StoragePool>();
            Map<String, List<StoragePool>> pools = discoverStoragePools(viprStorageSystem, client, arraySupportedProtocols, poolsToMatchWithVpool);
            _logger.info("No of newly discovered pools {}", pools.get(NEW).size());
            _logger.info("No of existing discovered pools {}", pools.get(EXISTING).size());
            if (!pools.get(NEW).isEmpty()) {
                allPools.addAll(pools.get(NEW));
                _dbClient.createObject(pools.get(NEW));
                StoragePoolAssociationHelper.setStoragePoolVarrays(viprStorageSystem.getId(), pools.get(NEW), _dbClient);
            }
            if (!pools.get(EXISTING).isEmpty()) {
                allPools.addAll(pools.get(EXISTING));
                _dbClient.updateObject(pools.get(EXISTING));
            }
            List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(allPools, _dbClient, viprStorageSystem.getId());
            if (notVisiblePools != null && !notVisiblePools.isEmpty()) {
                poolsToMatchWithVpool.addAll(notVisiblePools);
            }
            StoragePortAssociationHelper.runUpdatePortAssociationsProcess(allNewPorts, allExistingPorts, _dbClient, _coordinator, poolsToMatchWithVpool);
            _completer.statusPending(_dbClient, "Completed pool discovery");
            // This associates the VNas with the virtual array
            StoragePortAssociationHelper.runUpdateVirtualNasAssociationsProcess(allExistingPorts, null, _dbClient);
            _logger.info("update virtual nas association for unity");
            if (isFASTVPEnabled) {
                _logger.info("FASTVP is enabled");
                HashMap<String, List<AutoTieringPolicy>> policies = discoverAutoTierPolicies(viprStorageSystem, client);
                if (!policies.get(NEW).isEmpty()) {
                    _dbClient.createObject(policies.get(NEW));
                }
                if (!policies.get(EXISTING).isEmpty()) {
                    _dbClient.updateObject(policies.get(EXISTING));
                }
                HashMap<String, List<StorageTier>> tiers = discoverStorageTier(viprStorageSystem, client);
                if (!tiers.get(NEW).isEmpty()) {
                    _dbClient.createObject(tiers.get(NEW));
                }
                if (!tiers.get(EXISTING).isEmpty()) {
                    _dbClient.updateObject(tiers.get(EXISTING));
                }
            }
            detailedStatusMessage = String.format("Discovery completed successfully for Storage System: %s", storageSystemURI.toString());
        }
    } catch (Exception e) {
        detailedStatusMessage = String.format("Discovery failed for VNX Unity %s: %s", storageSystemURI.toString(), e.getLocalizedMessage());
        _logger.error(detailedStatusMessage, e);
        throw VNXeException.exceptions.discoveryError("Discovery error", e);
    } finally {
        if (viprStorageSystem != null) {
            try {
                // set detailed message
                viprStorageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.updateObject(viprStorageSystem);
            } catch (DatabaseException ex) {
                _logger.error("Error while persisting object to DB", ex);
            }
        }
    }
}
Also used : VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem) StoragePool(com.emc.storageos.db.client.model.StoragePool) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) HashMap(java.util.HashMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) URI(java.net.URI) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem)

Example 2 with VNXeStorageSystem

use of com.emc.storageos.vnxe.models.VNXeStorageSystem in project coprhd-controller by CoprHD.

the class ApiClientTest method getSystem.

@Test
public void getSystem() {
    VNXeStorageSystem system = apiClient.getStorageSystem();
    System.out.println(system.getModel());
// apiClient.getNasServers();
}
Also used : VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem) Test(org.junit.Test)

Example 3 with VNXeStorageSystem

use of com.emc.storageos.vnxe.models.VNXeStorageSystem in project coprhd-controller by CoprHD.

the class StorageSystemRequestTest method testGetStorageSystem.

@Test
public void testGetStorageSystem() throws Exception {
    StorageSystemRequest systemReq = new StorageSystemRequest(_client);
    VNXeStorageSystem system = systemReq.get();
    System.out.println(system.getName());
    System.out.println(system.getId());
}
Also used : VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem) Test(org.junit.Test)

Example 4 with VNXeStorageSystem

use of com.emc.storageos.vnxe.models.VNXeStorageSystem in project coprhd-controller by CoprHD.

the class VNXUnityCommunicationInterface method scan.

/**
 * Implementation for scan for Vnx Unity storage systems.
 *
 * @param accessProfile
 *
 * @throws BaseCollectionException
 */
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
    _logger.info("Starting scan of Unity StorageProvider. IP={}", accessProfile.getIpAddress());
    StorageProvider.ConnectionStatus cxnStatus = StorageProvider.ConnectionStatus.CONNECTED;
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
    _locker.acquireLock(accessProfile.getIpAddress(), LOCK_WAIT_SECONDS);
    try {
        VNXeApiClient apiClient = getVnxUnityClient(accessProfile);
        if (apiClient != null) {
            Map<String, StorageSystemViewObject> storageSystemsCache = accessProfile.getCache();
            BasicSystemInfo unitySystem = apiClient.getBasicSystemInfo();
            String unityType = StorageSystem.Type.unity.name();
            String version = unitySystem.getApiVersion();
            String compatibility = StorageSystem.CompatibilityStatus.COMPATIBLE.name();
            provider.setCompatibilityStatus(compatibility);
            provider.setVersionString(version);
            VNXeStorageSystem system = apiClient.getStorageSystem();
            _logger.info("Found Unity: {} ", system.getSerialNumber());
            String id = system.getSerialNumber();
            String nativeGuid = generateNativeGuid(unityType, id);
            StorageSystemViewObject viewObject = storageSystemsCache.get(nativeGuid);
            if (viewObject == null) {
                viewObject = new StorageSystemViewObject();
            }
            viewObject.setDeviceType(unityType);
            viewObject.addprovider(accessProfile.getSystemId().toString());
            viewObject.setProperty(StorageSystemViewObject.MODEL, unitySystem.getModel());
            viewObject.setProperty(StorageSystemViewObject.SERIAL_NUMBER, id);
            storageSystemsCache.put(nativeGuid, viewObject);
        }
    } catch (Exception e) {
        cxnStatus = StorageProvider.ConnectionStatus.NOTCONNECTED;
        _logger.error(String.format("Exception was encountered when attempting to scan Unity Instance %s", accessProfile.getIpAddress()), e);
        throw VNXeException.exceptions.scanFailed(accessProfile.getIpAddress(), e);
    } finally {
        provider.setConnectionStatus(cxnStatus.name());
        _dbClient.updateObject(provider);
        _logger.info("Completed scan of Unity StorageProvider. IP={}", accessProfile.getIpAddress());
        _locker.releaseLock(accessProfile.getIpAddress());
    }
}
Also used : VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem) StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) BasicSystemInfo(com.emc.storageos.vnxe.models.BasicSystemInfo) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 5 with VNXeStorageSystem

use of com.emc.storageos.vnxe.models.VNXeStorageSystem in project coprhd-controller by CoprHD.

the class VNXeCommunicationInterface method discover.

/**
 * Implementation for discovery for Vnxe storage systems, file related only
 * for now
 *
 * @param accessProfile
 *
 * @throws VNXeException
 */
@Override
public void discover(AccessProfile accessProfile) throws VNXeException {
    URI storageSystemURI = accessProfile.getSystemId();
    StorageSystem viprStorageSystem = null;
    String detailedStatusMessage = "Unknown Status";
    try {
        _logger.info("Access Profile Details :  IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
        if (null != accessProfile.getnamespace() && (accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_VOLUMES.toString()) || accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_FILESYSTEMS.toString()))) {
            discoverUnmanagedObjects(accessProfile);
        } else {
            // Get the Vnxe storage system from the database.
            viprStorageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
            _logger.info(String.format("Discover Vnxe storage system %s at IP:%s, PORT:%s", storageSystemURI.toString(), accessProfile.getIpAddress(), accessProfile.getPortNumber()));
            // Get the vnxe service client for getting information about the
            // Vnxe
            // storage system.
            VNXeApiClient client = getVnxeClient(accessProfile);
            _logger.debug("Got handle to Vnxe service client");
            // Get the serial number and the native guid and set
            // into the storage system.
            _logger.info("Discovering storage system properties.");
            VNXeStorageSystem system = client.getStorageSystem();
            boolean isFASTVPEnabled = false;
            if (system != null) {
                viprStorageSystem.setSerialNumber(system.getSerialNumber());
                String guid = NativeGUIDGenerator.generateNativeGuid(viprStorageSystem);
                viprStorageSystem.setNativeGuid(guid);
                viprStorageSystem.setLabel(guid);
                viprStorageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
                viprStorageSystem.setReachableStatus(true);
                isFASTVPEnabled = client.isFASTVPEnabled();
                viprStorageSystem.setAutoTieringEnabled(isFASTVPEnabled);
                StringSet supportedActions = new StringSet();
                supportedActions.add(StorageSystem.AsyncActions.CreateElementReplica.name());
                supportedActions.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
                viprStorageSystem.setSupportedAsynchronousActions(supportedActions);
                StringSet supportedReplica = new StringSet();
                supportedReplica.add(StorageSystem.SupportedReplicationTypes.LOCAL.name());
                viprStorageSystem.setSupportedReplicationTypes(supportedReplica);
                _dbClient.persistObject(viprStorageSystem);
                _completer.statusPending(_dbClient, "Completed discovery of system properties");
            } else {
                _logger.error("Failed to retrieve VNXe system info!");
                viprStorageSystem.setReachableStatus(false);
            }
            // get version for the storage system
            BasicSystemInfo info = client.getBasicSystemInfo();
            if (info != null) {
                viprStorageSystem.setFirmwareVersion(info.getSoftwareVersion());
            }
            StringSet arraySupportedProtocols = new StringSet();
            // Discover the NasServers
            Map<String, URI> nasServerIdMap = new HashMap<String, URI>();
            Map<String, List<StorageHADomain>> nasServers = discoverNasServers(viprStorageSystem, client, nasServerIdMap, arraySupportedProtocols);
            _logger.info("No of newly discovered NasServers {}", nasServers.get(NEW).size());
            _logger.info("No of existing discovered NasServers {}", nasServers.get(EXISTING).size());
            if (!nasServers.get(NEW).isEmpty()) {
                _dbClient.createObject(nasServers.get(NEW));
            }
            if (!nasServers.get(EXISTING).isEmpty()) {
                _dbClient.persistObject(nasServers.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed NAS Server discovery");
            // Discover FileInterfaces
            List<StoragePort> allExistingPorts = new ArrayList<StoragePort>();
            List<StoragePort> allNewPorts = new ArrayList<StoragePort>();
            Map<String, List<StoragePort>> ports = discoverFileStoragePorts(viprStorageSystem, client, nasServerIdMap);
            if (ports.get(NEW) != null && !ports.get(NEW).isEmpty()) {
                allNewPorts.addAll(ports.get(NEW));
                _dbClient.createObject(ports.get(NEW));
            }
            if (ports.get(EXISTING) != null && !ports.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(ports.get(EXISTING));
                _dbClient.persistObject(ports.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed file ports discovery");
            // discover storage processors
            Map<String, URI> spIdMap = new HashMap<String, URI>();
            Map<String, List<StorageHADomain>> sps = discoverStorageProcessors(viprStorageSystem, client, spIdMap);
            if (!sps.get(NEW).isEmpty()) {
                _dbClient.createObject(sps.get(NEW));
            }
            if (!sps.get(EXISTING).isEmpty()) {
                _dbClient.persistObject(sps.get(EXISTING));
            }
            _completer.statusPending(_dbClient, "Completed storage processor discovery");
            // discover iscsi ports
            Map<String, List<StoragePort>> iscsiPorts = discoverIscsiPorts(viprStorageSystem, client, spIdMap);
            boolean hasIscsiPorts = false;
            if (iscsiPorts.get(NEW) != null && !iscsiPorts.get(NEW).isEmpty()) {
                allNewPorts.addAll(iscsiPorts.get(NEW));
                hasIscsiPorts = true;
                _dbClient.createObject(iscsiPorts.get(NEW));
            }
            if (iscsiPorts.get(EXISTING) != null && !iscsiPorts.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(iscsiPorts.get(EXISTING));
                hasIscsiPorts = true;
                _dbClient.persistObject(ports.get(EXISTING));
            }
            if (hasIscsiPorts) {
                arraySupportedProtocols.add(StorageProtocol.Block.iSCSI.name());
            }
            _completer.statusPending(_dbClient, "Completed iscsi ports discovery");
            // discover fc ports
            Map<String, List<StoragePort>> fcPorts = discoverFcPorts(viprStorageSystem, client, spIdMap);
            boolean hasFcPorts = false;
            if (fcPorts.get(NEW) != null && !fcPorts.get(NEW).isEmpty()) {
                allNewPorts.addAll(fcPorts.get(NEW));
                hasFcPorts = true;
                _dbClient.createObject(fcPorts.get(NEW));
            }
            if (fcPorts.get(EXISTING) != null && !fcPorts.get(EXISTING).isEmpty()) {
                allExistingPorts.addAll(fcPorts.get(EXISTING));
                hasFcPorts = true;
                _dbClient.persistObject(ports.get(EXISTING));
            }
            if (hasFcPorts) {
                arraySupportedProtocols.add(StorageProtocol.Block.FC.name());
            }
            _completer.statusPending(_dbClient, "Completed FC ports discovery");
            List<StoragePort> allPorts = new ArrayList<StoragePort>(allNewPorts);
            allPorts.addAll(allExistingPorts);
            // check if any port not visible in this discovery
            List<StoragePort> notVisiblePorts = DiscoveryUtils.checkStoragePortsNotVisible(allPorts, _dbClient, viprStorageSystem.getId());
            if (notVisiblePorts != null && !notVisiblePorts.isEmpty()) {
                allExistingPorts.addAll(notVisiblePorts);
            }
            /**
             * Discover the VNXe pool information.
             */
            _logger.info("Discovering storage pools.");
            List<StoragePool> poolsToMatchWithVpool = new ArrayList<StoragePool>();
            List<StoragePool> allPools = new ArrayList<StoragePool>();
            Map<String, List<StoragePool>> pools = discoverStoragePools(viprStorageSystem, client, arraySupportedProtocols, poolsToMatchWithVpool);
            _logger.info("No of newly discovered pools {}", pools.get(NEW).size());
            _logger.info("No of existing discovered pools {}", pools.get(EXISTING).size());
            if (!pools.get(NEW).isEmpty()) {
                allPools.addAll(pools.get(NEW));
                _dbClient.createObject(pools.get(NEW));
                StoragePoolAssociationHelper.setStoragePoolVarrays(viprStorageSystem.getId(), pools.get(NEW), _dbClient);
            }
            if (!pools.get(EXISTING).isEmpty()) {
                allPools.addAll(pools.get(EXISTING));
                _dbClient.persistObject(pools.get(EXISTING));
            }
            List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(allPools, _dbClient, viprStorageSystem.getId());
            if (notVisiblePools != null && !notVisiblePools.isEmpty()) {
                poolsToMatchWithVpool.addAll(notVisiblePools);
            }
            StoragePortAssociationHelper.runUpdatePortAssociationsProcess(allNewPorts, allExistingPorts, _dbClient, _coordinator, poolsToMatchWithVpool);
            _completer.statusPending(_dbClient, "Completed pool discovery");
            if (isFASTVPEnabled) {
                _logger.info("FASTVP is enabled");
                HashMap<String, List<AutoTieringPolicy>> policies = discoverAutoTierPolicies(viprStorageSystem, client);
                if (!policies.get(NEW).isEmpty()) {
                    _dbClient.createObject(policies.get(NEW));
                }
                if (!policies.get(EXISTING).isEmpty()) {
                    _dbClient.persistObject(policies.get(EXISTING));
                }
                HashMap<String, List<StorageTier>> tiers = discoverStorageTier(viprStorageSystem, client);
                if (!tiers.get(NEW).isEmpty()) {
                    _dbClient.createObject(tiers.get(NEW));
                }
                if (!tiers.get(EXISTING).isEmpty()) {
                    _dbClient.persistObject(tiers.get(EXISTING));
                }
            }
            detailedStatusMessage = String.format("Discovery completed successfully for Storage System: %s", storageSystemURI.toString());
        }
    } catch (Exception e) {
        detailedStatusMessage = String.format("Discovery failed for VNXe %s: %s", storageSystemURI.toString(), e.getLocalizedMessage());
        _logger.error(detailedStatusMessage, e);
        throw VNXeException.exceptions.discoveryError("Discovery error", e);
    } finally {
        if (viprStorageSystem != null) {
            try {
                // set detailed message
                viprStorageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.persistObject(viprStorageSystem);
            } catch (DatabaseException ex) {
                _logger.error("Error while persisting object to DB", ex);
            }
        }
    }
}
Also used : VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem) StoragePool(com.emc.storageos.db.client.model.StoragePool) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) HashMap(java.util.HashMap) BasicSystemInfo(com.emc.storageos.vnxe.models.BasicSystemInfo) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) URI(java.net.URI) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem)

Aggregations

VNXeStorageSystem (com.emc.storageos.vnxe.models.VNXeStorageSystem)6 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)4 VNXeException (com.emc.storageos.vnxe.VNXeException)4 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 Test (org.junit.Test)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 BasicSystemInfo (com.emc.storageos.vnxe.models.BasicSystemInfo)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)1