summaryrefslogtreecommitdiff
path: root/pkg/systemd
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-07-16 14:58:08 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-07-16 14:58:08 +0200
commit6f1c7a0b6b5a5cb4eb830758653f307fece8b08d (patch)
treebfa324561ee2b55c9dd5328215e4d615639dcc77 /pkg/systemd
parentce28dc3c4c3dba468ddb6f2a249c0c4bfc058805 (diff)
downloadpodman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.tar.gz
podman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.tar.bz2
podman-6f1c7a0b6b5a5cb4eb830758653f307fece8b08d.zip
systemd: require network*-online*.target
Require the network to be online in all (generated) systemd units to make sure that containers and Podman run only after the network has been fully configured. Fixes: #10655 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemd')
-rw-r--r--pkg/systemd/generate/common.go2
-rw-r--r--pkg/systemd/generate/containers_test.go34
-rw-r--r--pkg/systemd/generate/pods_test.go10
3 files changed, 23 insertions, 23 deletions
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index e183125a7..349805980 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -34,7 +34,7 @@ const headerTemplate = `# {{{{.ServiceName}}}}.service
[Unit]
Description=Podman {{{{.ServiceName}}}}.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor={{{{.RunRoot}}}}
`
diff --git a/pkg/systemd/generate/containers_test.go b/pkg/systemd/generate/containers_test.go
index 12a8f3004..1d24cc4a9 100644
--- a/pkg/systemd/generate/containers_test.go
+++ b/pkg/systemd/generate/containers_test.go
@@ -46,7 +46,7 @@ func TestCreateContainerSystemdUnit(t *testing.T) {
[Unit]
Description=Podman container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -72,7 +72,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -96,7 +96,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
BindsTo=a.service b.service c.service pod.service
@@ -122,7 +122,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -144,7 +144,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -166,7 +166,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -188,7 +188,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -210,7 +210,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -233,7 +233,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -259,7 +259,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -281,7 +281,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -303,7 +303,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -325,7 +325,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -347,7 +347,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -369,7 +369,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -391,7 +391,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
@@ -413,7 +413,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman jadda-jadda.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
diff --git a/pkg/systemd/generate/pods_test.go b/pkg/systemd/generate/pods_test.go
index a11e1e11e..4b8a9ffd5 100644
--- a/pkg/systemd/generate/pods_test.go
+++ b/pkg/systemd/generate/pods_test.go
@@ -45,7 +45,7 @@ func TestCreatePodSystemdUnit(t *testing.T) {
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -73,7 +73,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -101,7 +101,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -129,7 +129,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service
@@ -157,7 +157,7 @@ WantedBy=multi-user.target default.target
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
-Wants=network.target
+Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/run/containers/storage
Requires=container-1.service container-2.service