Search in sources :

Example 1 with RecordableEventManager

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager in project coprhd-controller by CoprHD.

the class FileDeviceController method recordSnapshotEvent.

/**
 * Create a nice event based on the FileShare
 *
 * @param snap
 *            Snapshot for which the event is about
 * @param fs
 *            FileShare from which the snapshot was created
 * @param type
 *            Type of event such as FileShareCreated or FileShareDeleted
 * @param description
 *            Description for the event if needed
 */
public static void recordSnapshotEvent(DbClient dbClient, Snapshot snap, FileShare fs, String type, String description, String extensions) {
    if (snap == null || fs == null) {
        _log.error("Invalid Snapshot event");
        return;
    }
    RecordableEventManager eventManager = new RecordableEventManager();
    eventManager.setDbClient(dbClient);
    // fix the bogus user ID once we have AuthZ working
    RecordableBourneEvent event = new RecordableBourneEvent(type, fs.getTenant().getURI(), // user ID when AAA fixed
    URI.create("ViPR-User"), fs.getProject().getURI(), fs.getVirtualPool(), EVENT_SERVICE_TYPE, snap.getId(), description, System.currentTimeMillis(), extensions, snap.getNativeGuid(), RecordType.Event.name(), EVENT_SERVICE_SOURCE, "", "");
    try {
        eventManager.recordEvents(event);
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}.", description, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) RecordableEventManager(com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 2 with RecordableEventManager

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager in project coprhd-controller by CoprHD.

the class FileDeviceController method recordQuotaDirectoryEvent.

public static void recordQuotaDirectoryEvent(DbClient dbClient, QuotaDirectory quotaDir, FileShare fs, String type, String description, String extensions) {
    if (quotaDir == null || fs == null) {
        _log.error("Invalid quota directory event");
        return;
    }
    RecordableEventManager eventManager = new RecordableEventManager();
    eventManager.setDbClient(dbClient);
    // fix the bogus user ID once we have AuthZ working
    RecordableBourneEvent event = new RecordableBourneEvent(type, fs.getTenant().getURI(), // user ID when AAA fixed
    URI.create("ViPR-User"), fs.getProject().getURI(), fs.getVirtualPool(), EVENT_SERVICE_TYPE, quotaDir.getId(), description, System.currentTimeMillis(), extensions, quotaDir.getNativeGuid(), RecordType.Event.name(), EVENT_SERVICE_SOURCE, "", "");
    try {
        eventManager.recordEvents(event);
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}.", description, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) RecordableEventManager(com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 3 with RecordableEventManager

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager in project coprhd-controller by CoprHD.

the class UnManagedFilesystemService method recordBourneFileSystemEvent.

/**
 * Generate and Record a Bourne filesystem specific event
 *
 * @param dbClient
 * @param evtType
 * @param status
 * @param desc
 * @throws Exception
 */
public void recordBourneFileSystemEvent(DbClient dbClient, String evtType, Operation.Status status, String desc, URI id) throws Exception {
    RecordableEventManager eventManager = new RecordableEventManager();
    eventManager.setDbClient(dbClient);
    FileShare fileShareObj = dbClient.queryObject(FileShare.class, id);
    RecordableBourneEvent event = ControllerUtils.convertToRecordableBourneEvent(fileShareObj, evtType, desc, "", dbClient, EVENT_SERVICE_TYPE, RecordType.Event.name(), EVENT_SERVICE_SOURCE);
    try {
        eventManager.recordEvents(event);
        _logger.info("ViPR {} event recorded", evtType);
    } catch (Exception ex) {
        _logger.error("Failed to record event. Event description: {}. Error:", evtType, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) RecordableEventManager(com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager) FileShare(com.emc.storageos.db.client.model.FileShare) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IOException(java.io.IOException)

Example 4 with RecordableEventManager

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager in project coprhd-controller by CoprHD.

the class UnManagedVolumeService method recordBourneVolumeEvent.

/**
 * Generate and Record a Bourne volume specific event
 *
 * @param dbClient
 * @param evtType
 * @param status
 * @param desc
 * @throws Exception
 */
public void recordBourneVolumeEvent(DbClient dbClient, String evtType, Operation.Status status, String desc, URI id) throws Exception {
    RecordableEventManager eventManager = new RecordableEventManager();
    eventManager.setDbClient(dbClient);
    BlockObject blockObject = null;
    if (URIUtil.isType(id, Volume.class)) {
        blockObject = dbClient.queryObject(Volume.class, id);
    } else if (URIUtil.isType(id, BlockMirror.class)) {
        blockObject = dbClient.queryObject(BlockMirror.class, id);
    } else if (URIUtil.isType(id, BlockSnapshot.class)) {
        blockObject = dbClient.queryObject(BlockSnapshot.class, id);
    }
    RecordableBourneEvent event = ControllerUtils.convertToRecordableBourneEvent(blockObject, evtType, desc, "", dbClient, EVENT_SERVICE_TYPE, RecordType.Event.name(), EVENT_SERVICE_SOURCE);
    try {
        eventManager.recordEvents(event);
        _logger.info("Bourne {} event recorded", evtType);
    } catch (Exception ex) {
        _logger.error("Failed to record event. Event description: {}. Error:", evtType, ex);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) MapUnmanagedVolume(com.emc.storageos.api.mapper.functions.MapUnmanagedVolume) Volume(com.emc.storageos.db.client.model.Volume) RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) RecordableEventManager(com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager) BlockObject(com.emc.storageos.db.client.model.BlockObject) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 5 with RecordableEventManager

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager in project coprhd-controller by CoprHD.

the class BlockConsistencyGroupTaskCompleter method recordBourneBlockConsistencyGroupEvent.

public void recordBourneBlockConsistencyGroupEvent(DbClient dbClient, URI consistencyGroupURI, RecordableEventManager.EventType evtType, Operation.Status status, String desc) throws Exception {
    RecordableEventManager eventManager = new RecordableEventManager();
    eventManager.setDbClient(dbClient);
    BlockConsistencyGroup consistencyGroup = dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupURI);
    RecordableBourneEvent event = ControllerUtils.convertToRecordableBourneEvent(consistencyGroup, evtType.name(), desc, "", dbClient, ControllerUtils.BLOCK_EVENT_SERVICE, RecordType.Event.name(), ControllerUtils.BLOCK_EVENT_SOURCE);
    try {
        eventManager.recordEvents(event);
        _log.info("Bourne {} event recorded", evtType.name());
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}. Error: ", evtType.name(), ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) RecordableEventManager(com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Aggregations

RecordableBourneEvent (com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent)15 RecordableEventManager (com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager)15 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)12 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)5 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)5 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)5 Volume (com.emc.storageos.db.client.model.Volume)4 ControllerException (com.emc.storageos.volumecontroller.ControllerException)3 WorkflowException (com.emc.storageos.workflow.WorkflowException)3 URISyntaxException (java.net.URISyntaxException)3 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)2 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 FileShare (com.emc.storageos.db.client.model.FileShare)2 MapUnmanagedVolume (com.emc.storageos.api.mapper.functions.MapUnmanagedVolume)1 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 DataObject (com.emc.storageos.db.client.model.DataObject)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)1 VplexMirror (com.emc.storageos.db.client.model.VplexMirror)1