diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-09-20 08:07:05 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-09-20 08:07:05 +0200 |
commit | 05618aaaf388c03f9eea31b6a42f666868988c51 (patch) | |
tree | 25600c50e417872207aa0afded331da933b3ebe4 | |
parent | 03e1cc96a5dc3d9a9b86f60810a330332c484a94 (diff) | |
parent | b53f8de08b1c4753ff34a1f10ecf81759bcd517a (diff) |
core: merge branch 'bg/manager-parent-warnings-rh1490157'
https://bugzilla.redhat.com/show_bug.cgi?id=1490157
-rw-r--r-- | libnm-core/nm-errors.h | 3 | ||||
-rw-r--r-- | src/devices/nm-device-infiniband.c | 6 | ||||
-rw-r--r-- | src/devices/nm-device-macsec.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-macvlan.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-ppp.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-vlan.c | 6 | ||||
-rw-r--r-- | src/nm-manager.c | 22 |
7 files changed, 27 insertions, 16 deletions
diff --git a/libnm-core/nm-errors.h b/libnm-core/nm-errors.h index 35f7dc2f34..6bacc8da56 100644 --- a/libnm-core/nm-errors.h +++ b/libnm-core/nm-errors.h @@ -143,6 +143,8 @@ GQuark nm_crypto_error_quark (void); * activation request (eg, the #NMAccessPoint or #NMWimaxNsp) was not * found. * @NM_DEVICE_ERROR_VERSION_ID_MISMATCH: the version id did not match. + * @NM_DEVICE_ERROR_MISSING_DEPENDENCIES: the requested operation could not + * be completed due to missing dependencies. * * Device-related errors. * @@ -160,6 +162,7 @@ typedef enum { NM_DEVICE_ERROR_NOT_ALLOWED, /*< nick=NotAllowed >*/ NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND, /*< nick=SpecificObjectNotFound >*/ NM_DEVICE_ERROR_VERSION_ID_MISMATCH, /*< nick=VersionIdMismatch >*/ + NM_DEVICE_ERROR_MISSING_DEPENDENCIES, /*< nick=MissingDependencies >*/ } NMDeviceError; #define NM_DEVICE_ERROR nm_device_error_quark () diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 12b0845485..09ad2855b4 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -269,13 +269,13 @@ create_and_realize (NMDevice *device, } if (!parent) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "InfiniBand partitions can not be created without a parent interface"); return FALSE; } if (!NM_IS_DEVICE_INFINIBAND (parent)) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "Parent interface %s must be an InfiniBand interface", nm_device_get_iface (parent)); return FALSE; @@ -283,7 +283,7 @@ create_and_realize (NMDevice *device, priv->parent_ifindex = nm_device_get_ifindex (parent); if (priv->parent_ifindex <= 0) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "failed to get InfiniBand parent %s ifindex", nm_device_get_iface (parent)); return FALSE; diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c index 3a43dd5c69..a117b8e216 100644 --- a/src/devices/nm-device-macsec.c +++ b/src/devices/nm-device-macsec.c @@ -692,7 +692,7 @@ create_and_realize (NMDevice *device, g_assert (s_macsec); if (!parent) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "MACsec devices can not be created without a parent interface"); return FALSE; } diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 5d6328f1f4..8803beb524 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -234,7 +234,7 @@ create_and_realize (NMDevice *device, parent_ifindex = parent ? nm_device_get_ifindex (parent) : 0; if (parent_ifindex <= 0) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "MACVLAN devices can not be created without a parent interface"); g_return_val_if_fail (!parent, FALSE); return FALSE; diff --git a/src/devices/nm-device-ppp.c b/src/devices/nm-device-ppp.c index d786a62e22..81db1dc0f7 100644 --- a/src/devices/nm-device-ppp.c +++ b/src/devices/nm-device-ppp.c @@ -209,7 +209,7 @@ create_and_realize (NMDevice *device, int parent_ifindex; if (!parent) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "PPP devices can not be created without a parent interface"); return FALSE; } diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index c6c3f46f94..171af14e02 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -231,15 +231,15 @@ create_and_realize (NMDevice *device, g_assert (s_vlan); if (!parent) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, "VLAN devices can not be created without a parent interface"); return FALSE; } parent_ifindex = nm_device_get_ifindex (parent); if (parent_ifindex <= 0) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "cannot retrieve ifindex of interface %s (%s): skip VLAN creation for now", + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES, + "cannot retrieve ifindex of interface %s (%s)", nm_device_get_iface (parent), nm_device_get_type_desc (parent)); return FALSE; diff --git a/src/nm-manager.c b/src/nm-manager.c index 263c2a0b0f..d0429fe9e5 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -94,6 +94,8 @@ static void settings_startup_complete_changed (NMSettings *settings, GParamSpec *pspec, NMManager *self); +static void retry_connections_for_parent_device (NMManager *self, NMDevice *device); + static NM_CACHED_QUARK_FCN ("active-connection-add-and-activate", active_connection_add_and_activate_quark) typedef struct { @@ -1299,6 +1301,7 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) gs_free char *iface = NULL; NMDevice *device = NULL, *parent = NULL; GError *error = NULL; + NMLogLevel log_level; g_return_val_if_fail (NM_IS_MANAGER (self), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); @@ -1379,12 +1382,20 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) /* Create any backing resources the device needs */ if (!nm_device_create_and_realize (device, connection, parent, &error)) { - _LOG3W (LOGD_DEVICE, connection, "couldn't create the device: %s", - error->message); + log_level = g_error_matches (error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_MISSING_DEPENDENCIES) + ? LOGL_DEBUG + : LOGL_ERR; + _NMLOG3 (log_level, LOGD_DEVICE, connection, + "couldn't create the device: %s", + error->message); g_error_free (error); remove_device (self, device, FALSE, TRUE); return NULL; } + + retry_connections_for_parent_device (self, device); break; } @@ -2232,11 +2243,6 @@ add_device (NMManager *self, NMDevice *device, GError **error) _parent_notify_changed (self, device, FALSE); - /* Virtual connections may refer to the new device as - * parent device, retry to activate them. - */ - retry_connections_for_parent_device (self, device); - return TRUE; } @@ -2262,6 +2268,7 @@ factory_device_added_cb (NMDeviceFactory *factory, &error)) { add_device (self, device, NULL); _device_realize_finish (self, device, NULL); + retry_connections_for_parent_device (self, device); } else { _LOG2W (LOGD_DEVICE, device, "failed to realize device: %s", error->message); g_error_free (error); @@ -2415,6 +2422,7 @@ platform_link_added (NMManager *self, &error)) { add_device (self, device, NULL); _device_realize_finish (self, device, plink); + retry_connections_for_parent_device (self, device); } else { _LOGW (LOGD_DEVICE, "%s: failed to realize device: %s", plink->name, error->message); |