History log of /openbmc/phosphor-time-manager/utils.hpp (Results 1 – 19 of 19)
Revision Date Author Comments
# e101030b 01-Apr-2024 Jason Zhu <zhujiesen@bytedance.com>

Synchronize NTP settings with systemd-timedated

Bmcweb get/set the "NTP settings" on phosphor-settings.
phosphor-time-manager and phosphor-settings are responsible to sync the
settings with systemd-

Synchronize NTP settings with systemd-timedated

Bmcweb get/set the "NTP settings" on phosphor-settings.
phosphor-time-manager and phosphor-settings are responsible to sync the
settings with systemd-timedated. So the services like bmcweb and ipmid
will only have to get/set the property on phosphor-settings.

However, in order to avoid a race condition issue with NTP set, bmcweb
now directly uses systemd instead of routing through phosphor-settings.
As a result, there may be differences in the "NTP settings" between
phosphor-setttings and systemd-timedated. To address this, this commit
adds a match to monitor time sync method changes on systemd-timedated
and updates it to phosphor-settings.

Tested:
```
1. Get current NTP setting:
busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP
b true

busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod -j
{
"type" : "s",
"data" : "xyz.openbmc_project.Time.Synchronization.Method.NTP"
}

2. Call method in systemd timedate, to change NTP setting:
busctl call org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 SetNTP bb false false

journal log:
phosphor-time-manager[28150]: Time mode has been changed to xyz.openbmc_project.Time.Synchronization.Method.Manual
phosphor-time-manager[28150]: NTP property changed in systemd time service, update to phosphor-settings.
phosphor-time-manager[28150]: NTP mode is already the same, skip setting to systemd time service again.

3. Get NTP setting again, NTP in phosphor-settings is synced with systemd-timedated:
busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP
b false

busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod -j
{
"type" : "s",
"data" : "xyz.openbmc_project.Time.Synchronization.Method.Manual"
}

4. Set property in phosphor-settings, to change NTP setting:
busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "xyz.openbmc_project.Time.Synchronization.Method.NTP"

journal log:
phosphor-time-manager[28150]: Updated NTP setting: True
phosphor-time-manager[28150]: Time mode has been changed to xyz.openbmc_project.Time.Synchronization.Method.NTP
phosphor-time-manager[28150]: NTP property changed in phosphor-settings, update to systemd time service.
phosphor-time-manager[28150]: NTP mode is already the same, skip setting to phosphor-settings again.

5. Get NTP setting again, NTP in phosphor-settings is synced with systemd-timedated:
busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP
b true

busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/time/sync_method xyz.openbmc_project.Time.Synchronization TimeSyncMethod -j
{
"type" : "s",
"data" : "xyz.openbmc_project.Time.Synchronization.Method.NTP"
}
```

Signed-off-by: Jason Zhu <zhujiesen@bytedance.com>
Change-Id: I192d2257569f46aa0f5473331595c5242d816964

show more ...


# dd42c7fa 11-Aug-2022 Pavithra Barithaya <pavithra.b@ibm.com>

Minor changes in the code

- fix a typo in README and wrap file.
- refactoring lg2 errorlog usage.

Change-Id: I3b55b86a505405f02fe70429a266c467b87b17ff
Signed-off-by: Pavithra Barithaya <pavithra.b@

Minor changes in the code

- fix a typo in README and wrap file.
- refactoring lg2 errorlog usage.

Change-Id: I3b55b86a505405f02fe70429a266c467b87b17ff
Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>

show more ...


# dc746c0b 01-Sep-2022 George Liu <liuxiwei@inspur.com>

Move the getSubTree method to utils

Since the getSubTree method is a generic method that users may use
anywhere, It is better to move this method to utils.

Signed-off-by: George Liu <liuxiwei@inspu

Move the getSubTree method to utils

Since the getSubTree method is a generic method that users may use
anywhere, It is better to move this method to utils.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ib6e1367b9885dac38a7ba6b63329977436e70c26

show more ...


# 38679266 22-Jul-2022 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9cedddf4dc9b224ecbc2f68e6b00c0ab1885a826

show more ...


# 947b5346 01-Jul-2022 George Liu <liuxiwei@inspur.com>

logging: switch to lg2

It is recommended to use `phosphor::lg2` to format log, and the
correct `CODE_LINE` and `CODE_FUNC` values can be used in log
tracking.

Signed-off-by: George Liu <liuxiwei@in

logging: switch to lg2

It is recommended to use `phosphor::lg2` to format log, and the
correct `CODE_LINE` and `CODE_FUNC` values can be used in log
tracking.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ic8a400451f96cde5bdb9f47094806bd31adce7d9

show more ...


# 295b96b7 02-Sep-2021 Patrick Williams <patrick@stwcx.xyz>

exception: switch to public sdbus exception

SdBusError was intended to be a private error type inside sdbusplus.
Switch all catch locations to use the general sdbusplus::exception type.

Signed-off-

exception: switch to public sdbus exception

SdBusError was intended to be a private error type inside sdbusplus.
Switch all catch locations to use the general sdbusplus::exception type.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idda02eeec799a0d1b8eef474988e7e4c8d4dc65f

show more ...


# 0a70452a 13-Apr-2020 George Liu <liuxiwei@inspur.com>

Remove Deferred Updates

Remove deferred consumption of settings Manual/NTP and allow instant
consumption.

Tested:
Manually set the timeMode to NTP on the WEB and successfully.
busctl get-property x

Remove Deferred Updates

Remove deferred consumption of settings Manual/NTP and allow instant
consumption.

Tested:
Manually set the timeMode to NTP on the WEB and successfully.
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/sync_method
xyz.openbmc_project.Time.Synchronization TimeSyncMethod
s "xyz.openbmc_project.Time.Synchronization.Method.NTP"

Manually set the date time successfully by D-Bus when timeMode is MANUAL
busctl set-property xyz.openbmc_project.Time.Manager
/xyz/openbmc_project/time/bmc xyz.openbmc_project.Time.EpochTime Elapsed
t 1514765953791262

Manually set the date time failed by D-Bus when timeMode is NTP.
busctl set-property xyz.openbmc_project.Time.Manager
/xyz/openbmc_project/time/bmc xyz.openbmc_project.Time.EpochTime Elapsed
t 1514765953791262
Failed to set property Elapsed on interface
xyz.openbmc_project.TIme.EpochTime: The operation failed

~# journalctl -b | grep timemanager
Jan 01 00:15:26 fp5280g2 phosphor-timemanager[309]: Error in setting
system time
Jan 01 00:15:26 fp5280g2 phosphor-timemanager[309]: The operation
failed

Refer: https://lists.ozlabs.org/pipermail/openbmc/2020-April/021409.html

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I7be25a9d0f56615bad6800a0b07df7f84fc0acc3

show more ...


# 3c2f4496 11-Apr-2020 George Liu <liuxiwei@inspur.com>

Remove TimeOwner Feature

The TimeOwner feature is confusing from feedback from the community and
hence removing the feature.
Remove the TimeOwner feature in the phosphor-time-manager repo and
needed

Remove TimeOwner Feature

The TimeOwner feature is confusing from feedback from the community and
hence removing the feature.
Remove the TimeOwner feature in the phosphor-time-manager repo and
needed settings objects.

Tested: Manually set the date time on the web and successfully update
the date time of BMC (eg: 2020/01/01 08:07:50).
busctrl get-property xyz.openbmc_project.Time.Manager
/xyz/openbmc_project/time/bmc
xyz.openbmc_project.Time.EpochTime Elapsed
t 1577837156385836

Refer: https://lists.ozlabs.org/pipermail/openbmc/2020-April/021409.html

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Id47eb0a03e0e94eeff29d2b77dccefb89cded7b8

show more ...


# c09ac3fa 13-May-2020 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: replace message::variant with std::variant

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ifeb64ec42f9210b5640754e8a065d954f617ca44


# 5b746c79 13-May-2020 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: remove deprecated variant_ns

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I4c8f4a9e1d18effb21cbbfe784e695832fa4ff4f


# 1f1d8e01 06-Nov-2018 William A. Kennington III <wak@google.com>

Fix std::variant usage

We need to conform to the std::variant interface instead of the mapbox
specific one.

Change-Id: I3edbcb2682ddfebfcbca6e75284b11f2e18cfd11
Signed-off-by: William A. Kennington

Fix std::variant usage

We need to conform to the std::variant interface instead of the mapbox
specific one.

Change-Id: I3edbcb2682ddfebfcbca6e75284b11f2e18cfd11
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...


# ab4cc6a5 14-Sep-2018 Gunnar Mills <gmills@us.ibm.com>

clang-format: Update to match docs repo

Update the .clang-format file and run clang-format-6.0.
This .clang-format matches the example one in
https://github.com/openbmc/docs/blob/master/cpp-style-an

clang-format: Update to match docs repo

Update the .clang-format file and run clang-format-6.0.
This .clang-format matches the example one in
https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting

Change-Id: Ic2c462525eb27b8295c2b298871e04268d93faf2
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 86c83f38 13-Jul-2018 Lei YU <mine260309@gmail.com>

Throw runtime_error instead of MethodEror

As suggested, when error occurs in getService/getProperty, it means
runtime error, so the code is better to throw std::runtime_error instead
of a sdbusplus

Throw runtime_error instead of MethodEror

As suggested, when error occurs in getService/getProperty, it means
runtime error, so the code is better to throw std::runtime_error instead
of a sdbusplus exception.

Tested: Build the code correctly.

Change-Id: Iddca72ac1fdd07ed6b731b6509eebbfa9d2579d3
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...


# ad14354f 25-Jul-2017 Lei YU <mine260309@gmail.com>

Use time mode owner enums in dbus interface

Dbus interface defines time mode owners in xyz::openbmc_project::Time.
Use the enums from the interface instead of repo defined enums and use
the generate

Use time mode owner enums in dbus interface

Dbus interface defines time mode owners in xyz::openbmc_project::Time.
Use the enums from the interface instead of repo defined enums and use
the generated code to do convertions between strings and enums.

Update unit tests accordingly.

Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...


# 86d80419 12-Jul-2017 Lei YU <mine260309@gmail.com>

Use elog to throw exceptions

Use elog to throw exceptions and update unit tests

Change-Id: I338ded4403b3b559a84da311eda5ee15e712569a
Signed-off-by: Lei YU <mine260309@gmail.com>


# dd8e9e40 19-Apr-2017 Lei YU <mine260309@gmail.com>

Use mapper to find service name

Use objectMapper to find the service name instead of using
hard-coded service name.

Change-Id: If436c65d9a9a4942eaf30ea20bc7b85e3e7694c1
Signed-off-by: Lei YU <mine2

Use mapper to find service name

Use objectMapper to find the service name instead of using
hard-coded service name.

Change-Id: If436c65d9a9a4942eaf30ea20bc7b85e3e7694c1
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...


# ddd54428 18-Apr-2017 Lei YU <mine260309@gmail.com>

Implement mode/owner and string conversions

Move Manager::convertToMode() to utils::strToMode();
Move Manager::convertToOwner() to utils::strToOwner();
Add utils::modeToStr() and utils::ownerToStr()

Implement mode/owner and string conversions

Move Manager::convertToMode() to utils::strToMode();
Move Manager::convertToOwner() to utils::strToOwner();
Add utils::modeToStr() and utils::ownerToStr();
Adjust and add unit tests.

Change-Id: Ied35d0e732c477017e1b2db1a3464b0425b12387
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...


# a741713c 23-Feb-2017 Lei YU <mine260309@gmail.com>

Invoke SetNTP and UpdateUseNtpField in time manager

1. When time mode is changed, invoke systemd timedate1's SetNTP
method to update NTP settings;
2. When settings use_dhcp_ntp property is changed,

Invoke SetNTP and UpdateUseNtpField in time manager

1. When time mode is changed, invoke systemd timedate1's SetNTP
method to update NTP settings;
2. When settings use_dhcp_ntp property is changed, invoke
NetworkManager's UpdateUseNtpField method to update its setting;
3. Move the common code of getProperty() into utils.hpp

Change-Id: I981e0e9de9c0430282b3364c38c282312bb2be89
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...


# 7f4fca55 23-Feb-2017 Lei YU <mine260309@gmail.com>

Save properties to persistent storage when host is on

1. When host is on, set properties as requested properties instead
of notify listeners;
2. When host becomes off, and requested properties are n

Save properties to persistent storage when host is on

1. When host is on, set properties as requested properties instead
of notify listeners;
2. When host becomes off, and requested properties are not empty, notify
the listners and reset the requested properties.

Add unit tests.

Change-Id: I9359c801c698df0c6e5eab43e12427bb5a6da611
Signed-off-by: Lei YU <mine260309@gmail.com>

show more ...