From f3472ea4d8e864c53e304dd7882c0ac1d4fd35cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 16 Jul 2015 10:21:36 +0200 Subject: [PATCH 1/2] ifcfg-rh: respect DEVTIMEOUT if link is not announced by udev yet (rh #1192633) If NIC related initialization takes a long time in udev processing, but we have an ifindex from kernel, we still want to wait until udev is finished and the device is really usable. Check that by calling nm_platform_link_get_by_ifname() and checking @initialized, which means udev is finished. Based on a patch by t-nishimura@hf.jp.nec.com Improved by thaller@redhat.com https://bugzilla.redhat.com/show_bug.cgi?id=1192633 (cherry picked from commit ecdf7cba6bc0f9fd4f0e45579e1b271717411f57) --- src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c index a18920c685..840f5df511 100644 --- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c +++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c @@ -149,6 +149,7 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self) const char *ifname; const char *filename; guint devtimeout; + const NMPlatformLink *pllink; s_con = nm_connection_get_setting_connection (NM_CONNECTION (self)); @@ -164,7 +165,8 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self) if (!devtimeout) return; - if (nm_platform_link_get_ifindex (NM_PLATFORM_GET, ifname) != 0) + pllink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname); + if (pllink && pllink->initialized) return; /* ONBOOT=yes, DEVICE and DEVTIMEOUT are set, but device is not present */ From 95443644c1602907c53148e84251f246bac5ee53 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 16 Jul 2015 15:18:59 +0200 Subject: [PATCH 2/2] ifcfg-rh: reorder checks in nm_ifcfg_connection_check_devtimeout() Move the check for a platform link before devtimeout_from_file(). The check in the platform cache should be more performant and yield success in most cases. This can save reading and parsing the ifcfg-rh file. (cherry picked from commit 6608331aec627aa9255618ae615e10c57c09c7c3) --- src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c index 840f5df511..a5574a80ba 100644 --- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c +++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c @@ -161,14 +161,15 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self) filename = nm_settings_connection_get_filename (NM_SETTINGS_CONNECTION (self)); if (!filename) return; - devtimeout = devtimeout_from_file (filename); - if (!devtimeout) - return; pllink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname); if (pllink && pllink->initialized) return; + devtimeout = devtimeout_from_file (filename); + if (!devtimeout) + return; + /* ONBOOT=yes, DEVICE and DEVTIMEOUT are set, but device is not present */ nm_settings_connection_set_ready (NM_SETTINGS_CONNECTION (self), FALSE);