| commit | 7f3a70f0f57b14b2d5c2215f1c1bbf71c1187e75 | [log] [tgz] |
|---|---|---|
| author | Lei YU <yulei.sh@bytedance.com> | Tue Dec 07 16:40:40 2021 +0800 |
| committer | Vernon Mauery <vernon.mauery@linux.intel.com> | Wed Jan 12 00:40:31 2022 +0000 |
| tree | ff6217d29de9caf9892e7c471f858618bac61d7d | |
| parent | 8e8152c5cebfe278086fced75cbc64ecb4b5046b [diff] |
sensor-cache: Invalidate cache when sensor disappears
When a sensor disappears from DBus, invalidate the cache.
Ideally it could be done by adding a match for interfacesRemoved
signal.
However, interfacesRemoved signal is not emitted if a service is
terminated or crashed, so we have to use nameOwnerChanged signal
as well. The `nameOwnerChanged` signal does not provide DBus object's
information, so the code needs to record the relationship between sensor
ids and the services, so that when the event occurs, it knows which
sensors should be invalidated.
Tested: Manually stop virtual-sensor, and verify the related sensors are
shown as `na` in ipmitool sensor list:
total_power | na | | na | na | na | na | na | na | na
Restart virtual-sensor, and verify the related sensors have
valid readings:
total_power | 510.000 | Watts | ok | na | na | na | na | na | na
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If145a1cd163477c3aca3fd17f3dbde96263f6b75
To build this package, do the following steps:
1. ./bootstrap.sh
2. ./configure ${CONFIGURE_FLAGS}
3. make
To clean the repository run ./bootstrap.sh clean.