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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations