summaryrefslogtreecommitdiffstats
path: root/control
Commit message (Collapse)AuthorAgeFilesLines
* Use setProperty function in fan set speedMatthew Barth2018-05-171-25/+8
| | | | | | | | | | | | | | | | When a fan's target speed is set, using the setProperty function allows for better handling of dbus failures setting the fan target property. If a failure occurs setting this property, a journal entry is created and a DBusPropertyError exception is thrown to allow the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: Fan control application logs an error to the journal and then terminates when a dbus error occurs setting a fan target speed. Change-Id: Ibd4bd8b18b6010727831d97e32c14fd6c681e170 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Throw DBusPropertyError for all property accessesMatthew Barth2018-05-171-0/+8
| | | | | | | | | | | | | On all get/set property functions, when an error occurs performing the access of a property, throw a DBusPropertyError exception containing the identifying parameters of the property. Tested: DBusPropertyError exception occurs on failing to set a property DBusPropertyError exception occurs on failing to get a property Change-Id: I9882d62d75153b4320a8d4a21ba7a52efbdd0af2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* perf: Cache service name for fan target sensorsMatthew Barth2018-05-172-30/+14
| | | | | | | | | | | Cache the service name for each fan target sensor path and use that service when a new target speed is set on the Target property. Tested: Fan target sensor created and set speed functions the same Change-Id: I3e25e355cf5d31ce814a73c801c6f086fa45531a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use shared callMethod function in control managerMatthew Barth2018-05-172-25/+8
| | | | | | | | | | | | | To better handle exit/restart of the fan control application use the shared callMethod function to call systemd's startunit on the fan control ready target. This allows the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: StartUnit on fan control ready target works the same Change-Id: Idce2d8831b4e8de0ef181a0849587e465419f68c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use shared getProperty function in control managerMatthew Barth2018-05-171-51/+7
| | | | | | | | | | | | When the manager checks a getProperty condition for fan control, it should use the shared getProperty function that now returns a DbusMethodError to better exit/restart the fan control application. Tested: Condition check functions the same Change-Id: I37f83ef4273343bd527ac149ac5eee213d0ad63d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* perf: Count state of properties before set speedMatthew Barth2018-05-171-18/+19
| | | | | | | | | | | | Once the number of properties at a given state are at/above the given number allowed, set the fan speed and stop checking the remaining properties. Tested: Action function results are unchanged Change-Id: Icfd347703c973b12f4b7806ea1ba84056f987253 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Enhance precondition function and tracingMatthew Barth2018-05-161-3/+12
| | | | | | | | | | | | | | | | Replace count_if with all_of in the property states match precondition to stop iterating over the group members once a property state does not match. Include additional debug tracing when the precondition passes and fails to help in determining where the precondition causes fans to be at full speed. Tested: Verify debug traces align with precondition state Change-Id: I1c3d8f096a645ac3bfcdfb7b9197682cf7ca52a0 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Move generated code template to fileMatthew Barth2018-05-113-234/+251
| | | | | | | | | | | | | | In preparation of enhancing the generated code format, the template used has been externalized and will continue to be modified in future commits to parse & generate more efficiently. Tested: Generated code remains unchanged Resolves openbmc/phosphor-fan-presence#8 Change-Id: Ifbf718e8a22acb2f2f939bbdcc2e7fe041e9ed58 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Remove property change traceMatthew Barth2018-05-091-5/+0
| | | | | | | | | | | | | | Fan control is required to be configured for all possible temperature sensors within a machine type, however not every configuration of that machine type contains all of those sensors. The trace removed here was filling the journal with unnecessary entries for sensors that are expected to not be present. Tested: Journal entry is not longer traced Change-Id: Iccb85ae7e9463ee03522ce4efde6410ed14a76ca Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Throw custom exceptions on D-Bus method failuresMatt Spinler2018-05-094-20/+36
| | | | | | | | | | | | | | | | | | | | | All 3 fan applications - control, monitor, and presence have cases where it is expected that a getProperty call may fail because a sensor is missing. While the applications already handle this, the InternalFailure exception that was being thrown by the underlying call generates log entries that make it look like something bad happened. The custom exceptions now being thrown do not log anything on creation, but store all of the failing information so that any callers could still log the info if they wanted to. Tested: Boot a water cooled Witherspoon and see the fan presence and monitor applications not look like they are failing. Boot a system without the fan hwmon running, and see fan-control-init still show the fails. Change-Id: Ifd8ad6e3deb492bbaf33f12c7258125dce1e5ea8 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Rename remove object interface functionMatthew Barth2018-04-122-3/+3
| | | | | | | | | | Update the removeObjIntf function name to removeObjectInterface. This was requested per a review comment. Tested: N/A Change-Id: I52589724685bb5b8d92d3da22072b63b43f69a01 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate InterfacesRemoved signal eventsMatthew Barth2018-03-301-4/+12
| | | | | | | | | | | | | | | | | | | | In the case that an interface containing a property used within an event is removed from dbus, that event can subscribe to the InterfacesRemoved signal. When an InterfacesRemoved signal is received by fan control, the corresponding interface (and all associated properties) is removed from the cache used by all events. *Note: This area of signal subscription/handling code generation is intended to be re-worked under openbmc/openbmc#2911. This is the reason for supporting a different yaml layout for the InterfacesRemoved signal. Tested: Generated code constructs InterfacesRemoved signals correctly Resolves openbmc/openbmc#2223 Change-Id: Idc3e8db4e7dc07a2bb6898d3cc30ab775362dd35 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add InterfacesRemoved signal handlingMatthew Barth2018-03-304-0/+129
| | | | | | | | | | | | | | | When an InterfacesRemoved signal is received for a subscribed object path, each interface returned is checked against the interface which was defined for each object on the event. When these are equal, the interface (and all associated properties) are removed from the shared cache of event properties. Tested: Manually added an InterfacesRemoved signal Verified interface was removed from object path in cache Change-Id: I348d82f14e0cfba2b18a81a9f54c6cb06b586797 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Minimize service name mapper lookupsMatthew Barth2018-03-122-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Retrieve the service names from the cached dataset within the zone for a path and interface, updating the cache when not found. This is used when initializing property values and service name owners. Additional performance enhancements to use `GetSubTree` prior to processing a set speed event will be included under openbmc/openbmc#2911. This will keep unnecessary `GetSubTree` lookups from occurring for paths/interfaces that don't exist to further improve upon initializing properties fan control is defined to use. Tested: First path updates service name cache for all paths sharing the same interface First missing interface on a path updates service name cache for all paths sharing that interface Verify mapper lookups for X number of paths sharing the same interface is reduced to (X-(X-1)) NameOwnerChanged events read/update the same set of service name cache Change-Id: Ia235b36ba5ae8cda38342d7521f3d87080c2970a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Cache service names for paths and interfacesMatthew Barth2018-03-122-0/+122
| | | | | | | | | | | | | | | | To lookup a service name for a given path and interface, use GetSubTree to retrieve all the service names from the root path for the interface and add each entry to a cached dataset. Tested: Check that a missing interface's service is added Check that a missing path that exists has its service added Inspect all missing paths for an interface are added Inspect missing interfaces are added to existing service Returned service name matches the service for a path/interface Change-Id: I6db05479e825350198896b2e237882f7ebc58d51 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Make event actions optionalMatthew Barth2018-03-061-2/+5
| | | | | | | | | | | | | | | | | | Event actions should be made optional for events that only require subscribing to group signals. This is in preparation for separating signal and timer based event actions. A use case would be where one event can be used to subscribe to signals that update cached property values without performing an action, and another timer based event performs an action based on those property values the signal event provides. Tested: Events without an action are generated correctly Events without an action are handled correctly and run no action Change-Id: I757a82ce6c45ac637ce7cea8f82a62b98b600e3e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Parse a list of groups with zone conditionsMatthew Barth2018-03-061-198/+219
| | | | | | | | | | | | | | | Set speed events can use a list of groups associated with its actions where each group defines what zone conditions the group should be included in actions. Tested: List a single group within an event List two groups within an event with different zone conditions List two groups within an event in the same zone conditions List more than two groups with different zone conditions Change-Id: Ifba30e116f92d945f8812c15e856a5e772e077f2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add target interface for fan controlLei YU2018-02-265-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Current fan control assumes the use of the FanSpeed interface for fan targets. For fans controlled by pwm, FanPwm interface is added. This commit adds "target_interface" config parameter, so that user can specify the interface for the fan targets. E.g. - inventory: /system/chassis/motherboard/fan0 cooling_zone: 0 cooling_profile: air sensors: - fan0 target_interface: xyz.openbmc_project.Control.FanPwm The config is optional and defaults to FanSpeed, so the current code will not be affected. Tested: Use this config on Romulus, ensures the fan control sets target on FanPwm interface and works fine. Change-Id: I73adccaa770d657b5d7aaeb307917f89588524de Signed-off-by: Lei YU <mine260309@gmail.com>
* Support properties of type stringMatthew Barth2018-01-292-8/+32
| | | | | | | | | | | | Properties used within set speed events may be of type string to trigger an action. These should be handled where the defined type attribute is given as 'std::string' and a parsed value is an instance of python str type. Resolves openbmc/openbmc#292 Change-Id: Ib188e7abc212062a1c61950abaa28434a4726521 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Decreases allowed based on all groupsMatthew Barth2017-12-143-30/+58
| | | | | | | | | | | | | | | For speed decreases to occur, all sensor groups involved with setting a net decrease delta must be below their given t-control low values for the associated zone. This handles the case where one or more sensor groups' temperatures stabilize above their t-control low value, but one or more other sensor groups' temperatures are below their t-control low value which would result in speed decrease requests that could eventually lead to fan speed oscillations. Resolves openbmc/openbmc#2710 Change-Id: I382de5d3f9c3e631a332d49dfcb06e705ff6fc17 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add path to trace for missing propertyMatthew Barth2017-12-111-1/+2
| | | | | | | | When a property can not be found after receiving a property changed signal include the path for the property on the journal entry. Change-Id: Ie0151b943914e02d38bf89760f8a16dc530aa89e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use Ceiling speed as request baseMatthew Barth2017-12-111-0/+5
| | | | | | | | | When determining the request base speed for speed decreases, the current ceiling speed should be used when the request base speed is above the ceiling. Change-Id: Iefc2f1669b853e099fbda15dc8c8983f5f1f269a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Update string compares on signal messagesMatthew Barth2017-12-041-4/+3
| | | | | | | | Resulting from a code review, remove the use of strcmp when comparing a string to a const char* Change-Id: Idcd3f99bf7ca0151f5f1b97c7ccc54d6e8c56f8e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Disable zone move constructorMatthew Barth2017-11-211-1/+1
| | | | | | | | To ensure no future enhancements attempt to store a reference to the zone object that are used to allow zone function calls. Change-Id: I0dc266445abdbce86b5fd505589aa96b7730c29a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Fix indentation from review commentMatthew Barth2017-11-171-3/+3
| | | | | | | https://gerrit.openbmc-project.xyz/#/c/7574/7/control/fan.cpp@89 Change-Id: I572093d1bbe636f5fb4f021b3b8478de19acc673 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use in place init of event dataMatthew Barth2017-11-172-17/+8
| | | | | Change-Id: Ia56acbeaa89423060e65e50eff8accffec5a4631 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Remove empty service nameMatthew Barth2017-11-172-1/+37
| | | | | | | | | | Before refreshing the service names and states for a group, the empty service name should be removed if it exists. An empty service name may exist where upon startup, a particular service was not found for a member or members of a group. Change-Id: I15d224231bb9db0823866393ec1776f793a3c126 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Refresh service states for a groupMatthew Barth2017-11-173-0/+41
| | | | | | | | | | | Prior to an action resulting from missing service owners, all of the services for a group should be refreshed to ensure they are in the most up-to-date state. Ensuring the service states are current allows the action to be correctly taken since owners of services could change at anytime. Change-Id: I59c59c6fcf456fa9c0a733d6406c90ea11f6e2b2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Init zone target speed to current target speedMatthew Barth2017-11-173-1/+36
| | | | | | | | | | | | | | Whenever fan control (control mode) is started, the target speed for each zone should be initialized to the currently set target speed. In the case where a watchdog has triggered the fans to full speed and the target speed does not reflect this, the proper set of set speed events should be configured. In this case, an event could be defined to use the current tach feedback to adjust the target speed prior to account for the real state of the fan speeds. Change-Id: I538644ffc83a6e01469174304d393c889038d066 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set fan speed on missing owner actionMatthew Barth2017-11-172-0/+35
| | | | | | | | | | Sets the zone's fan speeds to a given speed when any service owner associated with an event group is missing. Once all the services are functional and providing the event data again, active fan speed changes are allowed. Change-Id: I318f6114c8d0392432c421f803db07a4683d1097 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set floor to default on missing owner actionMatthew Barth2017-11-174-5/+60
| | | | | | | | | | | | | | An action to set the fan floor speed to the defined default fan floor speed when any services associated to a given group of sensors have terminated. Once those services are functional and providing the sensors, the fan floor is allowed to be set normally again. i.e.) For fan floor speeds based on an ambient sensor, if the service providing the ambient temperature value from the sensor terminates, the default floor for the zone is used as the fan floor speed. Change-Id: I2d58cc9b31051e6b8e5e798c0a736f58f5efe5b1 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Allow timers & embedded actions within an actionMatthew Barth2017-11-171-28/+64
| | | | | | | | | Add support for timer parameters to action functions along with recursively build action functions that are a parameter to an event action. Change-Id: Ic126c8dfc85d5ede5f53034262f8910913e4cdd4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Modify generating event actionsMatthew Barth2017-11-171-15/+10
| | | | | | | | Move to constructing the entire event action parameter string within the python code in prep for additional special parameters. Change-Id: I517ad859813e348cd6781cc9be11ab92fa6cac09 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Action that creates/starts a timerMatthew Barth2017-11-172-0/+85
| | | | | | | | Another action is provided to the timer and is performed when the timer expires. Change-Id: Ie6a06b0d56272a158d74bf03287183f07f00aed8 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer event managementMatthew Barth2017-11-173-4/+121
| | | | | | | | | | Events defined to have timers require the ability to find a timer, add a timer to the event, and removing a timer event entirely. These event timers are intended to allow actions based on the event to be delayed or recurring based on the timer defined. Change-Id: Ieaf26f031c5e5aac9472e92354bfb76392642cb4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer type for set speed event timersMatthew Barth2017-11-173-4/+10
| | | | | | | | This is the first step towards allowing timer driven and/or wrapped actions where the timer interval and type will be defined by the user. Change-Id: If008fda5a2b73117e869f93223e0bfe61290f858 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Fill in NameOwnerChanged signal supportMatthew Barth2017-11-172-3/+38
| | | | | | | | | | A NameOwnerChanged signal message provides three strings containing the service name that has changed along with its old service owner name and new service owner name. These names are then passed along to the handler to find/update the group associated with the changed owner name. Change-Id: I7d67883b010fec5b282bd00a4dcc29629486af00 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate selected handlersMatthew Barth2017-11-171-48/+125
| | | | | | | | The available event handlers are listed within the events yaml and would be selected per event. Change-Id: Ia393009b3a10b6f47f5de9a0e6d44f804576f05a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set/update a service name owner for a groupMatthew Barth2017-11-173-0/+50
| | | | | | | | | Adds a service name associated with a group when the group or given service name is not found within the map of services otherwise updates the service name owner associated with the group. Change-Id: I602ddaa7e06e354e01ea70d6c5c0a45e74a14e99 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Stub NameOwnerChanged signal supportMatthew Barth2017-11-172-0/+87
| | | | | | | | | NameOwnerChanged signals will be used within fan control to configure set speed events for when services providing parameters to the fan control application have unexpectedly terminated. Change-Id: I04f3c7ca2842732e33dc94b0280ad4483f7f1286 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Update event initializationMatthew Barth2017-11-176-151/+199
| | | | | | | | | | | | | | | | Using a null dbus message to the event signal will perform the necessary steps to initialize the event parameters using the given signal handler's function directly. i.e.) In the case for subscribing to PropertiesChanged signals, initially the given property must be read. When the PropertiesChanged signal struct is given a null message, it finds the property, reads the value, and then can perform the given signal handler function directly. This produces the same functional path as receiving a PropertiesChanged signal containing the property value within the message. Change-Id: I35575cfff66eb0305156be786cb1f5536d42bb1c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate selected match strings and signalsMatthew Barth2017-11-074-83/+185
| | | | | | | | | The available matches and their associated signals are now listed within the events yaml and can be added to the list of matches to register for per event. Change-Id: I65f657038afe7c68a421adb4820ea09e275be06d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* DOC ONLY: Add preconditions section descriptionMatthew Barth2017-11-061-0/+6
| | | | | Change-Id: I260319dbfc4cb87bfed8fd724ffc4978f34e7325 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Allow no parameter action functionsMatthew Barth2017-09-281-22/+41
| | | | | | | Action functions are not required to have parameters. Change-Id: I04bf8294d9be9141cc7d8d3183628c94b777154a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Create set request speed base action functionMatthew Barth2017-09-283-166/+235
| | | | | | | | | | | | | | | | | This action function is intended to allow the base request speed to be set to the max value from a group of properties. The base request speed is the base speed used in requesting a new target speed. By default, the base request speed is the current target speed. For example, this action can be used to set the base request speed used in calculating a new target speed to be based on the max tach feedback speed from a group of fans instead of the current target speed. Adding this action function requires the other non-template functions to also be slightly modified due to linker errors. Change-Id: Ibbe9b33678b10cb49466174088a587b27bf56d62 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use speed request base in inc/dec speed changesMatthew Barth2017-09-262-2/+13
| | | | | | | | | For increase and decrease speed changes, the new target speed is calculated from either a set speed request base value or the current target speed by default. Change-Id: Iad1411437a9945af0b9ae85649d487e36586ef2a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Zone function to set requested speed baseMatthew Barth2017-09-181-0/+16
| | | | | | | | The requested speed base is the speed value to base calculations for a new target speed of increases or decreases from. Change-Id: Iea413baa9c24c3240ddaf179b9faa259566f7e08 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* DOC ONLY: Example events yaml format updateMatthew Barth2017-09-181-40/+139
| | | | | | | | Made updates to the example events.yaml to reflect the new format and use. Change-Id: I13b323487565f0c1c29eb97d9ddcf8da3295b21c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set speed event parser updatesMatthew Barth2017-09-181-143/+202
| | | | | | | | | Added some optimizations in the event yaml format to nest set speed events that have the same preconditions and allow multiple actions to be taken within a single set speed event. Change-Id: I21ec395b6c9686e1efd5abc1be48d563480fec5f Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Support a list of actions for a set speed eventMatthew Barth2017-09-184-32/+78
| | | | | | | | | | Each set speed event will contain a list of one-to-many actions to perform for the given event group's property. This reduces the amount of code generated and properly handles property changed events against the group. Change-Id: If2b8c0d0b8ecf6e1c974c43d96e1c6e9e952022b Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
OpenPOWER on IntegriCloud