Make sure there's always the device and connection as well as the reason
when a slave activation fails. The slave connection could in fact be
chosen automatically on "nmcli d connect" and the user might not be
aware activation of which connection was attempted:
$ nmcli d connect enp0s25
Error: Device activation failed: Master connection not found or invalid
master_connection = nm_device_get_settings_connection (master_device);
if (master_connection && !is_compatible_with_slave (NM_CONNECTION (master_connection), connection)) {
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
master_connection = nm_device_get_settings_connection (master_device);
if (master_connection && !is_compatible_with_slave (NM_CONNECTION (master_connection), connection)) {
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
- "The active connection on %s is not a valid master for '%s'",
- nm_device_get_iface (master_device),
- nm_connection_get_id (connection));
+ "The active connection on %s is not compatible",
+ nm_device_get_iface (master_device));
g_assert (!master_connection || master_connection == device_connection);
if (device_connection && !is_compatible_with_slave (NM_CONNECTION (device_connection), connection)) {
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
g_assert (!master_connection || master_connection == device_connection);
if (device_connection && !is_compatible_with_slave (NM_CONNECTION (device_connection), connection)) {
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
- "The active connection on %s is not a valid master for '%s'",
- nm_device_get_iface (master_device),
+ "The active connection %s is not compatible",
nm_connection_get_id (connection));
return NULL;
}
nm_connection_get_id (connection));
return NULL;
}
master_device,
subject,
error);
master_device,
subject,
error);
- if (!master_ac)
- g_prefix_error (error, "%s", "Master device activation failed: ");
g_slist_free (connections);
return master_ac;
}
g_slist_free (connections);
return master_ac;
}
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
- "No compatible connection found for master device %s.",
- nm_device_get_iface (master_device));
+ "No compatible connection found.");
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_DEPENDENCY_FAILED,
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_DEPENDENCY_FAILED,
- "Master device %s unmanaged or not available for activation",
- nm_device_get_iface (master_device));
+ "Device unmanaged or not available for activation");
} else if (master_connection) {
gboolean found_device = FALSE;
} else if (master_connection) {
gboolean found_device = FALSE;
candidate,
subject,
error);
candidate,
subject,
error);
- if (!master_ac)
- g_prefix_error (error, "%s", "Master device activation failed: ");
return master_ac;
}
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
return master_ac;
}
g_set_error (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
- "No compatible disconnected device found for master connection %s.",
- nm_settings_connection_get_uuid (master_connection));
+ "No device available");
} else
g_assert_not_reached ();
} else
g_assert_not_reached ();
/* 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,
/* 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 (connection));
/* Ensure there's a master active connection the new connection we're
* activating can depend on.
/* Ensure there's a master active connection the new connection we're
* activating can depend on.
/* Ensure eg bond slave and the candidate master is a bond master */
if (master_connection && !is_compatible_with_slave (NM_CONNECTION (master_connection), applied)) {
/* Ensure eg bond slave and the candidate master is a bond master */
if (master_connection && !is_compatible_with_slave (NM_CONNECTION (master_connection), applied)) {
- g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
- "The master connection was not compatible");
+ g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED,
+ "The master connection '%s' is not compatible with '%s'",
+ nm_settings_connection_get_id (master_connection),
+ nm_settings_connection_get_id (connection));
master_device,
error);
if (!master_ac) {
master_device,
error);
if (!master_ac) {
- if (error)
- g_assert (*error);
+ if (master_device) {
+ g_prefix_error (error, "Master device '%s' can't be activated: ",
+ nm_device_get_ip_iface (device));
+ } else {
+ g_prefix_error (error, "Master connection '%s' can't be activated: ",
+ nm_settings_connection_get_id (connection));
+ }
device = nm_manager_get_device_by_path (self, device_path);
if (!device) {
error = g_error_new (NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE,
device = nm_manager_get_device_by_path (self, device_path);
if (!device) {
error = g_error_new (NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE,
- "Cannot activate unknown device %s", device_path);
+ "Can not activate an unknown device '%s'", device_path);