summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-06-12 18:30:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-06-14 10:33:26 +0200
commite948ce7debb4f2da2db9c19ab4f980eac5415b9d (patch)
tree771d95b2e8dcf3e02f7f6732a44d456e9998774c
parentf2c066e1046cc8da5a277b1528a59bf2653e17c8 (diff)
downloadNetworkManager-e948ce7debb4f2da2db9c19ab4f980eac5415b9d.tar.gz
ovs/ovsdb: track the devices before we signal addition
This doesn't make any difference in practice, but it seems more correct. It would cause issues if we decided to remove an interface from the signal handler.
-rw-r--r--src/devices/ovs/nm-ovsdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index c11abe51c5..4bb9928758 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -923,6 +923,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
ovs_interface->name = g_strdup (name);
ovs_interface->type = g_strdup (type);
ovs_interface->connection_uuid = _connection_uuid_from_external_ids (external_ids);
+ g_hash_table_insert (priv->interfaces, g_strdup (key), ovs_interface);
if (old) {
_LOGT ("changed an '%s' interface: %s%s%s", type, ovs_interface->name,
ovs_interface->connection_uuid ? ", " : "",
@@ -947,7 +948,6 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
ovs_interface->connection_uuid,
json_string_value (error));
}
- g_hash_table_insert (priv->interfaces, g_strdup (key), ovs_interface);
}
}
@@ -984,6 +984,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
ovs_port->connection_uuid = _connection_uuid_from_external_ids (external_ids);
ovs_port->interfaces = g_ptr_array_new_with_free_func (g_free);
_uuids_to_array (ovs_port->interfaces, items);
+ g_hash_table_insert (priv->ports, g_strdup (key), ovs_port);
if (old) {
_LOGT ("changed a port: %s%s%s", ovs_port->name,
ovs_port->connection_uuid ? ", " : "",
@@ -995,7 +996,6 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
g_signal_emit (self, signals[DEVICE_ADDED], 0,
ovs_port->name, NM_DEVICE_TYPE_OVS_PORT);
}
- g_hash_table_insert (priv->ports, g_strdup (key), ovs_port);
}
}
@@ -1032,6 +1032,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
ovs_bridge->connection_uuid = _connection_uuid_from_external_ids (external_ids);
ovs_bridge->ports = g_ptr_array_new_with_free_func (g_free);
_uuids_to_array (ovs_bridge->ports, items);
+ g_hash_table_insert (priv->bridges, g_strdup (key), ovs_bridge);
if (old) {
_LOGT ("changed a bridge: %s%s%s", ovs_bridge->name,
ovs_bridge->connection_uuid ? ", " : "",
@@ -1043,7 +1044,6 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
g_signal_emit (self, signals[DEVICE_ADDED], 0,
ovs_bridge->name, NM_DEVICE_TYPE_OVS_BRIDGE);
}
- g_hash_table_insert (priv->bridges, g_strdup (key), ovs_bridge);
}
}