core/dbus: aquire D-Bus name earlier before initializing NMPlatform/NMNetns singletons

Aquiring the bus early tells systemd that NetworkManager is started.
Do that even before setting up/creating the singletons for NMPlatform
and NMNetns.

This is a trick so that NetworkManager is considered earlier to be started.
But it's right, because we can and should create the D-Bus socket as early as
possible to let other services (that order After=network.target) can already
start too.

Of course, NetworkManager is not yet fully running and it will take a
while longer until it actually replies on D-Bus. But the requests are
not lost and services that talk to NetworkManager that early can in the
meantime to other startup actions.
This commit is contained in:
Thomas Haller 2019-05-05 09:29:43 +02:00
parent 40fb6652a2
commit a381b3999e

View file

@ -418,14 +418,13 @@ main (int argc, char *argv[])
#endif
);
/* Set up platform interaction layer */
if (!_dbus_manager_init (config))
goto done_no_manager;
nm_linux_platform_setup ();
NM_UTILS_KEEP_ALIVE (config, nm_netns_get (), "NMConfig-depends-on-NMNetns");
if (!_dbus_manager_init (config))
goto done_no_manager;
nm_auth_manager_setup (nm_config_data_get_value_boolean (nm_config_get_data_orig (config),
NM_CONFIG_KEYFILE_GROUP_MAIN,
NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT,