commit | a291ce1acfc8935dc69675c2e29bf1dee4f68ccd | [log] [tgz] |
---|---|---|
author | Matt Spinler <spinler@us.ibm.com> | Mon Feb 06 15:12:44 2023 -0600 |
committer | Matt Spinler <spinler@us.ibm.com> | Mon Feb 06 15:30:25 2023 -0600 |
tree | 69ecd89ee1904716e7538e543078527b4fe2e227 | |
parent | 8859c84bdc1f994405cf617accc3d0f47801587a [diff] |
Fixes around persisting values in entity-manager This fixes three problems that were causing "Faild to set dbus property." error traces to show up. 1. In VirtualSensor::createThresholds() the setEntityPath() and setEntityInterfaceHigh/Low() calls have to be made on the threshold objects before the critical/warning/High/Low() functions are called so that the path and interface is known for the property set call. Reorder the code so this is the case. 2. Saving the value in entity-manager only works when the virtual sensor config was obtained from entity-manager D-Bus objects, and not when it was obtained from virtual_sensor_config.json. In the latter case, the 'entityPath' variable won't have a value, so check for that before trying to set a property on entity-manager. 3. If either a 'high' or 'low' threshold property isn't set, then the 'entityInterfaceHigh/Low' variable will be empty. Also skip the property write in that case. Tested: No more error traces, and verified that changing a threshold value on a virtual sensor is still reflected in entity-manager when its config was from EM in the first place. Change-Id: I67dc35fb4b8f4c1367231e22ddde91fbd1bb354d Signed-off-by: Matt Spinler <spinler@us.ibm.com>
phosphor-virtual-sensor reads in virtual_sensor_config.json There are two types of data in this file:
See virtual_sensor_config.json in this repository for an example. Sensors added this way can use any expression that is accepted by exprtk.
For example:
{ "Desc": { "Config": "D-Bus", "Type": "ModifiedMedian" } }
Sensors added this way can only use a set of restricted calculations. At this stage the only type supported is modifiedMedian.
The virtual sensor configuration information needs to be added into the relevant hardware configuration file in entity-manager. This method of adding a virtual sensor allows a recipe that builds for different hardware configurations to have different virtual sensors for each configuration.
The virtual sensor configuration in entity manager follows a different format to the JSON in virtual_sensor_config.json (specified in entity-manager/schemas/VirtualSensor.json).