Search in sources :

Example 1 with RecordableBourneEvent

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent 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 RecordableBourneEvent

use of com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent 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 RecordableBourneEvent

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

the class StoragePortService method recordStoragePortEvent.

/**
 * Record Bourne Event for the completed operations
 *
 * @param type
 * @param type
 * @param description
 * @param storagePort
 */
private void recordStoragePortEvent(OperationTypeEnum opType, String description, URI storagePort) {
    String evType;
    evType = opType.getEvType(true);
    RecordableBourneEvent event = new RecordableBourneEvent(/* String */
    evType, /* tenant id */
    null, /* user id ?? */
    URI.create("ViPR-User"), /* project ID */
    null, /* VirtualPool */
    null, /* service */
    EVENT_SERVICE_TYPE, /* resource id */
    storagePort, /* description */
    description, /* timestamp */
    System.currentTimeMillis(), /* extensions */
    "", /* native guid */
    null, /* record type */
    RecordType.Event.name(), /* Event Source */
    EVENT_SERVICE_SOURCE, /* Operational Status codes */
    "", /* Operational Status Descriptions */
    "");
    try {
        _evtMgr.recordEvents(event);
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}. Error: {}.", description, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) BadRequestException(com.emc.storageos.svcs.errorhandling.resources.BadRequestException)

Example 4 with RecordableBourneEvent

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

the class ProjectService method recordProjectEvent.

/**
 * Create an event based on the project
 *
 * @param project for which the event is about
 * @param opType Type of event such as ProjectCreated, ProjectDeleted
 * @param opStatus
 */
public void recordProjectEvent(Project project, OperationTypeEnum opType, Boolean opStatus) {
    String type = opType.getEvType(opStatus);
    String description = opType.getDescription();
    _log.info("opType: {} detail: {}", opType.toString(), type + ':' + description);
    RecordableBourneEvent event = new RecordableBourneEvent(type, project.getTenantOrg().getURI(), URI.create(getUserFromContext().getName()), project.getId(), null, EVENT_SERVICE_TYPE, project.getId(), description, System.currentTimeMillis(), // extensions
    "", "", RecordType.Event.name(), EVENT_SERVICE_SOURCE, "", "");
    try {
        _evtMgr.recordEvents(event);
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}. Error: {}.", description, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 5 with RecordableBourneEvent

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

the class StoragePoolService method recordStoragePoolEvent.

/**
 * Record Bourne Event for the completed operations
 *
 * @param type
 * @param type
 * @param description
 * @param storagePort
 */
private void recordStoragePoolEvent(OperationTypeEnum opType, String description, URI storagePool) {
    String evType;
    evType = opType.getEvType(true);
    RecordableBourneEvent event = new RecordableBourneEvent(/* String */
    evType, /* tenant id */
    null, /* user id ?? */
    URI.create("ViPR-User"), /* project ID */
    null, /* VirtualPool */
    null, /* service */
    EVENT_SERVICE_TYPE, /* resource id */
    storagePool, /* description */
    description, /* timestamp */
    System.currentTimeMillis(), /* extensions */
    "", /* native guid */
    null, /* record type */
    RecordType.Event.name(), /* Event Source */
    EVENT_SERVICE_SOURCE, /* Operational Status codes */
    "", /* Operational Status Descriptions */
    "");
    try {
        _evtMgr.recordEvents(event);
    } catch (Exception ex) {
        _log.error("Failed to record event. Event description: {}. Error: {}.", description, ex);
    }
}
Also used : RecordableBourneEvent(com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Aggregations

RecordableBourneEvent (com.emc.storageos.volumecontroller.impl.monitoring.RecordableBourneEvent)24 RecordableEventManager (com.emc.storageos.volumecontroller.impl.monitoring.RecordableEventManager)15 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)13 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)10 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)7 Volume (com.emc.storageos.db.client.model.Volume)5 ControllerException (com.emc.storageos.volumecontroller.ControllerException)5 WorkflowException (com.emc.storageos.workflow.WorkflowException)4 IOException (java.io.IOException)4 URISyntaxException (java.net.URISyntaxException)4 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)3 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)3 FileShare (com.emc.storageos.db.client.model.FileShare)3 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)2 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)2 VplexMirror (com.emc.storageos.db.client.model.VplexMirror)2 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)2 WBEMException (javax.wbem.WBEMException)2