main: (order) early start D-Bus service

systemd considers the startup time of NetworkManager until the D-Bus
service is claimed. By doing that earlier, this time is significantly
reduced.
This has the advantage, that services that are ordered to start
after NetworkManager can start earlier. Most notably, 'network.target'
orders itself After=NetworkManager.service and many services are ordered
After=network.target.

  $ systemd-analyze blame | grep NetworkManager.service

(cherry picked from commit 21562052ec)

Conflicts:
	src/main.c
This commit is contained in:
Thomas Haller 2015-03-13 23:34:47 +01:00
parent b24d44cb2d
commit e860c0e4ea

View file

@ -405,6 +405,21 @@ main (int argc, char *argv[])
#endif
);
if (!nm_dbus_manager_get_connection (nm_dbus_manager_get ())) {
#if HAVE_DBUS_GLIB_100
nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available");
#else
nm_log_err (LOGD_CORE, "Failed to connect to D-Bus, exiting...");
goto done;
#endif
} else {
/* Start our DBus service */
if (!nm_dbus_manager_start_service (nm_dbus_manager_get ())) {
nm_log_err (LOGD_CORE, "failed to start the dbus service.");
goto done;
}
}
/* Set up platform interaction layer */
nm_linux_platform_setup ();
@ -454,21 +469,6 @@ main (int argc, char *argv[])
session_monitor = nm_session_monitor_get ();
g_assert (session_monitor != NULL);
if (!nm_dbus_manager_get_connection (nm_dbus_manager_get ())) {
#if HAVE_DBUS_GLIB_100
nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available");
#else
nm_log_err (LOGD_CORE, "Failed to connect to D-Bus, exiting...");
goto done;
#endif
} else {
/* Start our DBus service */
if (!nm_dbus_manager_start_service (nm_dbus_manager_get ())) {
nm_log_err (LOGD_CORE, "failed to start the dbus service.");
goto done;
}
}
g_signal_connect (manager, NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config);
nm_manager_start (manager);