summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-02-15 17:58:28 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2018-02-15 17:58:28 +0100
commit031cc0d2086dafe671d1b752e7e1bf13e8e08a33 (patch)
tree8bf12cf083674d4c108c6b9edf2ad470c3ee070f
parentdc3eaaaac6f96cb94cafab37fe3083a4ba4b3e2d (diff)
downloadNetworkManager-bg/ovs.tar.gz
-rw-r--r--src/devices/ovs/nm-device-ovs-port.c4
-rw-r--r--src/devices/ovs/nm-ovsdb.c27
2 files changed, 17 insertions, 14 deletions
diff --git a/src/devices/ovs/nm-device-ovs-port.c b/src/devices/ovs/nm-device-ovs-port.c
index 319abfb1be..35708d9619 100644
--- a/src/devices/ovs/nm-device-ovs-port.c
+++ b/src/devices/ovs/nm-device-ovs-port.c
@@ -114,7 +114,7 @@ add_iface_cb (GError *error, gpointer user_data)
{
NMDevice *slave = user_data;
- if (error) {
+ if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
nm_log_warn (LOGD_DEVICE, "device %s could not be added to a ovs port: %s",
nm_device_get_iface (slave), error->message);
nm_device_state_changed (slave,
@@ -153,7 +153,7 @@ del_iface_cb (GError *error, gpointer user_data)
{
NMDevice *slave = user_data;
- if (error) {
+ if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
nm_log_warn (LOGD_DEVICE, "device %s could not be removed from a ovs port: %s",
nm_device_get_iface (slave), error->message);
nm_device_state_changed (slave,
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index 6d28bd2c55..8a37a4e60e 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -102,7 +102,7 @@ NM_DEFINE_SINGLETON_GETTER (NMOvsdb, nm_ovsdb_get, NM_TYPE_OVSDB);
/*****************************************************************************/
static void ovsdb_try_connect (NMOvsdb *self);
-static void ovsdb_disconnect (NMOvsdb *self);
+static void ovsdb_disconnect (NMOvsdb *self, gboolean quitting);
static void ovsdb_read (NMOvsdb *self);
static void ovsdb_write (NMOvsdb *self);
static void ovsdb_next_command (NMOvsdb *self);
@@ -1086,7 +1086,7 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg)
"result", &result,
"error", &error) == -1) {
_LOGW ("couldn't grok the message: %s", json_error.text);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
@@ -1097,7 +1097,7 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg)
/* It's a method call! */
if (!params) {
_LOGW ("a method call with no params: '%s'", method);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
@@ -1117,13 +1117,13 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg)
/* This is a response to a method call. */
if (!priv->calls->len) {
_LOGE ("there are no queued calls expecting response %" G_GUINT64_FORMAT, id);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
call = &g_array_index (priv->calls, OvsdbMethodCall, 0);
if (call->id != id) {
_LOGE ("expected a response to call %" G_GUINT64_FORMAT ", not %" G_GUINT64_FORMAT, call->id, id);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
/* Cool, we found a corresponsing call. Finish it. */
@@ -1202,7 +1202,7 @@ ovsdb_read_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
if (size == -1) {
_LOGW ("short read from ovsdb: %s", error->message);
g_clear_error (&error);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
@@ -1250,7 +1250,7 @@ ovsdb_write_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
if (size == -1) {
_LOGW ("short write to ovsdb: %s", error->message);
g_clear_error (&error);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
return;
}
@@ -1293,7 +1293,7 @@ ovsdb_write (NMOvsdb *self)
* puts us back in sync.
*/
static void
-ovsdb_disconnect (NMOvsdb *self)
+ovsdb_disconnect (NMOvsdb *self, gboolean quitting)
{
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE (self);
OvsdbMethodCall *call;
@@ -1306,7 +1306,10 @@ ovsdb_disconnect (NMOvsdb *self)
while (priv->calls->len) {
error = NULL;
call = &g_array_index (priv->calls, OvsdbMethodCall, priv->calls->len - 1);
- g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
+ if (quitting)
+ g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_CLOSED, "Quitting");
+ else
+ g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
callback = call->callback;
user_data = call->user_data;
@@ -1328,7 +1331,7 @@ _monitor_bridges_cb (NMOvsdb *self, json_t *result, GError *error, gpointer user
if (error) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
_LOGI ("%s", error->message);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
}
g_clear_error (&error);
@@ -1354,7 +1357,7 @@ _client_connect_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
_LOGI ("%s", error->message);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, FALSE);
g_clear_error (&error);
return;
}
@@ -1538,7 +1541,7 @@ dispose (GObject *object)
NMOvsdb *self = NM_OVSDB (object);
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE (self);
- ovsdb_disconnect (self);
+ ovsdb_disconnect (self, TRUE);
g_string_free (priv->input, TRUE);
priv->input = NULL;