Revert "ovs: clean up interfaces from ovsdb at startup"

This reverts commit a7dfcf076c.
(cherry picked from commit 53fa956004)
(cherry picked from commit 3f5df3cdc6)
This commit is contained in:
Beniamino Galvani 2020-12-14 13:52:16 +01:00
parent 71f56a5d76
commit fb9ae657f0

View file

@ -65,7 +65,6 @@ typedef struct {
GHashTable *bridges; /* bridge uuid => OpenvswitchBridge */
char *db_uuid;
guint num_failures;
bool cleanup_done : 1;
} NMOvsdbPrivate;
struct _NMOvsdb {
@ -1477,9 +1476,6 @@ ovsdb_disconnect (NMOvsdb *self, gboolean retry, gboolean is_disposing)
_LOGD ("disconnecting from ovsdb, retry %d", retry);
/* FIXME(shutdown): NMOvsdb should process the pending calls before
* shutting down, and cancel the remaining calls after the timeout. */
if (retry) {
if (priv->calls->len != 0)
g_array_index (priv->calls, OvsdbMethodCall, 0).id = COMMAND_PENDING;
@ -1507,46 +1503,6 @@ ovsdb_disconnect (NMOvsdb *self, gboolean retry, gboolean is_disposing)
ovsdb_try_connect (self);
}
static void
_del_initial_iface_cb (GError *error, gpointer user_data)
{
NMOvsdb *self;
gs_free char *ifname = NULL;
nm_utils_user_data_unpack (user_data, &self, &ifname);
if (nm_utils_error_is_cancelled_or_disposing (error))
return;
if (error)
_LOGD ("failed to delete initial interface '%s': %s", ifname, error->message);
}
static void
ovsdb_cleanup_initial_interfaces (NMOvsdb *self)
{
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE (self);
const OpenvswitchInterface *interface;
NMUtilsUserData *data;
GHashTableIter iter;
if (priv->cleanup_done)
return;
priv->cleanup_done = TRUE;
/* Delete OVS interfaces added by NM. Bridges and ports and
* not considered because they are deleted automatically
* when no interface is present. */
g_hash_table_iter_init (&iter, self->_priv.interfaces);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&interface)) {
if (interface->connection_uuid) {
_LOGT ("deleting initial interface '%s'", interface->name);
data = nm_utils_user_data_pack (self, g_strdup (interface->name));
nm_ovsdb_del_interface (self, interface->name, _del_initial_iface_cb, data);
}
}
}
static void
_monitor_bridges_cb (NMOvsdb *self, json_t *result, GError *error, gpointer user_data)
{
@ -1561,8 +1517,6 @@ _monitor_bridges_cb (NMOvsdb *self, json_t *result, GError *error, gpointer user
/* Treat the first response the same as the subsequent "update"
* messages we eventually get. */
ovsdb_got_update (self, result);
ovsdb_cleanup_initial_interfaces (self);
}
static void