Repository navigation
Conversation
|
This PR should not be committed before xapi-project/xen-api#7332 . |
|
Cc @changlei-li |
|
Tests:
|
b272c17 to
ea131c1
Compare
|
Last push:
|
| self.SetNTPMode('Disabled') | ||
|
|
||
| self.DisableService("chrony-wait") | ||
| self.DisableService("chronyd") |
There was a problem hiding this comment.
The two disables are legacy behaviors. I think it need more consideration for the remove. What is chrony-wait and what is the impact.
There was a problem hiding this comment.
Thanks for pointing this problem.
Let's first evacuate self.DisableService("chronyd") removal : it is safe to remove the line as chronyd service is already disabled by XAPI when ntp-mode is set to Disabled.
Regarding chrony-wait the situation is (a lot) more complex.
What chrony-wait is
- It is a separate systemd unit shipped by chrony package.
- It is not managed by XAPI.
- It is enabled by
host-installeron (every NTP-enabled install)[https://github.com/xenserver/host-installer/blob/333a075c3f466f3a2ccc7d118acd0e8cb4b2631d/backend.py#L519).
It seems to be used to guarantees a synced clock before XAPI toolstack start: at boot, it blocks (up to 180 s) until chronyd has synced the clock (it is using waitsync chronyc command), gating time-sync.target, which in turn gates xapi.service / xapi-init-complete.target (both After=time-sync.target).
The chrony-wait unit has Requires=chronyd.service line.
XAPI state (without xsconsole involving) - setting ntp-mode=Disabled with XAPI
XAPI's set_ntp_mode('Disabled') only calls timedatectl set-ntp false (disable_ntp_service). timedated only manages the units listed in /usr/lib/systemd/ntp-units.d/*.list, which for chrony is only chronyd.service (chrony-wait is never in that list). So XAPI can disable/stop chronyd, but it has no way to touch chrony-wait.
After setting ntp-mode=Disabled with xe, at the next boot, chrony-wait (still enabled) is pulled into the transaction and, via Requires=chronyd.service, pulls chronyd back in and starts it. It is re-arming NTP (eventually overwriting the manually-set time if any source is present). If NTP sources was cleared, chrony-wait will run waitsync which can't complete, so the boot stalls up to 180 s on time-sync.target, delaying xapi.
So I think it is an issue in the XAPI host-ntp design, in the fact it doesn't manage chrony-wait unit.
The scenario would be:
- fresh install with NTP enabled :
chrony-waitis enabled xe host-param-set uuid=<uuid> ntp-mode=Disabled:chronydis disabled, butchrony-waitstays enabled- on next boot,
chrony-waitstarts, it pullschronyd,waitsynccan't complete so the boot stalls up to 180s. Additionally, at XAPI starts,ntp-modeis refreshed from system state and aschronydis active,ntp-modeisn'tDisabledanymore.
xsconsole state
In the current code, chrony-wait could be disabled (by setting time to manual, disabling NTP) but it could never been re-enabled.
When re-enabling NTP, xsconsole delegate it to XAPI (xsconsole SetNTPMode function). But XAPI never changes chrony-wait unit state.
It means that once you used xsconsole to disable NTP, XAPI isn't delayed anymore to start with synced clock.
What to do next
Open an issue in xen-api
Several cases are problematics:
- installation with NTP enabled (
chrony-waitenabled): you can't properly disable NTP (chronyddaemon is still starting at boot,ntp-modeis resync at boot, delayed boot) - installation without NTP enabled (
chrony-waitdisabled): if you enable NTP, xapi is started with unsync clock (chrony-waitis still disabled)
Decide what to do with chrony-wait unit
If we consider starting xapi without chrony-wait is fine :
host-installershouldn't enable it : something to change in the current code.xsconsoleshouldn't disable it : something to change in the current code.xapidoesn't manage it : nothing to do, it is already the case.
If we consider we need proper clock sync before starting xapi :
host-installershould enable it with NTP : the first xapi boot will be with synced clock, nothing to do in the current code.xapimanage it : the unit is owned by xapi (aschronyd) and xapi should manage it, something to change in the current code.xsconsoleshouldn't disable it as it is owned by xapi : something to change in the current code.
For xsconsole, in both cases, it means we shouldn't disable the unit.
So I am keeping the line removed for now.
It makes xsconsole independant of the XAPI implementation for NTP DHCP (which is changed by xapi-project/xen-api#7332). Tracking-reference: XCPNG-1094 Signed-off-by: Sebastien Rodot <sebastien.rodot@vates.tech>
ea131c1 to
ddfc069
Compare
|
Last push:
|
Following xapi-project/xen-api#7332, this commit changes the way the DHCP mode of NTP is implemented.
Instead of relying on executable permission of
chrony.sh(dhclient hook), use the presence ofsourcedirline inchrony.conf.It makes the implementation to depend only on chrony instead of both chrony and dhclient.
Tracking-reference: XCPNG-1094