[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] libvirt-guests: wait for ntp service

Michal Privoznik wrote:
> On 23.09.2014 08:06, Martin Kletzander wrote:
>> On Mon, Sep 22, 2014 at 04:50:33PM -0600, Jim Fehlig wrote:
>>> Michal Privoznik wrote:
>>>> On 20.09.2014 01:36, Jim Fehlig wrote:
>>>>> Martin Kletzander wrote:
>>>>>> Unfortunately I'm not very familiar with systemd files, but my guess
>>>>>> is that After=ntp-wait.service means it should be started after the
>>>>>> time is synchronized if and only if the ntp-wait.service unit is
>>>>>> enabled, otherwise it doesn't require it.
>>>>> Yes, this is my understanding too.
>>>> And so is mine. The only concern I have is that syncing time on cold
>>>> boot of the host may take ages.
>>> Yep, I have this concern too.  So I dug a bit further and see that
>>> ntp-wait (a perl script) scrapes the output of `ntpq -c "rv 0`, waiting
>>> for leap_alarm to change to leap_none, leap_add_sec, or leap_del_sec.
>>> On my test system, this took ~16min on cold boot :-(.  ntp-wait.service
>>> failed in the meantime, since it by default calls /usr/sbin/ntp-wait
>>> with options to only wait 10min.
>>>> But on the other hand, it's better to start domains later and with
>>>> correct time than start asap with inaccurate time. ACK then,
>>> Given the above observations, I'll wait to see if you change your mind.
>> What would you say to changing it to After=ntpdate.service?  That way
>> it won't wait until the clock is synchronized, but it will be started
>> with proper time if ntpdate.service is set up to start in the default
>> runlevel (or is it target in systemd?).  I think that's a compromise
>> that has no negative side-effects.
> I wonder if we should be this specific or use time-sync.target:
> time-sync.target
>     Services responsible for synchronizing the system clock from a
> remote source (such as NTP client implementations) should pull in this
> target and order themselves before it. All services where correct time
> is essential should be ordered after this unit, but not pull it in.
> systemd automatically adds dependencies of type After= for this target
> unit to all SysV init script service units with an LSB header
> referring to the "$time" facility.
> http://www.freedesktop.org/software/systemd/man/systemd.special.html#time-sync.target

Cool, thanks for finding that!

> So I'd say: After=time-sync.target is what we are looking for.

Agreed.  I'll send a V2.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]