openbmc / phosphor-time-manager

Local time policy and emulated host RTC manager
Apache License 2.0
6 stars 10 forks source link

NTPServers should be a global setting #4

Open gtmills opened 6 years ago

gtmills commented 6 years ago

The NTP server acts like a global setting even though it is a network interface (e.g. eth0) specific path (e.g. /xyz/openbmc_project/network/eth0/attr/NTPServers).

I set the NTPServers property on a network interface that did not have access to the network. The BMC was still able to talk to the NTP server and get the time. After talking with Ratan this is due to systemd-networkd and how it handles NTP servers.

If the NTPServers property acts like a global setting, why not make the path non-network interface specific (/xyz/openbmc_project/time/attr/NTPServers maybe?)

I am struggling from the GUI to get and set the NTP Servers.. eth0 might not be there and having the user select a network interface from a list lowers usability and which network interface is selected does not matter.

Redfish has a global NTP Server property and I think we should too. Andrew Geissler [10:31 AM] It does seem like the NTP server go under the Manager instance in Redfish, so it’s global. Here’s some doc from the supermicro doc on setting it for their systems. 3.6.6 NTP It is implemented under redfish/v1/Managers/1/NTP Method supported: Get/Patch Patch: "NTPEnable", "PrimaryNTPServer", "SecondaryNTPServer", "DaylightSavingTime"

Andrew Geissler [9:24 AM] From https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html - there’s a reference to “systemd-timesyncd will contact all configured system or per-interface servers”. Implies there’s a way to have a system NTP server setting.

The following settings are configured in the "[Time]" section:

NTP=
A space-separated list of NTP server host names or IP addresses. During runtime this list is combined with any per-interface NTP servers acquired from systemd-networkd.service(8). systemd-timesyncd will contact all configured system or per-interface servers in turn until one is found that responds. When the empty string is assigned, the list of NTP servers is reset, and all assignments prior to this one will have no effect. This setting defaults to an empty list.
mine260309 commented 6 years ago

systemd does have different settings for NTP servers, see systemd-timesyncd.service

The NTP servers contacted are determined from the global settings in timesyncd.conf(5), the per-link static settings in .network files, and the per-link dynamic settings received over DHCP. See systemd.network(5) for more details.

  1. The global NTP setting in timesyncd.conf. Note that there are default settings during compilation, which is timeX.google.com
  2. The per-link setting in network config

In current OpenBMC, the related NTP settings are:

  1. Per-link setting which is related to each network interface, a.k.a, the NTPServers property in EthernetInterface.interface
  2. Or if configured as DHCP, NTPEnabled property in DHCPConfiguration.interface
  3. The TimeSyncMethod in Synchronization.interface This setting is kind of a global switch to tell systemd to enable or disable systemd-timesyncd.

If the user is an experienced engineer who is familiar with systemd settings, he is fine to know to set different NTP settings for different network interfaces. But if the user is not familiar with this and just wants a global NTP setting, then yes OpenBMC could add this feature as well.

I suggest to discuss this in mailing list to see if it is a wanted feature or not.

jk-ozlabs commented 6 years ago

Absolutely. User-defined NTP servers should be global (rather than per-interface), and override anything that comes via DHCP.

mine260309 commented 6 years ago

Then this new feature should be moved to phosphor-settingsd, which handles such settings and save to config files.