From 0e3b85f4c49cbec7f8d887d2a9fedb1e720fc8d6 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 13 Sep 2016 10:21:47 -0700 Subject: [PATCH] Ignore non permanenet addresses in udev too Glean already ignores any interface in sysfs without a permanent address type. It does this because interfaces with other address types are likely managed by some other system running on the host like a neutron agent. Add this exclusion check to the glean udev rules so that we don't even run glean at all against them. We have left the check in glean itself as a belts and suspenders check. Change-Id: I893c873b047a24c0aecd6e2eb49d3f531a71f1b8 --- glean/cmd.py | 5 ++++- glean/init/glean-udev.rules | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/glean/cmd.py b/glean/cmd.py index 51fdbca..b9adb22 100644 --- a/glean/cmd.py +++ b/glean/cmd.py @@ -740,7 +740,10 @@ def get_sys_interfaces(interface, args): mac_addr_type = open( '%s/%s/addr_assign_type' % (sys_root, iface), 'r').read().strip() - # TODO why? is it not valid to configure randomly assigned mac addrs? + # Interfaces without a permanent address are likely created by some + # other system on the host like a running neutron agent. In these cases + # that system should be responsible for configuring the interface not + # glean. if mac_addr_type != PERMANENT_ADDR_TYPE: continue mac = open('%s/%s/address' % (sys_root, iface), 'r').read().strip() diff --git a/glean/init/glean-udev.rules b/glean/init/glean-udev.rules index ffef97d..fdbb945 100644 --- a/glean/init/glean-udev.rules +++ b/glean/init/glean-udev.rules @@ -1 +1 @@ -SUBSYSTEM=="net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="glean@$name.service" +SUBSYSTEM=="net", ACTION=="add", ATTR{addr_assign_type}=="0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="glean@$name.service"