Merge ~xnox/netplan:master into ~netplan-developers/netplan/+git/netplan-lp:master

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: d16e5160a9ec3a6bceaeaece71e48f54354226b6
Proposed branch: ~xnox/netplan:master
Merge into: ~netplan-developers/netplan/+git/netplan-lp:master
Diff against target: 47 lines (+21/-0)
2 files modified
debian/changelog (+7/-0)
src/generate.c (+14/-0)
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Mathieu Trudel-Lapierre Pending
Developers of netplan Pending
Review via email: mp+332151@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

Makes sense, and the code looks sane.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6aad2b5..22832a7 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+nplan (0.30) UNRELEASED; urgency=medium
7+
8+ * Reload udevd to invalidate configuration cache of .rules/.link files
9+ as generate step may have changed them. LP: #1669564
10+
11+ -- Dimitri John Ledkov <xnox@ubuntu.com> Wed, 11 Oct 2017 18:47:12 +0100
12+
13 nplan (0.29) artful; urgency=medium
14
15 * Fix autopkgtests in a world where /run/NetworkManager/conf.d already
16diff --git a/src/generate.c b/src/generate.c
17index 2f3b481..a0c7aca 100644
18--- a/src/generate.c
19+++ b/src/generate.c
20@@ -40,6 +40,13 @@ static GOptionEntry options[] = {
21 };
22
23 static void
24+reload_udevd(void)
25+{
26+ const gchar *argv[] = { "/sbin/udevadm", "control", "--reload", NULL };
27+ g_spawn_sync(NULL, (gchar**)argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, NULL, NULL);
28+};
29+
30+static void
31 nd_iterator(gpointer key, gpointer value, gpointer user_data)
32 {
33 if (write_networkd_conf((net_definition*) value, (const char*) user_data))
34@@ -154,6 +161,13 @@ int main(int argc, char** argv)
35 g_debug("Generating output files..");
36 g_hash_table_foreach(netdefs, nd_iterator, rootdir);
37 write_nm_conf_finish(rootdir);
38+ /* We may have written .rules & .link files, thus we must
39+ * invalidate udevd cache of its config as by default it only
40+ * invalidates cache at most every 3 seconds. Not sure if this
41+ * should live in `generate' or `apply', but it is confusing
42+ * when udevd ignores just-in-time created rules files.
43+ */
44+ reload_udevd();
45 }
46
47 /* Disable /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf

Subscribers

People subscribed via source and target branches