sensor->inventory associations in phosphor-hwmon
Matt Spinler
mspinler at linux.ibm.com
Thu Feb 21 03:56:28 AEDT 2019
Hi,
We have a need to know which sensor objects hosted by the various phosphor-hwmon
daemons belong to which inventory objects. For example, we need to know that
the /xyz/openbmc_project/sensors/power/ps1_input_power sensor belongs to the
/xyz/openbmc_project/inventory/system/powersupply1 item.
To accomplish this, I am proposing we add a new environment variable to the
system specific phosphor-hwmon config files that the phosphor-hwmon code
can then use to create associations interfaces that will cause the mapper to
create the appropriate association D-Bus paths.
As an example, we could add to the power-supply1 conf file an ASSOCIATIONS
variable for each sensor (assuming ps1_input_power is represented by IN1):
ASSOCIATIONS_IN1=/xyz/openbmc_project/inventory/system/powersupply1
The code would then see that and create a new org.openbmc.Associations interface
on the /xyz/openbmc_project/sensors/power/ps1_input_power path with an
associations property of:
["inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/powersupply1"]
This leads to the mapper creating:
/xyz/openbmc_project/sensors/power/ps1_input_power/inventory
With an xyz.openbmc_project.Association interface with an
endpoints property of:
["/xyz/openbmc_project/inventory/system/powersupply1"]
And also the other association path:
/xyz/openbmc_project/inventory/system/powersupply1/sensors
With an xyz.openbmc_project.Association interface with an
endpoints property of:
["/xyz/openbmc_project/sensors/power/ps1_input_power"]
This now allows one to both find all sensors associated with a power supply, and
find which inventory item is associated with a particular sensor. Note that
the endpoints property is an array, and can get entries from multiple places.
I suppose we could also put the forward/reverse association names, in this case
"inventory" and "sensors", into the hwmon config file, and also allow creating
multiple associations for each sensor if there is a usecase, though I would like
to keep it as simple as possible:
ASSOCIATIONS1_IN1=inventory,sensors,/xyz/openbmc_project/inventory/system/powersupply1
ASSOCIATIONS2_IN1=chassis,contained_sensors,/xyz/openbmc_project/inventory/system/chassis
What does everyone think?
Thanks
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20190220/2e13df29/attachment-0001.htm>
More information about the openbmc
mailing list