summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-27 10:16:15 +0200
committerThomas Haller <thaller@redhat.com>2017-10-04 12:20:55 +0200
commitdc090aa8b5de40104bef4a3ac8f97348e83e086d (patch)
tree29697d4035f7168b6d11267f8bdc7510a74e99fa
parent0919d6e456453e5cac50df9a71556c6e5f03f526 (diff)
downloadNetworkManager-th/activation-state-flags-rh1454883.tar.gz
core: add NMActivationStateFlags "master-has-slaves"th/activation-state-flags-rh1454883
-rw-r--r--libnm-core/nm-dbus-interface.h3
-rw-r--r--src/devices/nm-device.c9
-rw-r--r--src/nm-active-connection.c1
3 files changed, 13 insertions, 0 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index 857de7da58..229c5d253f 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -885,6 +885,8 @@ typedef enum {
* @NM_ACTIVATION_STATE_FLAG_LAYER2_READY: layer2 is activated and ready.
* @NM_ACTIVATION_STATE_FLAG_IP4_READY: IPv4 setting is completed.
* @NM_ACTIVATION_STATE_FLAG_IP6_READY: IPv6 setting is completed.
+ * @NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES: The master has any slave devices attached.
+ * This only makes sense if the device is a master.
*
* Flags describing the current activation state.
*
@@ -898,6 +900,7 @@ typedef enum { /*< flags >*/
NM_ACTIVATION_STATE_FLAG_LAYER2_READY = (1LL << 2),
NM_ACTIVATION_STATE_FLAG_IP4_READY = (1LL << 3),
NM_ACTIVATION_STATE_FLAG_IP6_READY = (1LL << 4),
+ NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES = (1LL << 5),
} NMActivationStateFlags;
#endif /* __NM_DBUS_INTERFACE_H__ */
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 814935a21f..cad5aee7de 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2215,6 +2215,12 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co
g_object_unref (slave);
g_slice_free (SlaveInfo, info);
+ if (c_list_is_empty (&priv->slaves)) {
+ _active_connection_set_state_flags_full (self,
+ 0,
+ NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES);
+ }
+
/* Ensure the device's hardware address is up-to-date; it often changes
* when slaves change.
*/
@@ -3724,6 +3730,9 @@ nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure)
c_list_link_tail (&priv->slaves, &info->lst_slave);
slave_priv->master = g_object_ref (self);
+ _active_connection_set_state_flags (self,
+ NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES);
+
/* no need to emit
*
* _notify (slave, PROP_MASTER);
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index f7d02eedbc..632e42b4f1 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -153,6 +153,7 @@ NM_UTILS_FLAGS2STR_DEFINE_STATIC (_state_flags_to_string, NMActivationStateFlags
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_LAYER2_READY, "layer2-ready"),
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP4_READY, "ip4-ready"),
NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_IP6_READY, "ip6-ready"),
+ NM_UTILS_FLAGS2STR (NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES, "master-has-slaves"),
);
/*****************************************************************************/