← Back to team overview

netplan-developers team mailing list archive

[Merge] ~xnox/netplan:master into netplan:master

 

Dimitri John Ledkov has proposed merging ~xnox/netplan:master into netplan:master.

Requested reviews:
  Developers of netplan (netplan-developers)
Related bugs:
  Bug #1669564 in nplan (Ubuntu): "udevadm trigger subsystem-match=net doesn't always run rules because of reconfiguration rate-limiting"
  https://bugs.launchpad.net/ubuntu/+source/nplan/+bug/1669564

For more details, see:
https://code.launchpad.net/~xnox/netplan/+git/netplan/+merge/332151
-- 
Your team Developers of netplan is requested to review the proposed merge of ~xnox/netplan:master into netplan:master.
diff --git a/debian/changelog b/debian/changelog
index 6aad2b5..22832a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+nplan (0.30) UNRELEASED; urgency=medium
+
+  * Reload udevd to invalidate configuration cache of .rules/.link files
+    as generate step may have changed them. LP: #1669564
+
+ -- Dimitri John Ledkov <xnox@xxxxxxxxxx>  Wed, 11 Oct 2017 18:47:12 +0100
+
 nplan (0.29) artful; urgency=medium
 
   * Fix autopkgtests in a world where /run/NetworkManager/conf.d already
diff --git a/src/generate.c b/src/generate.c
index 2f3b481..a0c7aca 100644
--- a/src/generate.c
+++ b/src/generate.c
@@ -40,6 +40,13 @@ static GOptionEntry options[] = {
 };
 
 static void
+reload_udevd(void)
+{
+    const gchar *argv[] = { "/sbin/udevadm", "control", "--reload", NULL };
+    g_spawn_sync(NULL, (gchar**)argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+};
+
+static void
 nd_iterator(gpointer key, gpointer value, gpointer user_data)
 {
     if (write_networkd_conf((net_definition*) value, (const char*) user_data))
@@ -154,6 +161,13 @@ int main(int argc, char** argv)
         g_debug("Generating output files..");
         g_hash_table_foreach(netdefs, nd_iterator, rootdir);
         write_nm_conf_finish(rootdir);
+	/* We may have written .rules & .link files, thus we must
+	 * invalidate udevd cache of its config as by default it only
+	 * invalidates cache at most every 3 seconds. Not sure if this
+	 * should live in `generate' or `apply', but it is confusing
+	 * when udevd ignores just-in-time created rules files.
+	 */
+	reload_udevd();
     }
 
     /* Disable /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf

Follow ups