Purpose of the feature
In the current CS code alerts are being published by:
- CloudStack orchestration layer
- CloudStack plugins (hypervisor and networking)
- CloudStack services (Usage service)
The alert is generated by calling the method sendAlert in the AlertManager directly. So it suffices only scenarios when plugin/service is placed on the same server where the MS runs to be able to use cloud-engine* jar. We can assume that 1) and 2) would always get deployed this way, but we can't expect services to run on the same host as MS. So the feature would enable alert publishing for:
- ConsoleProxy and SecondaryStorage vm services
- Usage service when run on a separate storage
- Any other new service contributed to the CS source base
Java changes
- Create interface AlertService, place it under cloud-api package
- Add new method to the AlertService - generateAlert. Method signature:
boolean generateAlert(AlertType alertType, long dataCenterId, Long podId, String msg);
- Refactor alertType implementation. AlertType will be represented as an innerclass in AlertService interface. The class will have 2 fields - type (short) and name (String).
- Change the signature for sendAlert to accept AlertType parameter type instead of short alertType
Web API changes
- Add new field to the AlertResponse - "name"
- New API:
ApiName |
Description |
|
Request parameters
|
|
|
Response parameters
|
|
|
Available to regular user |
|
generateAlert |
Generates and publishes an alert |
- type (required, type=Short)- alert type
- name (required, type=String) - alert name
- description (required, type=String) - alert description
- podId (optional, type=UUID) - podId for which alert is being generated
- zoneId (optional, type=UUID) - zoneId for which alert is being generated
|
true/false |
No |