summaryrefslogtreecommitdiff
path: root/src/devices/team/nm-device-team.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-13 15:34:14 +0100
committerThomas Haller <thaller@redhat.com>2017-03-16 18:27:33 +0100
commit850c977953e4de3c8bbee64a3d2e8726c971761c (patch)
tree288fab288475b48cf6174b3e49e59900af1beb31 /src/devices/team/nm-device-team.c
parent9395f163f46d925b1de51f591e1f27f94cab2d67 (diff)
downloadNetworkManager-850c977953e4de3c8bbee64a3d2e8726c971761c.tar.gz
device: track system interface state in NMDevice
When deciding whether to touch a device we sometimes look at whether the active connection is external/assumed. In many cases however, there is no active connection around (e.g. while moving the device from state unmanaged to disconnected before assuming). So in most cases we instead look at the device-state-reason to decide whether to touch the interface (see nm_device_state_reason_check()). Often it's desirable to have no state and passing data as function arguments. However, the state reason has to be passed along several hops (e.g. a queued state change). Or a change to a master/slave can affect the slave/master, where we pass on the state reason. Or an intermediate event might invalidate a previous state reason. Passing the state whether to touch a device or not as a state-reason is cumbersome and limited. Instead, the device should be aware of whats going on. Add a sys-iface-state with: - SYS_IFACE_STATE_EXTERNAL: meaning, NM should not touch it - SYS_IFACE_STATE_ASSUME: meaning, NM is gracefully taking over - SYS_IFACE_STATE_MANAGED: meaning, the device is managed by NM - SYS_IFACE_STATE_REMOVED: the device no longer exists This replaces most checks of nm_device_state_reason_check() and nm_active_connection_get_activation_type() by instead looking at the sys-iface-state of the device. This patch probably has still issues, but the previous behavior was not very clear either. We will need to identify those issues in future tests and tweak the behavior. At least, now there is one flag that describes how to behave.
Diffstat (limited to 'src/devices/team/nm-device-team.c')
-rw-r--r--src/devices/team/nm-device-team.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index d7cbd3660e..6906c759d6 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -416,7 +416,7 @@ teamd_dbus_appeared (GDBusConnection *connection,
success = teamd_read_config (device);
if (success)
nm_device_activate_schedule_stage2_device_config (device);
- else if (!nm_device_has_activation_type_assume_or_external (device))
+ else if (!nm_device_sys_iface_state_is_external_or_assume (device))
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
}
}