Search in sources :

Example 1 with HDSCollectionException

use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method discoverUnManagedVolumes.

/**
 * Discover all UnManagedVolumes for a given storagesystem.
 *
 * @param accessProfile
 */
private void discoverUnManagedVolumes(AccessProfile accessProfile) {
    StorageSystem storageSystem = null;
    String detailedStatusMessage = null;
    try {
        storageSystem = _dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
        if (null == storageSystem) {
            return;
        }
        volumeDiscoverer.discoverUnManagedVolumes(accessProfile, _dbClient, _coordinator, _partitionManager);
        storageSystem.setDiscoveryStatus(DiscoveredDataObject.DataCollectionJobStatus.IN_PROGRESS.toString());
        _dbClient.persistObject(storageSystem);
    } catch (Exception e) {
        if (storageSystem != null) {
            cleanupDiscovery(storageSystem);
        }
        detailedStatusMessage = String.format("Discovery of unmanaged volumes failed for system %s because %s", storageSystem.getId().toString(), e.getLocalizedMessage());
        _logger.error(detailedStatusMessage, e);
        throw new HDSCollectionException(detailedStatusMessage);
    } finally {
        if (storageSystem != null) {
            try {
                // set detailed message
                storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.persistObject(storageSystem);
            } catch (Exception ex) {
                _logger.error(String.format("Error while updating unmanaged volume discovery status for system %s", storageSystem.getId()), ex);
            }
        }
    }
}
Also used : HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) HDSException(com.emc.storageos.hds.HDSException) WBEMException(javax.wbem.WBEMException) IOException(java.io.IOException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with HDSCollectionException

use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method discover.

@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
    if ((null != accessProfile.getnamespace()) && (accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_VOLUMES.toString()))) {
        discoverUnManagedVolumes(accessProfile);
    } else {
        _logger.info("Discovery started for system {}", accessProfile.getSystemId());
        StorageSystem storageSystem = null;
        String detailedStatusMessage = "Unknown Status";
        try {
            storageSystem = _dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
            HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(accessProfile), accessProfile.getUserName(), accessProfile.getPassword());
            // HDS+ARRAY.AMS200.73012495
            Iterable<String> splitter = Splitter.on(HDSConstants.PLUS_OPERATOR).limit(2).split(storageSystem.getNativeGuid());
            String objectID = Iterables.getLast(splitter);
            StorageArray storageArray = hdsApiClient.getStorageSystemDetails(objectID);
            if (null != storageArray) {
                parseDiscoveryResponse(storageArray, accessProfile);
                storageArray = hdsApiClient.getStorageSystemTieringPolicies(objectID);
                parseDiscoveryTieringPolicyResponse(storageArray, accessProfile);
                fetchStoragePoolTiers(storageSystem, objectID, accessProfile, hdsApiClient);
            } else {
                _logger.error("Discovery failed for system {} as not able to retrieve information from HiCommand DM");
                throw new HDSCollectionException("Discovery failed for system as not able to retrieve information from HiCommand Device Manager.");
            }
            // discovery succeeds
            detailedStatusMessage = String.format("Discovery completed successfully for HDS: %s", accessProfile.getSystemId());
        } catch (Exception e) {
            if (null != storageSystem) {
                cleanupDiscovery(storageSystem);
            }
            detailedStatusMessage = String.format("Discovery failed for Storage System: %s because %s", storageSystem.toString(), e.getLocalizedMessage());
            _logger.error(detailedStatusMessage, e);
            throw new HDSCollectionException(detailedStatusMessage);
        } finally {
            try {
                if (storageSystem != null) {
                    storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                    _dbClient.persistObject(storageSystem);
                }
            } catch (Exception e) {
                _logger.error(e.getMessage(), e);
            }
        }
        _logger.info("Discovery Ended for system {}", accessProfile.getSystemId());
    }
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) HDSException(com.emc.storageos.hds.HDSException) WBEMException(javax.wbem.WBEMException) IOException(java.io.IOException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StorageArray(com.emc.storageos.hds.model.StorageArray)

Example 3 with HDSCollectionException

use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method scan.

@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
    _logger.info("Scanning started for provider: {}", accessProfile.getSystemId());
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
    boolean exceptionOccured = false;
    try {
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(accessProfile), accessProfile.getUserName(), accessProfile.getPassword());
        String apiVersion = hdsApiClient.getProviderAPIVersion();
        _logger.info("Provider {} API Version:{}", provider.getLabel(), apiVersion);
        provider.setVersionString(apiVersion);
        String minimumSupportedVersion = ControllerUtils.getPropertyValueFromCoordinator(_coordinator, CONTROLLER_HICOMMAND_PROVIDER_VERSION);
        if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, apiVersion) < 0) {
            provider.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
            throw new HDSCollectionException(String.format(" ** The HiCommand Device Manager API version is not supported. Minimum supported version should be: %s", minimumSupportedVersion));
        }
        provider.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
        List<StorageArray> storageArrayList = hdsApiClient.getStorageSystemsInfo();
        if (null != storageArrayList && !storageArrayList.isEmpty()) {
            _logger.debug("Received proper response from HiCommand server");
            processScanResponse(storageArrayList, accessProfile);
        } else {
            _logger.info("No Systems found during scanning of provider: {}", provider.getId());
        }
    } catch (Exception ex) {
        exceptionOccured = true;
        _logger.error("Exception occurred while scanning provider {}", accessProfile.getSystemId(), ex);
        throw HDSException.exceptions.scanFailed(ex);
    } finally {
        if (exceptionOccured) {
            provider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
        } else {
            provider.setConnectionStatus(ConnectionStatus.CONNECTED.name());
        }
        _dbClient.persistObject(provider);
    }
    _logger.info("Scanning ended for provider: {}", accessProfile.getSystemId());
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) HDSException(com.emc.storageos.hds.HDSException) WBEMException(javax.wbem.WBEMException) IOException(java.io.IOException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) StorageArray(com.emc.storageos.hds.model.StorageArray)

Example 4 with HDSCollectionException

use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method collectStatisticsInformation.

@Override
public void collectStatisticsInformation(AccessProfile accessProfile) throws BaseCollectionException {
    try {
        _logger.info("Access Profile Details :" + accessProfile.toString());
        wbemClient = getCIMClient(accessProfile);
        initMap(accessProfile);
        Namespace namespace = (Namespace) namespaces.getNsList().get(METERING);
        _logger.info("HDS CIMClient initialized successfully");
        executor.setKeyMap(_keyMap);
        executor.execute(namespace);
        dumpStatRecords();
        injectStats();
        // if portMetricsProcesor was injected with metering, trigger pool matcher
        if (portMetricsProcessor != null) {
            // 
            // compute port metric to trigger if any port allocation qualification changed. If there is
            // changes, run vpool matcher
            // 
            _logger.info("checking to see if Vpool Matcher needs to be run");
            List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(_dbClient, accessProfile.getSystemId());
            portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(accessProfile.getSystemId(), systemPorts);
            // 
            // compute storage system's average of port metrics. Then, persist it into storage system object.
            // 
            portMetricsProcessor.computeStorageSystemAvgPortMetrics(accessProfile.getSystemId());
        }
    } catch (Exception e) {
        throw new HDSCollectionException(e.getMessage());
    } finally {
        releaseResources();
    }
}
Also used : HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) StoragePort(com.emc.storageos.db.client.model.StoragePort) Namespace(com.emc.storageos.plugins.common.domainmodel.Namespace) HDSCollectionException(com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) HDSException(com.emc.storageos.hds.HDSException) WBEMException(javax.wbem.WBEMException) IOException(java.io.IOException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException)

Aggregations

DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)4 HDSException (com.emc.storageos.hds.HDSException)4 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)4 SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)4 HDSCollectionException (com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException)4 IOException (java.io.IOException)4 WBEMException (javax.wbem.WBEMException)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 HDSApiClient (com.emc.storageos.hds.api.HDSApiClient)2 StorageArray (com.emc.storageos.hds.model.StorageArray)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)1 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 Namespace (com.emc.storageos.plugins.common.domainmodel.Namespace)1