480bb0c871
Improve logic for making systemd mount dependent on
network-online.target when network filesystem is being used.
This change improves feature implemented in commit [1].
Currently when device is specified by UUID or LABEL, dependency for
network-online.target is added even it's not a network filesystem.
We should be careful with this as it may create circular dependency.
In my case, circular dependency looked like this:
network.target ->
network-pre.target ->
netfilter-persistent.service ->
local-fs.target ->
var-lib-nova.mount ->
network-online.target ->
network.target
Additionally, this commit was originally supposed to add dependency also
for CIFS mounts(these ones starting from '//') but it never worked in my
opinion. It was also fixed by this change.
[1] 6a9dcb6886
Change-Id: I5d2d9c074aa0390a6f8b7c8c0ba1c839fe26f6c5
24 lines
858 B
Django/Jinja
24 lines
858 B
Django/Jinja
# {{ ansible_managed }}
|
|
|
|
[Unit]
|
|
Description=Auto mount for {{ systemd_mount_item }}
|
|
{# make unit dependent on network-online.target if network filesystem is being mounted #}
|
|
{# dependency is also added for strings starting with '//' because it may indicate that CIFS/Samba is being used. #}
|
|
{% if not (item.what is search("^(/[^/]|UUID=|LABEL=).*")) %}
|
|
Requires=network-online.target
|
|
After=network-online.target
|
|
{% endif %}
|
|
|
|
[{{ systemd_mount_suffix | capitalize }}]
|
|
What={{ item.what }}
|
|
{% if item.type == 'swap' %}
|
|
Priority={{ item.priority | default(0) }}
|
|
{% else %}
|
|
Where={{ item.where }}
|
|
Type={{ item.type }}
|
|
{% endif %}
|
|
Options={{ item.options | default(systemd_default_mount_options) }}{% if 'credentials' in item and item.type == 'fuse.s3fs' %},passwd_file=/etc/passwd-{{ mount_service_name.stdout }}{% endif %}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|