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