use of com.emc.storageos.volumecontroller.StorageMonitorException in project coprhd-controller by CoprHD.
the class CimStorageMonitor method stopMonitoring.
/**
* Stops event monitoring for the passed storage device by removing the
* connection to the SMI-S provider for storage device.
*
* @param storageDevice A reference to the storage device.
*
* @throws StorageMonitorException When an error occurs stopping monitoring
* for the device.
*/
@Override
public void stopMonitoring(StorageSystem storageDevice) throws StorageMonitorException {
s_logger.debug("Disconnecting storage from event monitoring.");
// Verify we got a non-null storage device.
if (storageDevice == null) {
throw new StorageMonitorException("Passed storage device is null");
}
s_logger.info("Attempting to disconnect storage provider {} from event monitoring.", storageDevice.getSmisProviderIP());
// Verify the CIM connection manager reference
if (_cimConnectionManager == null) {
throw new StorageMonitorException("CIM adapter connection manager reference is null.");
}
// passed provider is currently being managed.
try {
_cimConnectionManager.removeConnection(storageDevice.getSmisProviderIP(), storageDevice.getSmisPortNumber());
} catch (ConnectionManagerException cme) {
throw new StorageMonitorException(MessageFormatter.format("Failed attempting to remove the connection to storage provider {}", storageDevice.getSmisProviderIP()).getMessage(), cme);
}
s_logger.info("Connection to storage provider {} was removed.", storageDevice.getSmisProviderIP());
}
use of com.emc.storageos.volumecontroller.StorageMonitorException in project coprhd-controller by CoprHD.
the class CimStorageMonitor method startMonitoring.
/**
* Starts event monitoring for the passed storage device by creating a
* connection to the SMI-S provider for the storage device.
*
* @param storageDevice A reference to the storage device.
*
* @throws StorageMonitorException When an error occurs monitoring the
* device.
*/
@Override
public void startMonitoring(StorageSystem storageDevice, WorkPool.Work work) throws StorageMonitorException {
s_logger.debug("Connecting storage for event monitoring. {}", storageDevice.getSystemType());
// Verify we got a non-null storage device.
if (storageDevice == null) {
throw new StorageMonitorException("Passed storage device is null");
}
s_logger.info("Attempting to connect to storage provider {} for event monitoring.", storageDevice.getSmisProviderIP());
// Verify the CIM connection manager reference.
if (_cimConnectionManager == null) {
throw new StorageMonitorException("CIM adapter connection manager reference is null.");
}
// Create the CIM connection info for the connection.
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setHost(storageDevice.getSmisProviderIP());
connectionInfo.setPort(storageDevice.getSmisPortNumber());
connectionInfo.setUser(storageDevice.getSmisUserName());
connectionInfo.setPassword(storageDevice.getSmisPassword());
connectionInfo.setInteropNS(CimConstants.DFLT_CIM_CONNECTION_INTEROP_NS);
connectionInfo.setUseSSL(storageDevice.getSmisUseSSL());
// Set the type of connection to be created.
connectionInfo.setType(getConnectionTypeForDevice(storageDevice.getSystemType()));
// Set the implementation namespace for this type of storage device
connectionInfo.setImplNS(getImplNamespaceForDevice(storageDevice.getSystemType()));
// connection is not already managed.
try {
_cimConnectionManager.addConnection(connectionInfo);
} catch (ConnectionManagerException cme) {
throw new StorageMonitorException(MessageFormatter.format("Failed attempting to establish a connection to storage provider {}.", storageDevice.getSmisProviderIP()).getMessage(), cme);
}
s_logger.info("Connection established for storage provider {}.", storageDevice.getSmisProviderIP());
}
Aggregations