mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-07 18:31:54 +01:00
systemd: add UseNTP DHCP option, allow timesyncd in VMs
These are two important prerequisites for eventually switching from ntpd to timesyncd as our default ntp service.
This commit is contained in:
parent
ad0f699ff2
commit
8e9514d85c
@ -0,0 +1,39 @@
|
||||
From 48a6d639f867ba5b96ff22edce6a297cdace9cf9 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Sun, 15 Mar 2015 19:44:59 +0100
|
||||
Subject: [PATCH 4/5] timesyncd: enable timesyncd in virtual machines
|
||||
|
||||
On Fri, Mar 13, 2015 at 8:25 PM, Michael Marineau <michael.marineau@coreos.com> wrote:
|
||||
> Currently systemd-timesyncd.service includes
|
||||
> ConditionVirtualization=no, disabling it in both containers and
|
||||
> virtual machines. Each VM platform tends to deal with or ignore the
|
||||
> time problem in their own special ways, KVM/QEMU has the kernel time
|
||||
> source kvm-clock, Xen has had different schemes over the years, VMware
|
||||
> expects a userspace daemon sync the clock, and other platforms are
|
||||
> content to drift with the wind as far as I can tell.
|
||||
>
|
||||
> I don't know of a robust way to know if a platform needs a little
|
||||
> extra help from userspace to keep the clock sane or not but it seems
|
||||
> generally safer to try than to risk drifting. Does anyone know of a
|
||||
> reason to leave timesyncd off by default? Otherwise switching to
|
||||
> ConditionVirtualization=!container should be reasonable.
|
||||
---
|
||||
units/systemd-timesyncd.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in
|
||||
index 39edafc..8219c95 100644
|
||||
--- a/units/systemd-timesyncd.service.in
|
||||
+++ b/units/systemd-timesyncd.service.in
|
||||
@@ -9,7 +9,7 @@
|
||||
Description=Network Time Synchronization
|
||||
Documentation=man:systemd-timesyncd.service(8)
|
||||
ConditionCapability=CAP_SYS_TIME
|
||||
-ConditionVirtualization=no
|
||||
+ConditionVirtualization=!container
|
||||
DefaultDependencies=no
|
||||
RequiresMountsFor=/var/lib/systemd/clock
|
||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-sysusers.service
|
||||
--
|
||||
2.0.5
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
From 5aabe1661ded65cf5231a213cbf161a09b603207 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Fri, 13 Mar 2015 12:01:29 -0700
|
||||
Subject: [PATCH 5/5] network: add UseNTP DHCP option
|
||||
|
||||
Despite having the internal logic in place to enable/disable using NTP
|
||||
servers provided by DHCP the network config didn't expose the option.
|
||||
---
|
||||
man/systemd.network.xml | 8 ++++++++
|
||||
src/network/networkd-network-gperf.gperf | 1 +
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
|
||||
index 79c7a23..1897657 100644
|
||||
--- a/man/systemd.network.xml
|
||||
+++ b/man/systemd.network.xml
|
||||
@@ -468,6 +468,14 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
+ <term><varname>UseNTP=</varname></term>
|
||||
+ <listitem>
|
||||
+ <para>When true (the default), the NTP servers received
|
||||
+ from the DHCP server will be used by systemd-timesyncd
|
||||
+ and take precedence over any statically configured ones.</para>
|
||||
+ </listitem>
|
||||
+ </varlistentry>
|
||||
+ <varlistentry>
|
||||
<term><varname>UseMTU=</varname></term>
|
||||
<listitem>
|
||||
<para>When true, the interface maximum transmission unit from the DHCP server will
|
||||
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
|
||||
index 640a3a2..8c1f552 100644
|
||||
--- a/src/network/networkd-network-gperf.gperf
|
||||
+++ b/src/network/networkd-network-gperf.gperf
|
||||
@@ -52,6 +52,7 @@ Route.Destination, config_parse_destination, 0,
|
||||
Route.Source, config_parse_destination, 0, 0
|
||||
Route.Metric, config_parse_route_priority, 0, 0
|
||||
DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
|
||||
+DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
|
||||
DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
|
||||
DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
|
||||
DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
|
||||
--
|
||||
2.0.5
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
From 4b16233e59b3edd8338819dad275cc94b5e5f6e7 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Sun, 15 Mar 2015 19:44:59 +0100
|
||||
Subject: [PATCH] timesyncd: enable timesyncd in virtual machines
|
||||
|
||||
On Fri, Mar 13, 2015 at 8:25 PM, Michael Marineau <michael.marineau@coreos.com> wrote:
|
||||
> Currently systemd-timesyncd.service includes
|
||||
> ConditionVirtualization=no, disabling it in both containers and
|
||||
> virtual machines. Each VM platform tends to deal with or ignore the
|
||||
> time problem in their own special ways, KVM/QEMU has the kernel time
|
||||
> source kvm-clock, Xen has had different schemes over the years, VMware
|
||||
> expects a userspace daemon sync the clock, and other platforms are
|
||||
> content to drift with the wind as far as I can tell.
|
||||
>
|
||||
> I don't know of a robust way to know if a platform needs a little
|
||||
> extra help from userspace to keep the clock sane or not but it seems
|
||||
> generally safer to try than to risk drifting. Does anyone know of a
|
||||
> reason to leave timesyncd off by default? Otherwise switching to
|
||||
> ConditionVirtualization=!container should be reasonable.
|
||||
---
|
||||
units/systemd-timesyncd.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in
|
||||
index 39edafc..8219c95 100644
|
||||
--- a/units/systemd-timesyncd.service.in
|
||||
+++ b/units/systemd-timesyncd.service.in
|
||||
@@ -9,7 +9,7 @@
|
||||
Description=Network Time Synchronization
|
||||
Documentation=man:systemd-timesyncd.service(8)
|
||||
ConditionCapability=CAP_SYS_TIME
|
||||
-ConditionVirtualization=no
|
||||
+ConditionVirtualization=!container
|
||||
DefaultDependencies=no
|
||||
RequiresMountsFor=/var/lib/systemd/clock
|
||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-sysusers.service
|
||||
--
|
||||
2.0.5
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
From 301f4073fe1c2757e602aef24cee9ccf5f81a3a3 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Fri, 13 Mar 2015 12:01:29 -0700
|
||||
Subject: [PATCH] network: add UseNTP DHCP option
|
||||
|
||||
Despite having the internal logic in place to enable/disable using NTP
|
||||
servers provided by DHCP the network config didn't expose the option.
|
||||
---
|
||||
man/systemd.network.xml | 8 ++++++++
|
||||
src/network/networkd-network-gperf.gperf | 1 +
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
|
||||
index ed0b2eb..087e9e2 100644
|
||||
--- a/man/systemd.network.xml
|
||||
+++ b/man/systemd.network.xml
|
||||
@@ -515,6 +515,14 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
+ <term><varname>UseNTP=</varname></term>
|
||||
+ <listitem>
|
||||
+ <para>When true (the default), the NTP servers received
|
||||
+ from the DHCP server will be used by systemd-timesyncd
|
||||
+ and take precedence over any statically configured ones.</para>
|
||||
+ </listitem>
|
||||
+ </varlistentry>
|
||||
+ <varlistentry>
|
||||
<term><varname>UseMTU=</varname></term>
|
||||
<listitem>
|
||||
<para>When true, the interface maximum transmission unit
|
||||
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
|
||||
index 93df83a..8abf5bc 100644
|
||||
--- a/src/network/networkd-network-gperf.gperf
|
||||
+++ b/src/network/networkd-network-gperf.gperf
|
||||
@@ -60,6 +60,7 @@ Route.Metric, config_parse_route_priority, 0,
|
||||
Route.Scope, config_parse_route_scope, 0, 0
|
||||
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier,0, offsetof(Network, dhcp_client_identifier)
|
||||
DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
|
||||
+DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
|
||||
DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
|
||||
DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
|
||||
DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
|
||||
--
|
||||
2.0.5
|
||||
|
||||
@ -186,6 +186,10 @@ fi
|
||||
# https://github.com/coreos/bugs/issues/186
|
||||
epatch "${FILESDIR}"/218-0003-core-open-up-DefaultDependencies-property-for-transi.patch
|
||||
|
||||
# Allow timesyncd in VMs, make DHCP provided NTP servers optional
|
||||
epatch "${FILESDIR}"/218-0004-timesyncd-enable-timesyncd-in-virtual-machines.patch
|
||||
epatch "${FILESDIR}"/218-0005-network-add-UseNTP-DHCP-option.patch
|
||||
|
||||
autotools-utils_src_prepare
|
||||
}
|
||||
|
||||
@ -183,6 +183,10 @@ fi
|
||||
# Bug 463376
|
||||
sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
|
||||
|
||||
# Allow timesyncd in VMs, make DHCP provided NTP servers optional
|
||||
epatch "${FILESDIR}"/219-0001-timesyncd-enable-timesyncd-in-virtual-machines.patch
|
||||
epatch "${FILESDIR}"/219-0002-network-add-UseNTP-DHCP-option.patch
|
||||
|
||||
autotools-utils_src_prepare
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user