summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-01-28 18:45:12 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2020-01-28 18:54:30 +0100
commit773e4c1de7e67feb37771a6bd3ce21dc65326ae0 (patch)
tree7a2489d92c2f51c0b9c2a336a803ce6f1f59f71d
parent2907c6ebf347c6d938c50a62f7c30387f1d047d8 (diff)
downloadNetworkManager-bg/virt-dev-check-master.tar.gz
manager: check for master existence before realizing the devicebg/virt-dev-check-master
If we find out that no compatible master connection exists, we shouldn't realize the slave in the first place.
-rw-r--r--src/nm-manager.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 71a665494e..4bd58da22e 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -4663,6 +4663,19 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
if (nm_active_connection_get_activation_type (active) == NM_ACTIVATION_TYPE_MANAGED)
nm_device_sys_iface_state_set (device, NM_DEVICE_SYS_IFACE_STATE_MANAGED);
+ /* Try to find the master connection/device if the connection has a dependency */
+ if (!find_master (self,
+ applied,
+ device,
+ &master_connection,
+ &master_device,
+ &master_ac,
+ error)) {
+ g_prefix_error (error, "Can not find a master for %s: ",
+ nm_settings_connection_get_id (sett_conn));
+ return FALSE;
+ }
+
/* Create any backing resources the device needs */
if (!nm_device_is_real (device)) {
NMDevice *parent;
@@ -4731,19 +4744,6 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
}
}
- /* Try to find the master connection/device if the connection has a dependency */
- if (!find_master (self,
- applied,
- device,
- &master_connection,
- &master_device,
- &master_ac,
- error)) {
- g_prefix_error (error, "Can not find a master for %s: ",
- nm_settings_connection_get_id (sett_conn));
- return FALSE;
- }
-
/* Ensure there's a master active connection the new connection we're
* activating can depend on.
*/