[systemd-devel] [RFC][PATCH] core: sysvcompat - $network should be equivalent to network-online, rather than network target
Michal Sekletar
msekleta at redhat.com
Wed May 14 03:29:16 PDT 2014
On Tue, May 13, 2014 at 12:23:53AM +0200, Tom Gundersen wrote:
> Most likely the facility needed is actual connectivity, rather than whether or not the
> network managment daemon is running.
>
> We also need to explicitly pull in the network-online.target, as it is not active by
> default.
>
> This means {systemd-networkd,NetworkManager}-wait-online.service, can be enabled by default
> as part of network-online.target, and only delay boot when some service actively pulls it in.
>
> See: <https://bugzilla.gnome.org/show_bug.cgi?id=728965>
>
> Cc: Pavel Šimerda <psimerda at redhat.com>
> Cc: Michal Sekletar <msekleta at redhat.com>
> ---
I think this makes sense and with this change we can enable
{NM,systemd-networkd}-wait-online.service by default within
network-online.target and everything will just work. I tested it with rather
simple test, i.e. my own daemon which does nothing but only after network is up,
and I'd say it works as expected with patch applied. Note that I changed
NM-wait-online.service on my system by hand and enabled it within
network-online.target.
Please push.
Michal
> TODO | 4 ----
> src/core/service.c | 8 ++++++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/TODO b/TODO
> index 50d3f79..3154fbd 100644
> --- a/TODO
> +++ b/TODO
> @@ -705,10 +705,6 @@ Features:
>
> External:
>
> -* NM: figure out what to do about network-online.target.
> - - maybe pull in the target as dependency for LSB initscripts ordered now after network.target
> - - https://bugzilla.gnome.org/show_bug.cgi?id=728965
> -
> * dbus:
> - natively watch for dbus-*.service symlinks (PENDING)
> - teach dbus to activate all services it finds in /etc/systemd/services/org-*.service
> diff --git a/src/core/service.c b/src/core/service.c
> index 694a265..4b6220e 100644
> --- a/src/core/service.c
> +++ b/src/core/service.c
> @@ -392,7 +392,7 @@ static int sysv_translate_facility(const char *name, const char *filename, char
> static const char * const table[] = {
> /* LSB defined facilities */
> "local_fs", NULL,
> - "network", SPECIAL_NETWORK_TARGET,
> + "network", SPECIAL_NETWORK_ONLINE_TARGET,
> "named", SPECIAL_NSS_LOOKUP_TARGET,
> "portmap", SPECIAL_RPCBIND_TARGET,
> "remote_fs", SPECIAL_REMOTE_FS_TARGET,
> @@ -854,7 +854,11 @@ static int service_load_sysv_path(Service *s, const char *path) {
> if (r == 0)
> continue;
>
> - r = unit_add_dependency_by_name(u, startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true);
> + if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && !startswith_no_case(t, "X-Start-Before:"))
> + /* the network-online target is special, as it needs to be actively pulled in */
> + r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_WANTS, m, NULL, true);
> + else
> + r = unit_add_dependency_by_name(u, startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true);
>
> if (r < 0)
> log_error_unit(u->id, "[%s:%u] Failed to add dependency on %s, ignoring: %s",
> --
> 1.9.0
>
More information about the systemd-devel
mailing list