Search in sources :

Example 1 with StorageAlarm

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;
}
Also used : Volume(com.emc.storageos.vasa.data.internal.Volume) HighAvailabilityVolume(com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolume) StorageAlarm(com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm) ArrayList(java.util.ArrayList)

Example 2 with StorageAlarm

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;
}
Also used : NameValuePair(com.vmware.vim.vasa._1_0.data.xsd.NameValuePair) StorageAlarm(com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 3 with StorageAlarm

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;
}
Also used : NameValuePair(com.vmware.vim.vasa._1_0.data.xsd.NameValuePair) StorageAlarm(com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm)

Aggregations

StorageAlarm (com.vmware.vim.vasa._1_0.data.xsd.StorageAlarm)3 NameValuePair (com.vmware.vim.vasa._1_0.data.xsd.NameValuePair)2 Volume (com.emc.storageos.vasa.data.internal.Volume)1 HighAvailabilityVolume (com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolume)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1