I need glusterd to start before any _netdev mounts (NFS or glusterfs) take place.
reading the system.special man page it talks about ...pulling in network-online.target and order themselves after it.
Would adding a Before=network-online.target to the glusterd.service be the right thing to do or is there a better solution? (It already has After=network.target rpcbind.service)
Thanks,
--
Kaleb
On Tue, 16.07.13 11:12, Kaleb KEITHLEY (kkeithle@redhat.com) wrote:
I need glusterd to start before any _netdev mounts (NFS or glusterfs) take place.
reading the system.special man page it talks about ...pulling in network-online.target and order themselves after it.
Would adding a Before=network-online.target to the glusterd.service be the right thing to do or is there a better solution? (It already has After=network.target rpcbind.service)
All network mounts configured in fstab will pull in network-online.target, and are ordered after it.
If you want your service to be started only if there's at least one remote fs configured, then add WantedBy=network-online.target to your [Install] section, and Before=network-online.target to your [Unit] section.
If you want your service to start on *all* boots, regardless whether there is any remote fs configured in fstan or not -- but if there's a remote fs configured then before that, then only use Before=network-online.target in your [Unit] section. (And use WantedBy=multi-user.target in [Install] as you would for any other normal service).
Hope that makes sense?
Lennart
On 07/16/2013 11:24 AM, Lennart Poettering wrote:
On Tue, 16.07.13 11:12, Kaleb KEITHLEY (kkeithle@redhat.com) wrote:
I need glusterd to start before any _netdev mounts (NFS or glusterfs) take place.
reading the system.special man page it talks about ...pulling in network-online.target and order themselves after it.
Would adding a Before=network-online.target to the glusterd.service be the right thing to do or is there a better solution? (It already has After=network.target rpcbind.service)
All network mounts configured in fstab will pull in network-online.target, and are ordered after it.
Yes (and that's what the man page says, so I knew that.)
If you want your service to start on *all* boots, regardless whether there is any remote fs configured in fstab or not -- but if there's a remote fs configured then before that, then only use Before=network-online.target in your [Unit] section. (And use WantedBy=multi-user.target in [Install] as you would for any other normal service).
That's what I want. Start on all boots regardless, and before any "remote" fs in fstab. I.e. before attempting to mount any "local" nfs mount in fstab.
But a user who tried that says the "local" nfs mount(s) in his /etc/fstab still failed. I tried it as well with an f19 guest vm and got the same results, namely that the nfs mount(s) failed to mount at boot.
=============== /usr/lib/systemd/system/glusterd.service ======= [Unit] Description=GlusterFS an clustered file-system server Wants=glusterfsd.service After=network.target rpcbind.service Before=network-online.target
[Service] Type=forking PIDFile=/run/glusterd.pid LimitNOFILE=65536 ExecStart=/usr/sbin/glusterd -p /run/glusterd.pid
[Install] WantedBy=multi-user.target =============== /usr/lib/systemd/system/glusterd.service =======
======================== /etc/fstab ======================= # # /etc/fstab # Created by anaconda on Mon Jul 8 12:45:13 2013 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/fedora-root / ext4 defaults 1 1 UUID=16a22380-99d1-4c17-81d2-6e1f9b03343d /boot ext4 defaults 1 2 /dev/mapper/fedora-swap swap swap defaults 0 0
localhost:volX /mnt nfs _netdev 0 0 ======================== /etc/fstab =======================
On 07/17/2013 07:47 AM, Kaleb S. KEITHLEY wrote:
But a user who tried that says the "local" nfs mount(s) in his /etc/fstab still failed. I tried it as well with an f19 guest vm and got the same results, namely that the nfs mount(s) failed to mount at boot.
Answering my own question. I did some experimenting and found that if I use defaults or defaults,_netdev for the "local" nfs mount then it does work. (Or has all three times I've tried it. Not a statistically valid sample size.)
I'm waiting to see what the user says.
=============== /usr/lib/systemd/system/glusterd.service ======= [Unit] Description=GlusterFS an clustered file-system server Wants=glusterfsd.service After=network.target rpcbind.service Before=network-online.target
[Service] Type=forking PIDFile=/run/glusterd.pid LimitNOFILE=65536 ExecStart=/usr/sbin/glusterd -p /run/glusterd.pid
[Install] WantedBy=multi-user.target =============== /usr/lib/systemd/system/glusterd.service =======
======================== /etc/fstab ======================= # # /etc/fstab # Created by anaconda on Mon Jul 8 12:45:13 2013 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/fedora-root / ext4 defaults 1 1 UUID=16a22380-99d1-4c17-81d2-6e1f9b03343d /boot ext4 defaults 1 2 /dev/mapper/fedora-swap swap swap defaults 0 0
localhost:volX /mnt nfs _netdev 0 0 ======================== /etc/fstab =======================
On Wed, 17.07.13 07:56, Kaleb S. KEITHLEY (kkeithle@redhat.com) wrote:
On 07/17/2013 07:47 AM, Kaleb S. KEITHLEY wrote:
But a user who tried that says the "local" nfs mount(s) in his /etc/fstab still failed. I tried it as well with an f19 guest vm and got the same results, namely that the nfs mount(s) failed to mount at boot.
Answering my own question. I did some experimenting and found that if I use defaults or defaults,_netdev for the "local" nfs mount then it does work. (Or has all three times I've tried it. Not a statistically valid sample size.)
I'm waiting to see what the user says.
We should normally detect network mounts either by _netdev or by the fstype being "nfs". If one works for you and the other doesn't, this would be a bug. If you can reproduce the issue, could you open a bug and paste "systemctl show" on the mount unit in question in it? (i.e. mnt.mount if I see this correctly)
Lennart