Skip to contentSkip to conversation

Assorted fixes for systemd units

PATCH In review Neil Brown 2 participants 13 messages Feb 20, 2014 – Mar 24, 2014

Subsystems (2)
lore
Share & tools
lore

Neil Brown

author
#0 lore raw

cover Assorted fixes for systemd units

These are a number of ad-hoc things I. The nfs-utils_env.sh for SUSE is primarily presented as an example. I'm happy for it to get applied, but I'm happy if it isn't applied too.

Thanks,
NeilBrown

---

Neil Brown (6):
systemd units: remove reference to nfs-server.target from nfs-server.service. systemd units: create nfs-config.service as single location to process config.
systemd: add nfs-utils_env.sh for SUSE.
systemd: remove @localstatedir@ marking.
systemd: nfs-client needs rpc-svcgssd too.
systemd: add PIDFile directives where appropriate.

 systemd/README                   |    3 +-
 systemd/SUSE-nfs-utils_env.sh    |   62 ++++++++++++++++++++++++++++++++++++++
 systemd/nfs-blkmap.service       |    1 +
 systemd/nfs-client.target        |    5 ++-
 systemd/nfs-config.service       |    7 ++++
 systemd/nfs-idmapd.service       |    5 ++-
 systemd/nfs-mountd.service       |    5 ++-
 systemd/nfs-server.service       |    5 ++-
 systemd/rpc-gssd.service         |    4 ++
 systemd/rpc-statd-notify.service |    5 ++-
 systemd/rpc-statd.service        |    6 ++--
 systemd/rpc-svcgssd.service      |    7 ++--
 12 files changed, 97 insertions(+), 18 deletions(-)
 create mode 100644 systemd/SUSE-nfs-utils_env.sh
 create mode 100644 systemd/nfs-config.service
Signature · 1 line
Signature
author
#1 lore raw

PATCH 1/6 systemd units: remove reference to nfs-server.target from nfs-server.service.

This line was somehow missed in a recent patch. nfs-server.target doesn't exists, so nothing can be part of it.

---
 systemd/nfs-server.service |    1 -
 1 file changed, 1 deletion(-)
systemd/nfs-server.service +0 -1
index 26df65662428..5779fd39ed34 100644
@@ -1,7 +1,6 @@
 [Unit]
 Description=NFS server and services
 Requires= network.target proc-fs-nfsd.mount rpcbind.target
-PartOf=nfs-server.target
 Requires= nfs-mountd.service
 Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service
 Wants=rpc-statd-notify.service
author
#2 lore raw

PATCH 2/6 systemd units: create nfs-config.service as single location to process config.

In reply to Neil Brown

Instead of processing the config information into command lines every time it might be needed, do it once in a separate service that other services can Want.

---
 systemd/README                   |    3 +--
 systemd/nfs-config.service       |    7 +++++++
 systemd/nfs-idmapd.service       |    5 +++--
 systemd/nfs-mountd.service       |    5 +++--
 systemd/nfs-server.service       |    4 +++-
 systemd/rpc-gssd.service         |    4 +++-
 systemd/rpc-statd-notify.service |    5 +++--
 systemd/rpc-statd.service        |    5 +++--
 systemd/rpc-svcgssd.service      |    5 +++--
 9 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 systemd/nfs-config.service
systemd/README +1 -2
index 8359530098f4..a2a5f0634726 100644
@@ -56,8 +56,7 @@ Distro specific commandline configuration can be provided by
 installing a script /usr/lib/systemd/scripts/nfs-utils_env.sh
 This should write /run/sysconfig/nfs-utils based on configuration
 information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
-It should write to a tmp file and rename to the target to
-avoid parallel units seeing incomplete copies of the file.
+It is run once by nfs-config.service.
 
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
 is present.
systemd/nfs-config.service new file +7 -0
new file mode 100644
index 000000000000..4cf2ecc76e4a
@@ -0,0 +1,7 @@
+[Unit]
+Description=Preprocess NFS configuration
+
+[Service]
+type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh
systemd/nfs-idmapd.service +3 -2
index 7d0dd84d8a44..11895e234438 100644
@@ -3,9 +3,10 @@ Description=NFSv4 ID-name mapping service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
systemd/nfs-mountd.service +3 -2
index 90746a854b40..7ccc0f72012d 100644
@@ -6,9 +6,10 @@ After=network.target
 PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
systemd/nfs-server.service +3 -1
index 5779fd39ed34..2fa7387e1cb9 100644
@@ -10,9 +10,11 @@ After= nfs-idmapd.service rpc-statd.service
 After= rpc-gssd.service rpc-svcgssd.service
 Before= rpc-statd-notify.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=oneshot
 RemainAfterExit=yes
systemd/rpc-gssd.service +3 -1
index 375792804247..d4a381904de4 100644
@@ -9,9 +9,11 @@ ConditionPathExists=/etc/krb5.keytab
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=forking
 ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
systemd/rpc-statd-notify.service +3 -2
index 7742ac8c5d9a..6b13b323e758 100644
@@ -9,10 +9,11 @@ After=nfs-server.service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=-/usr/sbin/sm-notify -d $SMNOTIFYARGS
systemd/rpc-statd.service +3 -2
index 3f6cda16accd..c5795fd68f96 100644
@@ -7,9 +7,10 @@ After=network.target nss-lookup.target rpcbind.target
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
systemd/rpc-svcgssd.service +3 -2
index 6bd45884d991..32b786ec5c7d 100644
@@ -10,9 +10,10 @@ ConditionPathExists=|!@localstatedir@/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
#3 lore raw

Re: [PATCH 2/6] systemd units: create nfs-config.service as single location to process config.

Hello,

I finally got around to playing with these....
Here is what I found.

Quoted 38 lines · Neil Brown

Instead of processing the config information into command lines every time it might be needed, do it once in a separate service that other services can Want.

---
 systemd/README                   |    3 +--
 systemd/nfs-config.service       |    7 +++++++
 systemd/nfs-idmapd.service       |    5 +++--
 systemd/nfs-mountd.service       |    5 +++--
 systemd/nfs-server.service       |    4 +++-
 systemd/rpc-gssd.service         |    4 +++-
 systemd/rpc-statd-notify.service |    5 +++--
 systemd/rpc-statd.service        |    5 +++--
 systemd/rpc-svcgssd.service      |    5 +++--
 9 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 systemd/nfs-config.service
systemd/README +1 -2
index 8359530098f4..a2a5f0634726 100644
@@ -56,8 +56,7 @@ Distro specific commandline configuration can be provided by
 installing a script /usr/lib/systemd/scripts/nfs-utils_env.sh
 This should write /run/sysconfig/nfs-utils based on configuration
 information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
-It should write to a tmp file and rename to the target to
-avoid parallel units seeing incomplete copies of the file.
+It is run once by nfs-config.service.
 
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
 is present.
systemd/nfs-config.service new file +0 -0
new file mode 100644
index 000000000000..4cf2ecc76e4a

systemd/nfs-config.service line 5

Quoted 5 lines
systemd/nfs-config.service new file +5 -0
@@ -0,0 +1,7 @@
+[Unit]
+Description=Preprocess NFS configuration
+
+[Service]
+type=oneshot

This is a typo... It should be Type=oneshot

systemd/nfs-config.service line 7

Quoted 2 lines
systemd/nfs-config.service new file +2 -0
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh

Can this be moved from /usr/lib/systemd/scripts to /usr/lib/systemd/system since the scripts directory does not exit and I don't think we want to be creating directories under /usr/lib/systemd/

Finally, Its a bit confusing on how to get the new /run/sysconfig/nfs-utils created. systemctl start nfs-config does not do it but systemctl restart nfs-config.

Doesn't this also mean every time /etc/sysconfig/nfs is edited a systemctl restart nfs-config has to be done to update the new /run/sysconfig/nfs-utils and then restart the server they are reconfigured? Or am I missing something?

If I'm not it seems a bit overly complicated and its not appeared to be documented anywhere...

steved.

Quoted 122 lines
systemd/nfs-idmapd.service +3 -2
index 7d0dd84d8a44..11895e234438 100644
@@ -3,9 +3,10 @@ Description=NFSv4 ID-name mapping service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
systemd/nfs-mountd.service +3 -2
index 90746a854b40..7ccc0f72012d 100644
@@ -6,9 +6,10 @@ After=network.target
 PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
systemd/nfs-server.service +3 -1
index 5779fd39ed34..2fa7387e1cb9 100644
@@ -10,9 +10,11 @@ After= nfs-idmapd.service rpc-statd.service
 After= rpc-gssd.service rpc-svcgssd.service
 Before= rpc-statd-notify.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=oneshot
 RemainAfterExit=yes
systemd/rpc-gssd.service +3 -1
index 375792804247..d4a381904de4 100644
@@ -9,9 +9,11 @@ ConditionPathExists=/etc/krb5.keytab
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=forking
 ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
systemd/rpc-statd-notify.service +3 -2
index 7742ac8c5d9a..6b13b323e758 100644
@@ -9,10 +9,11 @@ After=nfs-server.service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=-/usr/sbin/sm-notify -d $SMNOTIFYARGS
systemd/rpc-statd.service +3 -2
index 3f6cda16accd..c5795fd68f96 100644
@@ -7,9 +7,10 @@ After=network.target nss-lookup.target rpcbind.target
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
systemd/rpc-svcgssd.service +3 -2
index 6bd45884d991..32b786ec5c7d 100644
@@ -10,9 +10,10 @@ ConditionPathExists=|!@localstatedir@/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
author
#4 lore raw

Re: [PATCH 2/6] systemd units: create nfs-config.service as single location to process config.

Quoted 36 lines · On Sat, 22 Mar 2014 17:24:59 -0400 Steve Dickson <[email protected]> wrote:

Hello,

I finally got around to playing with these....
Here is what I found.

Quoted 30 lines · Neil Brown

Instead of processing the config information into command lines every time it might be needed, do it once in a separate service that other services can Want.

---
 systemd/README                   |    3 +--
 systemd/nfs-config.service       |    7 +++++++
 systemd/nfs-idmapd.service       |    5 +++--
 systemd/nfs-mountd.service       |    5 +++--
 systemd/nfs-server.service       |    4 +++-
 systemd/rpc-gssd.service         |    4 +++-
 systemd/rpc-statd-notify.service |    5 +++--
 systemd/rpc-statd.service        |    5 +++--
 systemd/rpc-svcgssd.service      |    5 +++--
 9 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 systemd/nfs-config.service
systemd/README +1 -2
index 8359530098f4..a2a5f0634726 100644
@@ -56,8 +56,7 @@ Distro specific commandline configuration can be provided by
 installing a script /usr/lib/systemd/scripts/nfs-utils_env.sh
 This should write /run/sysconfig/nfs-utils based on configuration
 information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
-It should write to a tmp file and rename to the target to
-avoid parallel units seeing incomplete copies of the file.
+It is run once by nfs-config.service.
 
Quoted 14 lines

systemd/nfs-config.service line 5

Quoted 13 lines
systemd/README +0 -0
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
 is present.
systemd/nfs-config.service new file +5 -0
new file mode 100644
index 000000000000..4cf2ecc76e4a
@@ -0,0 +1,7 @@
+[Unit]
+Description=Preprocess NFS configuration
+
+[Service]
+type=oneshot

This is a typo... It should be Type=oneshot

Groan. Thanks.

Quoted 6 lines

systemd/nfs-config.service line 7

Quoted 3 lines
systemd/nfs-config.service new file +2 -0
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh

Can this be moved from /usr/lib/systemd/scripts to /usr/lib/systemd/system since the scripts directory does not exit and I don't think we want to be creating directories under /usr/lib/systemd/

Interesting question.
I don't think it really belongs in /usr/lib/systemd/system, though as it has a ".sh" extension systemd isn't going to confuse it for a unit file. However systemd developers seem to have the attitude to just "do it right, even if that means doing something new", and I think a scripts directory is "right", even though it is currently "new".

Though it isn't that new - a google for
"/usr/lib/systemd/scripts"
(in quotes) claim 44000 hits, and those that I looked at are genuine (though probably not all really unique).

If we agree that having shell scripts is appropriate we should probably raise the preferred location on the systemd-devel mailing list.

Quoted 9 lines

Finally, Its a bit confusing on how to get the new /run/sysconfig/nfs-utils created. systemctl start nfs-config does not do it but systemctl restart nfs-config.

Doesn't this also mean every time /etc/sysconfig/nfs is edited a systemctl restart nfs-config has to be done to update the new /run/sysconfig/nfs-utils and then restart the server they are reconfigured? Or am I missing something?

Fair comment.... Maybe we should use a 'path' unit to run the config-parser every time /etc/sysconfig/nfs changes.
I'll see if I can make that work.

Thanks,
NeilBrown

Quoted 128 lines

If I'm not it seems a bit overly complicated and its not appeared to be documented anywhere...

steved.

Quoted 122 lines
systemd/nfs-idmapd.service +3 -2
index 7d0dd84d8a44..11895e234438 100644
@@ -3,9 +3,10 @@ Description=NFSv4 ID-name mapping service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
systemd/nfs-mountd.service +3 -2
index 90746a854b40..7ccc0f72012d 100644
@@ -6,9 +6,10 @@ After=network.target
 PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
systemd/nfs-server.service +3 -1
index 5779fd39ed34..2fa7387e1cb9 100644
@@ -10,9 +10,11 @@ After= nfs-idmapd.service rpc-statd.service
 After= rpc-gssd.service rpc-svcgssd.service
 Before= rpc-statd-notify.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=oneshot
 RemainAfterExit=yes
systemd/rpc-gssd.service +3 -1
index 375792804247..d4a381904de4 100644
@@ -9,9 +9,11 @@ ConditionPathExists=/etc/krb5.keytab
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=forking
 ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
systemd/rpc-statd-notify.service +3 -2
index 7742ac8c5d9a..6b13b323e758 100644
@@ -9,10 +9,11 @@ After=nfs-server.service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=-/usr/sbin/sm-notify -d $SMNOTIFYARGS
systemd/rpc-statd.service +3 -2
index 3f6cda16accd..c5795fd68f96 100644
@@ -7,9 +7,10 @@ After=network.target nss-lookup.target rpcbind.target
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
systemd/rpc-svcgssd.service +3 -2
index 6bd45884d991..32b786ec5c7d 100644
@@ -10,9 +10,10 @@ ConditionPathExists=|!@localstatedir@/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
#5 lore raw

Re: [PATCH 2/6] systemd units: create nfs-config.service as single location to process config.

Quoted 70 lines · NeilBrown
Quoted 36 lines · On Sat, 22 Mar 2014 17:24:59 -0400 Steve Dickson <[email protected]> wrote:

Hello,

I finally got around to playing with these....
Here is what I found.

Quoted 30 lines · Neil Brown

Instead of processing the config information into command lines every time it might be needed, do it once in a separate service that other services can Want.

---
 systemd/README                   |    3 +--
 systemd/nfs-config.service       |    7 +++++++
 systemd/nfs-idmapd.service       |    5 +++--
 systemd/nfs-mountd.service       |    5 +++--
 systemd/nfs-server.service       |    4 +++-
 systemd/rpc-gssd.service         |    4 +++-
 systemd/rpc-statd-notify.service |    5 +++--
 systemd/rpc-statd.service        |    5 +++--
 systemd/rpc-svcgssd.service      |    5 +++--
 9 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 systemd/nfs-config.service
systemd/README +1 -2
index 8359530098f4..a2a5f0634726 100644
@@ -56,8 +56,7 @@ Distro specific commandline configuration can be provided by
 installing a script /usr/lib/systemd/scripts/nfs-utils_env.sh
 This should write /run/sysconfig/nfs-utils based on configuration
 information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
-It should write to a tmp file and rename to the target to
-avoid parallel units seeing incomplete copies of the file.
+It is run once by nfs-config.service.
 
Quoted 14 lines

systemd/nfs-config.service line 5

Quoted 13 lines
systemd/README +0 -0
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
 is present.
systemd/nfs-config.service new file +5 -0
new file mode 100644
index 000000000000..4cf2ecc76e4a
@@ -0,0 +1,7 @@
+[Unit]
+Description=Preprocess NFS configuration
+
+[Service]
+type=oneshot

This is a typo... It should be Type=oneshot

Groan. Thanks.

Quoted 6 lines

systemd/nfs-config.service line 7

Quoted 3 lines
systemd/nfs-config.service new file +2 -0
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh

Can this be moved from /usr/lib/systemd/scripts to /usr/lib/systemd/system since the scripts directory does not exit and I don't think we want to be creating directories under /usr/lib/systemd/

Interesting question.
I don't think it really belongs in /usr/lib/systemd/system, though as it has a ".sh" extension systemd isn't going to confuse it for a unit file. However systemd developers seem to have the attitude to just "do it right, even if that means doing something new", and I think a scripts directory is "right", even though it is currently "new".

Quoted 4 lines

Though it isn't that new - a google for
"/usr/lib/systemd/scripts"
(in quotes) claim 44000 hits, and those that I looked at are genuine (though probably not all really unique).

I got 44300... ;-)

Quoted 3 lines

If we agree that having shell scripts is appropriate we should probably raise the preferred location on the systemd-devel mailing list.

I was just concern with creating the directory... but it appears to be the right ting to do...

Quoted 7 lines
Quoted 7 lines

Finally, Its a bit confusing on how to get the new /run/sysconfig/nfs-utils created. systemctl start nfs-config does not do it but systemctl restart nfs-config.

Quoted 8 lines
Quoted 4 lines

Doesn't this also mean every time /etc/sysconfig/nfs is edited a systemctl restart nfs-config has to be done to update the new /run/sysconfig/nfs-utils and then restart the server they are reconfigured? Or am I missing something?

Fair comment.... Maybe we should use a 'path' unit to run the config-parser every time /etc/sysconfig/nfs changes.
I'll see if I can make that work.

That would be good... thanks!

steved.

Quoted 137 lines

Thanks,
NeilBrown

Quoted 128 lines

If I'm not it seems a bit overly complicated and its not appeared to be documented anywhere...

steved.

Quoted 122 lines
systemd/nfs-idmapd.service +3 -2
index 7d0dd84d8a44..11895e234438 100644
@@ -3,9 +3,10 @@ Description=NFSv4 ID-name mapping service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
systemd/nfs-mountd.service +3 -2
index 90746a854b40..7ccc0f72012d 100644
@@ -6,9 +6,10 @@ After=network.target
 PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
systemd/nfs-server.service +3 -1
index 5779fd39ed34..2fa7387e1cb9 100644
@@ -10,9 +10,11 @@ After= nfs-idmapd.service rpc-statd.service
 After= rpc-gssd.service rpc-svcgssd.service
 Before= rpc-statd-notify.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=oneshot
 RemainAfterExit=yes
systemd/rpc-gssd.service +3 -1
index 375792804247..d4a381904de4 100644
@@ -9,9 +9,11 @@ ConditionPathExists=/etc/krb5.keytab
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
 
 Type=forking
 ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
systemd/rpc-statd-notify.service +3 -2
index 7742ac8c5d9a..6b13b323e758 100644
@@ -9,10 +9,11 @@ After=nfs-server.service
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=-/usr/sbin/sm-notify -d $SMNOTIFYARGS
systemd/rpc-statd.service +3 -2
index 3f6cda16accd..c5795fd68f96 100644
@@ -7,9 +7,10 @@ After=network.target nss-lookup.target rpcbind.target
 
 PartOf=nfs-utils.service
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
systemd/rpc-svcgssd.service +3 -2
index 6bd45884d991..32b786ec5c7d 100644
@@ -10,9 +10,10 @@ ConditionPathExists=|!@localstatedir@/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
+Wants=nfs-config.service
+After=nfs-config.service
+
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStartPre=-/usr/lib/systemd/scritps/nfs-utils_env.sh
-
 Type=forking
 ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
author
#6 lore raw

PATCH 3/6 systemd: add nfs-utils_env.sh for SUSE.

In reply to Neil Brown

This script provides the required translation for sysconfig variables understood by init.d script on openSUSE.

---
 systemd/SUSE-nfs-utils_env.sh |   62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 systemd/SUSE-nfs-utils_env.sh
systemd/SUSE-nfs-utils_env.sh new file +62 -0
new file mode 100644
index 000000000000..8d6d94ed29e5
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# extract configuration from /etc/sysconfig/nfs-utils and write
+# environment to /run/sysconfig/nfs-utils to be used by systemd unit
+# files.
+# This script expect configuration as used by openSUSE-13.1 and later
+#
+
+nfs_config=/etc/sysconfig/nfs
+if test -r $nfs_config; then
+    . $nfs_config
+fi
+
+pipefs=
+if [ -n "$RPC_PIPEFS_DIR" -a "$RPC_PIPEFS_DIR" != "/var/lib/nfs/rpc_pipefs" ]; then
+    pipefs="-p /var/lib/nfs/rpc_pipefs"
+fi
+
+mountdport=
+if [ -n "$MOUNTD_PORT" ]; then
+    mountdport="-p $MOUNTD_PORT"
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+version_params=
+if [ "$NFS3_SERVER_SUPPORT" == "no" ]; then
+   version_params="--no-nfs-version 2 --no-nfs-version 3"
+fi
+if [ "$NFS4_SUPPORT" != "yes" ]; then
+   version_params="--no-nfs-version 4"
+fi
+if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then
+   version_params="$VERSION_PARAMS --nfs-version 4 --nfs-version 4.$NFS4_SERVER_MINOR_VERSION"
+fi
+
+if [ "$USE_KERNEL_NFSD_NUMBER" -gt 0 ]; then
+    threads=$USE_KERNEL_NFSD_NUMBER
+else
+    threads=3
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+mkdir -p /run/sysconfig
+{
+echo "RPCIDMAPDARGS=$pipefs"
+echo "RPCMOUNTDARGS=$mountdport $MOUNTD_OPTIONS $version_parms"
+echo "RPCNFSDARGS=$NFSD_OPTIONS $version_params $threads"
+echo "GSSDARGS=$ignore_dns $GSSD_OPTIONS $pipefs"
+echo "SMNOTIFYARGS=$SM_NOTIFY_OPTIONS"
+echo "STATDARGS=$STATD_OPTIONS"
+echo "SVCGSSDARGS=$SVCGSSD_OPTIONS"
+} > /run/sysconfig/nfs-utils
#7 lore raw

Re: [PATCH 3/6] systemd: add nfs-utils_env.sh for SUSE.

Quoted 8 lines · Neil Brown

This script provides the required translation for sysconfig variables understood by init.d script on openSUSE.

---
 systemd/SUSE-nfs-utils_env.sh |   62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 systemd/SUSE-nfs-utils_env.sh

I was thinking about this one too... Yeah, I know.. I need life!! ;-)

Do we really want distro specific files like this in the upstream repo? Its more of a maintenance thing than anything... If something distro specific changes, do we really need to send the change upstream and does upstream really care?

steved.

Quoted 71 lines
systemd/SUSE-nfs-utils_env.sh new file +62 -0
new file mode 100644
index 000000000000..8d6d94ed29e5
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# extract configuration from /etc/sysconfig/nfs-utils and write
+# environment to /run/sysconfig/nfs-utils to be used by systemd unit
+# files.
+# This script expect configuration as used by openSUSE-13.1 and later
+#
+
+nfs_config=/etc/sysconfig/nfs
+if test -r $nfs_config; then
+    . $nfs_config
+fi
+
+pipefs=
+if [ -n "$RPC_PIPEFS_DIR" -a "$RPC_PIPEFS_DIR" != "/var/lib/nfs/rpc_pipefs" ]; then
+    pipefs="-p /var/lib/nfs/rpc_pipefs"
+fi
+
+mountdport=
+if [ -n "$MOUNTD_PORT" ]; then
+    mountdport="-p $MOUNTD_PORT"
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+version_params=
+if [ "$NFS3_SERVER_SUPPORT" == "no" ]; then
+   version_params="--no-nfs-version 2 --no-nfs-version 3"
+fi
+if [ "$NFS4_SUPPORT" != "yes" ]; then
+   version_params="--no-nfs-version 4"
+fi
+if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then
+   version_params="$VERSION_PARAMS --nfs-version 4 --nfs-version 4.$NFS4_SERVER_MINOR_VERSION"
+fi
+
+if [ "$USE_KERNEL_NFSD_NUMBER" -gt 0 ]; then
+    threads=$USE_KERNEL_NFSD_NUMBER
+else
+    threads=3
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+mkdir -p /run/sysconfig
+{
+echo "RPCIDMAPDARGS=$pipefs"
+echo "RPCMOUNTDARGS=$mountdport $MOUNTD_OPTIONS $version_parms"
+echo "RPCNFSDARGS=$NFSD_OPTIONS $version_params $threads"
+echo "GSSDARGS=$ignore_dns $GSSD_OPTIONS $pipefs"
+echo "SMNOTIFYARGS=$SM_NOTIFY_OPTIONS"
+echo "STATDARGS=$STATD_OPTIONS"
+echo "SVCGSSDARGS=$SVCGSSD_OPTIONS"
+} > /run/sysconfig/nfs-utils
author
#8 lore raw

Re: [PATCH 3/6] systemd: add nfs-utils_env.sh for SUSE.

Quoted 11 lines · On Sun, 23 Mar 2014 15:14:44 -0400 Steve Dickson <[email protected]> wrote:
Quoted 8 lines · Neil Brown

This script provides the required translation for sysconfig variables understood by init.d script on openSUSE.

---
 systemd/SUSE-nfs-utils_env.sh |   62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 systemd/SUSE-nfs-utils_env.sh
Quoted 6 lines

I was thinking about this one too... Yeah, I know.. I need life!! ;-)

Do we really want distro specific files like this in the upstream repo? Its more of a maintenance thing than anything... If something distro specific changes, do we really need to send the change upstream and does upstream really care?

Probably not. I mainly added that as an example as there seems to be some confusion over how I imagined these things working.

I'm quite happy to not have this upstream (I might even prefer it).

Thanks,
NeilBrown

Quoted 73 lines

steved.

Quoted 71 lines
systemd/SUSE-nfs-utils_env.sh new file +62 -0
new file mode 100644
index 000000000000..8d6d94ed29e5
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# extract configuration from /etc/sysconfig/nfs-utils and write
+# environment to /run/sysconfig/nfs-utils to be used by systemd unit
+# files.
+# This script expect configuration as used by openSUSE-13.1 and later
+#
+
+nfs_config=/etc/sysconfig/nfs
+if test -r $nfs_config; then
+    . $nfs_config
+fi
+
+pipefs=
+if [ -n "$RPC_PIPEFS_DIR" -a "$RPC_PIPEFS_DIR" != "/var/lib/nfs/rpc_pipefs" ]; then
+    pipefs="-p /var/lib/nfs/rpc_pipefs"
+fi
+
+mountdport=
+if [ -n "$MOUNTD_PORT" ]; then
+    mountdport="-p $MOUNTD_PORT"
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+version_params=
+if [ "$NFS3_SERVER_SUPPORT" == "no" ]; then
+   version_params="--no-nfs-version 2 --no-nfs-version 3"
+fi
+if [ "$NFS4_SUPPORT" != "yes" ]; then
+   version_params="--no-nfs-version 4"
+fi
+if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then
+   version_params="$VERSION_PARAMS --nfs-version 4 --nfs-version 4.$NFS4_SERVER_MINOR_VERSION"
+fi
+
+if [ "$USE_KERNEL_NFSD_NUMBER" -gt 0 ]; then
+    threads=$USE_KERNEL_NFSD_NUMBER
+else
+    threads=3
+fi
+
+case $NFS_GSSD_AVOID_DNS in
+    [Nn]*) ignore_dns=-D ;;
+    [Yy]*) ignore_dns=   ;;
+    *    ) ignore_dns=-D
+esac
+
+mkdir -p /run/sysconfig
+{
+echo "RPCIDMAPDARGS=$pipefs"
+echo "RPCMOUNTDARGS=$mountdport $MOUNTD_OPTIONS $version_parms"
+echo "RPCNFSDARGS=$NFSD_OPTIONS $version_params $threads"
+echo "GSSDARGS=$ignore_dns $GSSD_OPTIONS $pipefs"
+echo "SMNOTIFYARGS=$SM_NOTIFY_OPTIONS"
+echo "STATDARGS=$STATD_OPTIONS"
+echo "SVCGSSDARGS=$SVCGSSD_OPTIONS"
+} > /run/sysconfig/nfs-utils
author
#9 lore raw

PATCH 4/6 systemd: remove @localstatedir@ marking.

In reply to Neil Brown

This isn't used so currently is inconvenient.
Once we decide how to handle this sort of thing we can apply the change uniformly.

---
 systemd/rpc-svcgssd.service |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
systemd/rpc-svcgssd.service +1 -1
index 32b786ec5c7d..f7424b0b1085 100644
@@ -6,7 +6,7 @@ PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
 After=gssproxy.service
-ConditionPathExists=|!@localstatedir@/run/gssproxy.pid
+ConditionPathExists=|!/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
author
#10 lore raw

PATCH 5/6 systemd: nfs-client needs rpc-svcgssd too.

In reply to Neil Brown

For NFSv4.0 callbacks, the server needs the client code and the client needs the server code.

---
 systemd/nfs-client.target |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
systemd/nfs-client.target +3 -2
index fa591354abf3..f3c09e76a0f7 100644
@@ -5,8 +5,9 @@ Wants=remote-fs-pre.target
 
 # Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
 # start that on demand if needed.
-Wants=rpc-gssd.service nfs-blkmap.service rpc-statd-notify.service
-Before=rpc-gssd.service nfs-blkmap.service
+Wants=rpc-gssd.service rpc-svcgssd.service
+Wants=nfs-blkmap.service rpc-statd-notify.service
+Before=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.service
 
 [Install]
 WantedBy=multi-user.target
author
#11 lore raw

PATCH 6/6 systemd: add PIDFile directives where appropriate.

In reply to Neil Brown

Only two of our daemons write out pid files.

---
 systemd/nfs-blkmap.service |    1 +
 systemd/rpc-statd.service  |    1 +
 2 files changed, 2 insertions(+)
systemd/nfs-blkmap.service +1 -0
index 4b74e9f61454..68cc9e968e65 100644
@@ -12,4 +12,5 @@ PartOf=nfs-utils.service
 
 [Service]
 Type=forking
+PIDFile=/var/run/blkmapd.pid
 ExecStart=/usr/sbin/blkmapd
systemd/rpc-statd.service +1 -0
index c5795fd68f96..14604d783ddf 100644
@@ -13,4 +13,5 @@ After=nfs-config.service
 [Service]
 EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
+PIDFile=/var/run/rpc.statd.pid
 ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
#12 lore raw
In reply to Neil Brown
Quoted 8 lines · Neil Brown

These are a number of ad-hoc things I. The nfs-utils_env.sh for SUSE is primarily presented as an example. I'm happy for it to get applied, but I'm happy if it isn't applied too.

Thanks,
NeilBrown

Quoted 5 lines

---

Neil Brown (6):
systemd units: remove reference to nfs-server.target from nfs-server.service. systemd units: create nfs-config.service as single location to process config.

Committed to both of test to the systemd branch, with typo fixed.

Quoted 1 line

systemd: add nfs-utils_env.sh for SUSE.

Did not commit this one.

Quoted 3 lines

systemd: remove @localstatedir@ marking.
systemd: nfs-client needs rpc-svcgssd too.
systemd: add PIDFile directives where appropriate.

Committed these three to the systemd branch.

I'm planning on move these on the main branch very soon they will be in the upcoming release.

steved.

Quoted 18 lines

 systemd/README                   |    3 +-
 systemd/SUSE-nfs-utils_env.sh    |   62 ++++++++++++++++++++++++++++++++++++++
 systemd/nfs-blkmap.service       |    1 +
 systemd/nfs-client.target        |    5 ++-
 systemd/nfs-config.service       |    7 ++++
 systemd/nfs-idmapd.service       |    5 ++-
 systemd/nfs-mountd.service       |    5 ++-
 systemd/nfs-server.service       |    5 ++-
 systemd/rpc-gssd.service         |    4 ++
 systemd/rpc-statd-notify.service |    5 ++-
 systemd/rpc-statd.service        |    6 ++--
 systemd/rpc-svcgssd.service      |    7 ++--
 12 files changed, 97 insertions(+), 18 deletions(-)
 create mode 100644 systemd/SUSE-nfs-utils_env.sh
 create mode 100644 systemd/nfs-config.service