core: merge branch 'bg/manager-parent-warnings-rh1490157'
https://bugzilla.redhat.com/show_bug.cgi?id=1490157
This commit is contained in:
@@ -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 ()
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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",
|
||||
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);
|
||||
|
Reference in New Issue
Block a user