Search in sources :

Example 1 with CimConnection

use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getVnxFileSMISConnection.

/**
 * Check and add valid SMIS connection for storage system to ConnectionManager.
 *
 * @param accessProfile
 *            : AccessProfile for the providers
 * @param StorageSystem
 *            : Storage system
 * @return boolean : true if connection can be establish
 */
private boolean getVnxFileSMISConnection(AccessProfile accessProfile, StorageSystem system) {
    try {
        final CIMConnectionFactory connectionFactory = (CIMConnectionFactory) accessProfile.getCimConnectionFactory();
        // getConnection method also add the valid connection to connection manager.
        CimConnection cxn = connectionFactory.getConnection(system);
        if (cxn != null && connectionFactory.checkConnectionliveness(cxn)) {
            return true;
        }
    } catch (final Exception ex) {
        _logger.error("Not able to get CIMOM Client instance for provider ip {} due to ", system.getSmisProviderIP(), ex);
    }
    return false;
}
Also used : CIMConnectionFactory(com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory) CimConnection(com.emc.storageos.cimadapter.connections.cim.CimConnection) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) IOException(java.io.IOException) VNXFileCollectionException(com.emc.storageos.plugins.metering.vnxfile.VNXFileCollectionException)

Example 2 with CimConnection

use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.

the class CIMConnectionFactory method refreshConnections.

/**
 * Refresh the SMISProvider connections. This will be called after loading
 * the SMIS Provider information from DB.
 *
 * @param smisproviderList
 *            : List of SMISProvider.
 * @return List<URI> : returns the list of active provider URIs.
 */
public List<URI> refreshConnections(final List<StorageProvider> smisProviderList) {
    _log.debug("In refreshConnections()");
    List<URI> activeProviderURIList = new ArrayList<URI>();
    for (StorageProvider smisProvider : smisProviderList) {
        try {
            CimConnection connection = getConnection(smisProvider.getIPAddress(), smisProvider.getPortNumber().toString());
            if (null == connection) {
                _log.error("No CIMOM connection found for ip/port {}", ConnectionManager.generateConnectionCacheKey(smisProvider.getIPAddress(), smisProvider.getPortNumber()));
                // No need to add connection, as getConnection() called from any thread would create it.
                continue;
            }
            validateProviderConnection(smisProvider, connection, activeProviderURIList);
        } catch (final DatabaseException ex) {
            _log.error("DatabaseException occurred while fetching the storageDevice for {} due to ", smisProvider.getId(), ex);
        } catch (final ConnectionManagerException ex) {
            _log.error("No CIMOM Connection found for ipaddress due to ", ex);
        } catch (final Exception ex) {
            _log.error("Exception while refreshing connections due to ", ex);
        }
    }
    return activeProviderURIList;
}
Also used : ArrayList(java.util.ArrayList) CimConnection(com.emc.storageos.cimadapter.connections.cim.CimConnection) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) IOException(java.io.IOException)

Example 3 with CimConnection

use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.

the class CIMConnectionFactory method subscribeVnxFileForIndication.

/**
 * Make subscription to the given vnxfile storageSystem for monitoring use case
 *
 * @param smisProviderURI {@link String} vnxfile StorageSystem's URI for subscription
 * @return success flag. True means subscription for the given storageSystem is success, else returns false
 */
public boolean subscribeVnxFileForIndication(String storageSystemURI) {
    _log.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    boolean isSuccess = false;
    try {
        _log.debug("storageSystemURI :{}", storageSystemURI);
        StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, URI.create(storageSystemURI));
        CimConnection cimConnection = getConnection(storageDevice);
        if (null != cimConnection) {
            _connectionManager.subscribe(cimConnection);
            isSuccess = true;
        }
    } catch (Exception e) {
        _log.error("subscription for the StoargeSystem {} is failed", storageSystemURI);
        _log.error(e.getMessage(), e);
    // throw e;
    }
    _log.debug("vnx file subscription status :{}", isSuccess);
    _log.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    return isSuccess;
}
Also used : CimConnection(com.emc.storageos.cimadapter.connections.cim.CimConnection) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) IOException(java.io.IOException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 4 with CimConnection

use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.

the class CIMConnectionFactory method deleteVnxFileStaleSubscriptions.

public boolean deleteVnxFileStaleSubscriptions(String storageSystemURI) {
    _log.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    boolean isSuccess = false;
    try {
        _log.debug("storageSystemURI :{}", storageSystemURI);
        StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, URI.create(storageSystemURI));
        CimConnection cimConnection = getConnection(storageDevice);
        if (null != cimConnection) {
            _connectionManager.deleteStaleSubscriptions(cimConnection);
            isSuccess = true;
        }
    } catch (Exception e) {
        _log.error("Delete stale subscription for the vnx file {} is failed", storageSystemURI);
        _log.error(e.getMessage(), e);
    // throw e;
    }
    _log.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    return isSuccess;
}
Also used : CimConnection(com.emc.storageos.cimadapter.connections.cim.CimConnection) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) IOException(java.io.IOException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 5 with CimConnection

use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.

the class CIMConnectionFactory method unsubscribeSMIProviderConnection.

/**
 * Un-Subscribe connection for the given Passive SMIS provider
 *
 * @param smisProviderURI {@link String} Passive SMIS Provider's URI
 * @return success flag. True means unsubscription for the given smisProvider is success, else returns false
 */
public boolean unsubscribeSMIProviderConnection(String smisProviderURI) {
    _log.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    boolean isSuccess = false;
    try {
        _log.debug("Un-Subscribe initiated for SMIS provider :{}", smisProviderURI);
        CimConnection cimConnection = getSMISProviderConnection(smisProviderURI);
        if (null != cimConnection) {
            _connectionManager.unsubscribe(cimConnection);
            isSuccess = true;
        }
    } catch (Exception e) {
        _log.error("Un-subscription for the SMIS provider {} is failed", smisProviderURI);
        _log.error(e.getMessage(), e);
    // throw e;
    }
    _log.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    return isSuccess;
}
Also used : CimConnection(com.emc.storageos.cimadapter.connections.cim.CimConnection) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) IOException(java.io.IOException)

Aggregations

CimConnection (com.emc.storageos.cimadapter.connections.cim.CimConnection)45 WBEMException (javax.wbem.WBEMException)24 WBEMClient (javax.wbem.client.WBEMClient)24 CIMObjectPath (javax.cim.CIMObjectPath)20 CIMInstance (javax.cim.CIMInstance)16 IOException (java.io.IOException)13 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 ArrayList (java.util.ArrayList)12 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)10 ConnectionManagerException (com.emc.storageos.cimadapter.connections.ConnectionManagerException)9 Volume (com.emc.storageos.db.client.model.Volume)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)8 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)6 CIMArgument (javax.cim.CIMArgument)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)5 URI (java.net.URI)5 BlockObject (com.emc.storageos.db.client.model.BlockObject)4 StoragePool (com.emc.storageos.db.client.model.StoragePool)4 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)3 ExportMask (com.emc.storageos.db.client.model.ExportMask)3