cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #01255
[Merge] ~raharper/cloud-init:systemd_export_tz into cloud-init:master
Ryan Harper has proposed merging ~raharper/cloud-init:systemd_export_tz into cloud-init:master.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/307722
Export TZ environment variable to systemd units
When TZ is unset in the execution environment for cloud-init, glibc
behavior of strftime will check if /etc/localtime is available via
a stat syscall. During a normal cloud-init boot, we execute roughly
400+ stat calls to /etc/localtime. Exporting TZ into the environment
prevents these stats syscalls.
--
Your team cloud init development team is requested to review the proposed merge of ~raharper/cloud-init:systemd_export_tz into cloud-init:master.
diff --git a/systemd/cloud-config.service b/systemd/cloud-config.service
index 3309e08..411b2b0 100644
--- a/systemd/cloud-config.service
+++ b/systemd/cloud-config.service
@@ -5,6 +5,7 @@ Wants=network-online.target cloud-config.target
[Service]
Type=oneshot
+Environment=TZ=:/etc/localtime
ExecStart=/usr/bin/cloud-init modules --mode=config
RemainAfterExit=yes
TimeoutSec=0
diff --git a/systemd/cloud-final.service b/systemd/cloud-final.service
index b8f69b7..b740dac 100644
--- a/systemd/cloud-final.service
+++ b/systemd/cloud-final.service
@@ -5,6 +5,7 @@ Wants=network-online.target cloud-config.service
[Service]
Type=oneshot
+Environment=TZ=:/etc/localtime
ExecStart=/usr/bin/cloud-init modules --mode=final
RemainAfterExit=yes
TimeoutSec=0
diff --git a/systemd/cloud-init-local.service b/systemd/cloud-init-local.service
index 55834ba..1459703 100644
--- a/systemd/cloud-init-local.service
+++ b/systemd/cloud-init-local.service
@@ -12,6 +12,7 @@ Conflicts=shutdown.target
[Service]
Type=oneshot
+Environment=TZ=:/etc/localtime
ExecStart=/usr/bin/cloud-init init --local
ExecStart=/bin/touch /run/cloud-init/network-config-ready
RemainAfterExit=yes
diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service
index bbddb2d..1b12b04 100644
--- a/systemd/cloud-init.service
+++ b/systemd/cloud-init.service
@@ -18,6 +18,7 @@ Conflicts=shutdown.target
[Service]
Type=oneshot
+Environment=TZ=:/etc/localtime
ExecStart=/usr/bin/cloud-init init
RemainAfterExit=yes
TimeoutSec=0
Follow ups