metric-collector: Update reboot time if LastRebootTime changed

After
https://gerrit.openbmc.org/c/openbmc/phosphor-state-manager/+/66936 is
in, the LastRebootTime can change once the timsync happens. This is
needed becuase it is possible tha the lastRebootTime at bootup is less
than the saved value from the previous reboot in a reboot loop. This
allows us to update the count after timesync to make sure that we have
the proper lastRebootTime.

Example failures:
After the system rebooted, the reboot count wasn't updated. Restart the
metric-collector and found that the current reboot time doesn't match
the one that was saved...

```
$ /tmp/metric-collector
current reboot time: 1704819274000 vs. saved reboot time: 1704819146000
```

Suggesting that the reboot time fetched pre-timesync was less than the
saved reboot time. With the signal matcher, the new reboot time will
be used and update the count properly.

Tested:
```
root@dddev2-nfd01:~# busctl  get-property xyz.openbmc_project.State.BMC /xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC LastRebootTime
t 1704859755000

root@dddev2-nfd01:~# cat /var/google/bootinfo
11 0 1704859755000

root@dddev2-nfd01:~# systemctl status phosphor-metric-collector.service
● phosphor-metric-collector.service - BMC Metric Collection
     Loaded: loaded (/usr/lib/systemd/system/phosphor-metric-collector.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-01-09 20:17:06 PST; 3min 38s ago
   Main PID: 4256 (metric-collecto)
        CPU: 3.340s
     CGroup: /system.slice/phosphor-metric-collector.service
             └─4256 /usr/bin/metric-collector

Jan 09 20:17:06 dddev2-nfd01.prod.google.com systemd[1]: Started BMC Metric Collection.
root@dddev2-nfd01:~# systemctl status xyz.openbmc_project.State.BMC
● xyz.openbmc_project.State.BMC.service - Phosphor BMC State Manager
     Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.State.BMC.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-01-09 20:07:39 PST; 13min ago
   Main PID: 437 (phosphor-bmc-st)
        CPU: 300ms
     CGroup: /system.slice/xyz.openbmc_project.State.BMC.service
             └─437 /usr/bin/phosphor-bmc-state-manager

```


Google-Bug-Id: 313338463
Change-Id: Idd13f28dc238c6803281d3195e2dd63bf680a94e
Signed-off-by: Willy Tu <wltu@google.com>
(cherry picked from commit ce4946a231a417b92a30f34f407f3d482fa594d1)
1 file changed
tree: fb0975b058fd79249c76dc16049cabfe61de6e12
  1. conf/
  2. dynamic-layers/
  3. recipes-bsp/
  4. recipes-connectivity/
  5. recipes-core/
  6. recipes-devtools/
  7. recipes-extended/
  8. recipes-google/
  9. recipes-kernel/
  10. recipes-phosphor/
  11. LICENSE
  12. README.md
README.md

meta-gbmc-staging

This repository contains additions to the openbmc/meta-google layer that are not yet ready for OpenBMC inclusion.

How to use this layer

  1. Clone openbmc/openbmc from GitHub.
  2. Clone this layer from GitHub into a subdirectory of openbmc.