use of com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm in project coprhd-controller by CoprHD.
the class SOSAlarmManager method getThinProvisionAlarms.
public List<StorageAlarm> getThinProvisionAlarms(SyncManager manager, List<Volume> volumeList, long lastAlarmId) throws StorageFault {
final String methodName = "getThinProvisionAlarms(): ";
log.debug(methodName + " Entry with last alarm id[" + lastAlarmId + "]");
StorageAlarm alarm = null;
List<StorageAlarm> alarmList = new ArrayList<StorageAlarm>();
String status = null;
String resourceId = null;
String resourceType = null;
if (volumeList != null && !volumeList.isEmpty()) {
for (Volume volume : volumeList) {
resourceId = volume.getId();
resourceType = EntityTypeEnum.StorageLun.getValue();
status = this.getThinlyProvisionedStatus(manager, volume);
if (isThinlyProvisionAlarmRequired(resourceId, status)) {
alarm = this.getAlarmObject(++lastAlarmId, resourceId, resourceType, "Alarm.ThinProvisioned", status, AlarmTypeEnum.SpaceCapacity.getValue(), STATE_KEY, status);
log.debug(methodName + "New alarm generated of id[" + lastAlarmId + "] status[" + status + "] on resource id[" + resourceId + "]");
alarmList.add(alarm);
}
}
}
log.debug(methodName + "Exit returning alarm list of size[" + alarmList.size() + "]");
return alarmList;
}
use of com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm in project coprhd-controller by CoprHD.
the class SOSAlarmManager method getAlarmObject.
public StorageAlarm getAlarmObject(long alarmId, String resourceId, String resourceType, String messageId, String alarmStatus, String alarmType, String msgKey, String msgText) {
StorageAlarm alarm = new StorageAlarm();
alarm.setMessageId(messageId);
alarm.setAlarmId(alarmId);
alarm.setObjectId(resourceId);
alarm.setStatus(alarmStatus);
alarm.setAlarmType(alarmType);
alarm.setObjectType(resourceType);
GregorianCalendar gc = new GregorianCalendar();
gc.setTimeInMillis(new Date().getTime());
alarm.setAlarmTimeStamp(gc);
NameValuePair pair = new NameValuePair();
pair.setParameterName(ALARM_ID_KEY);
pair.setParameterValue(UUID.randomUUID().toString());
alarm.addParameterList(pair);
pair = new NameValuePair();
pair.setParameterName(msgKey);
pair.setParameterValue(msgText);
alarm.addParameterList(pair);
alarm.addParameterList(pair);
return alarm;
}
use of com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm in project coprhd-controller by CoprHD.
the class SOSAlarmManager method isAlarmExistsInQueue.
/**
* It searches the given alarm in the Q.
*
* @return - true, if the alarm already exists in the Q, false, otherwise.
* @param alarm
* -The Event generated in StorageOS. in StorageOS all are
* considered as events.
*/
public boolean isAlarmExistsInQueue(Event alarm) {
Iterator<StorageAlarm> it = getAlarmQ().iterator();
while (it.hasNext()) {
StorageAlarm storageAlarm = it.next();
NameValuePair[] nvpList = storageAlarm.getParameterList();
String alarmId = alarm.getEventId().toString();
for (NameValuePair nvp : nvpList) {
if (nvp.getParameterName().equalsIgnoreCase("SOSAlarmId") && nvp.getParameterValue().equalsIgnoreCase(alarmId)) {
return true;
}
}
}
return false;
}
Aggregations