merge: fixes for team activation (rh #1155993)

https://bugzilla.redhat.com/show_bug.cgi?id=1155993
This commit is contained in:
Jiří Klimeš
2014-11-07 14:27:22 +01:00
4 changed files with 26 additions and 3 deletions

View File

@@ -1736,7 +1736,7 @@ device_state_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
g_print (_("Connection successfully activated (master waiting for slaves) (D-Bus active path: %s)\n"),
nm_object_get_path (NM_OBJECT (active)));
quit ();
} else if (ac_state != NM_ACTIVE_CONNECTION_STATE_ACTIVATING) {
} else if (active && ac_state != NM_ACTIVE_CONNECTION_STATE_ACTIVATING) {
g_string_printf (nmc->return_text, _("Error: Connection activation failed."));
nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION;
quit ();

View File

@@ -743,6 +743,8 @@ typedef struct {
char *new_connection_path;
} ActivateInfo;
static void active_removed (NMObject *object, NMActiveConnection *active, gpointer user_data);
static void
activate_info_complete (ActivateInfo *info,
NMActiveConnection *active,
@@ -750,6 +752,7 @@ activate_info_complete (ActivateInfo *info,
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (info->manager);
g_signal_handlers_disconnect_by_func (info->manager, G_CALLBACK (active_removed), info);
if (active)
g_simple_async_result_set_op_res_gpointer (info->simple, g_object_ref (active), g_object_unref);
else
@@ -836,6 +839,22 @@ activation_cancelled (GCancellable *cancellable,
g_clear_error (&error);
}
static void
active_removed (NMObject *object, NMActiveConnection *active, gpointer user_data)
{
ActivateInfo *info = user_data;
GError *error = NULL;
if (strcmp (info->active_path, nm_object_get_path (NM_OBJECT (active))))
return;
error = g_error_new_literal (NM_CLIENT_ERROR,
NM_CLIENT_ERROR_FAILED,
_("Active connection could not be attached to the device"));
activate_info_complete (info, NULL, error);
g_clear_error (&error);
}
static void
activate_cb (GObject *object,
GAsyncResult *result,
@@ -852,6 +871,9 @@ activate_cb (GObject *object,
G_CALLBACK (activation_cancelled), info);
}
g_signal_connect (info->manager, "active-connection-removed",
G_CALLBACK (active_removed), info);
recheck_pending_activations (info->manager);
} else {
g_dbus_error_strip_remote_error (error);
@@ -1043,8 +1065,6 @@ object_creation_failed (NMObject *object, const char *failed_path)
GError *error;
GSList *iter;
g_return_if_fail (find_active_connection_by_path (self, failed_path) == NULL);
/* A newly activated connection failed due to some immediate error
* and disappeared from active connection list. Make sure the
* callback gets called.

View File

@@ -5081,6 +5081,8 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex)
return;
if (!priv->is_nm_owned)
return;
if (priv->queued_act_request)
return;
if (!nm_device_is_software (self))
return;
if (nm_device_get_state (self) == NM_DEVICE_STATE_UNMANAGED)

View File

@@ -453,6 +453,7 @@ teamd_start (NMDevice *device, NMSettingTeam *s_team)
g_ptr_array_add (argv, (gpointer) "-n");
g_ptr_array_add (argv, (gpointer) "-U");
g_ptr_array_add (argv, (gpointer) "-D");
g_ptr_array_add (argv, (gpointer) "-N");
g_ptr_array_add (argv, (gpointer) "-t");
g_ptr_array_add (argv, (gpointer) iface);