diff options
author | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-05-16 00:12:22 +0300 |
---|---|---|
committer | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-05-21 04:12:21 +0300 |
commit | 7d1cc387d312e2a8e4844f9d69ab39b042acd5ce (patch) | |
tree | 6b0fa14f9dffaab56a7df0cb2288495feb2bd0d7 /redfish-core/lib/event_service.hpp | |
parent | c3c03fde3112bfaff25eaff296cc3a74a3648192 (diff) | |
download | bmcweb-7d1cc387d312e2a8e4844f9d69ab39b042acd5ce.tar.xz |
EventService: Add enable/disable support
Add EventService enable/disable support.
When EventService is enabled
- Check for no of event log subscribers and then
only process events async sending.
- Check for no of metric report subscribers
and register for metric report signal.
When EventService is disabled
- Discard the inotify event for redfish logs.
- Unregister the metric report signal.
Tested:
- Modified ServieEnabled, DeliveryRetryAttempts,
DeliveryRetryInterval values using patch and
it reflects on subsequent gets.
- Above mentioned functionality tested with Service
enabled & disabled modifications.
- Ran redfish validator successfully.
Change-Id: Id049860a89d3040d859ac8907e7bad5b4209b73d
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Diffstat (limited to 'redfish-core/lib/event_service.hpp')
-rw-r--r-- | redfish-core/lib/event_service.hpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp index 63302d6072..b88cb43a19 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -61,13 +61,15 @@ class EventService : public Node "EventService.SubmitTestEvent"}}}}}, {"@odata.id", "/redfish/v1/EventService"}}; - asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; - asyncResp->res.jsonValue["ServiceEnabled"] = - EventServiceManager::getInstance().enabled; - asyncResp->res.jsonValue["DeliveryRetryAttempts"] = - EventServiceManager::getInstance().retryAttempts; + const auto& [enabled, retryAttempts, retryTimeoutInterval] = + EventServiceManager::getInstance().getEventServiceConfig(); + + asyncResp->res.jsonValue["Status"]["State"] = + (enabled ? "Enabled" : "Disabled"); + asyncResp->res.jsonValue["ServiceEnabled"] = enabled; + asyncResp->res.jsonValue["DeliveryRetryAttempts"] = retryAttempts; asyncResp->res.jsonValue["DeliveryRetryIntervalSeconds"] = - EventServiceManager::getInstance().retryTimeoutInterval; + retryTimeoutInterval; asyncResp->res.jsonValue["EventFormatTypes"] = supportedEvtFormatTypes; asyncResp->res.jsonValue["RegistryPrefixes"] = supportedRegPrefixes; } @@ -88,9 +90,12 @@ class EventService : public Node return; } + auto [enabled, retryCount, retryTimeoutInterval] = + EventServiceManager::getInstance().getEventServiceConfig(); + if (serviceEnabled) { - EventServiceManager::getInstance().enabled = *serviceEnabled; + enabled = *serviceEnabled; } if (retryAttemps) @@ -104,8 +109,7 @@ class EventService : public Node } else { - EventServiceManager::getInstance().retryAttempts = - *retryAttemps; + retryCount = *retryAttemps; } } @@ -120,12 +124,12 @@ class EventService : public Node } else { - EventServiceManager::getInstance().retryTimeoutInterval = - *retryInterval; + retryTimeoutInterval = *retryInterval; } } - EventServiceManager::getInstance().updateSubscriptionData(); + EventServiceManager::getInstance().setEventServiceConfig( + std::make_tuple(enabled, retryCount, retryTimeoutInterval)); } }; |