merge: branch 'ih/ovsdb-update-log'

ovs: print clearer logs of the ovsdb "update" event

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2297
This commit is contained in:
Íñigo Huguet 2025-10-22 06:07:32 +00:00
commit d06fd85e57

View file

@ -1890,7 +1890,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
== -1) { == -1) {
/* This doesn't really have to be an error; the key might /* This doesn't really have to be an error; the key might
* be missing if there really are no bridges present. */ * be missing if there really are no bridges present. */
_LOGD("Bad update: %s", json_error.text); _LOGD("monitor: bad update: %s", json_error.text);
} }
if (ovs) { if (ovs) {
@ -1936,12 +1936,12 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
&unused)) &unused))
continue; continue;
_LOGT("obj[iface:%s]: removed an '%s' interface: %s%s%s", _LOGT("monitor: %s: interface removed: type=%s, obj[iface:%s]%s%s",
key,
ovs_interface->type,
ovs_interface->name, ovs_interface->name,
ovs_interface->type,
key,
NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid,
", ", ", connection=",
ovs_interface->connection_uuid, ovs_interface->connection_uuid,
"")); ""));
_signal_emit_device_removed(self, _signal_emit_device_removed(self,
@ -1989,13 +1989,14 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
gs_free char *strtmp1 = NULL; gs_free char *strtmp1 = NULL;
gs_free char *strtmp2 = NULL; gs_free char *strtmp2 = NULL;
_LOGT("obj[iface:%s]: changed an '%s' interface: %s%s%s, external-ids=%s, " _LOGT(
"monitor: %s: interface changed: type=%s, obj[iface:%s]%s%s, external-ids=%s, "
"other-config=%s", "other-config=%s",
key,
type,
ovs_interface->name, ovs_interface->name,
type,
key,
NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid,
", ", ", connection=",
ovs_interface->connection_uuid, ovs_interface->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_interface->external_ids)), (strtmp1 = _strdict_to_string(ovs_interface->external_ids)),
@ -2015,13 +2016,13 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
.other_config = g_steal_pointer(&other_config_arr), .other_config = g_steal_pointer(&other_config_arr),
}; };
g_hash_table_add(priv->interfaces, ovs_interface); g_hash_table_add(priv->interfaces, ovs_interface);
_LOGT( _LOGT("monitor: %s: interface added: type=%s, obj[iface:%s]%s%s, external-ids=%s, "
"obj[iface:%s]: added an '%s' interface: %s%s%s, external-ids=%s, other-config=%s", "other-config=%s",
key,
ovs_interface->type,
ovs_interface->name, ovs_interface->name,
ovs_interface->type,
key,
NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_interface->connection_uuid,
", ", ", connection=",
ovs_interface->connection_uuid, ovs_interface->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_interface->external_ids)), (strtmp1 = _strdict_to_string(ovs_interface->external_ids)),
@ -2071,11 +2072,11 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
if (!g_hash_table_steal_extended(priv->ports, &key, (gpointer *) &ovs_port, &unused)) if (!g_hash_table_steal_extended(priv->ports, &key, (gpointer *) &ovs_port, &unused))
continue; continue;
_LOGT("obj[port:%s]: removed a port: %s%s%s", _LOGT("monitor: %s: port removed: obj[port:%s]%s%s",
key,
ovs_port->name, ovs_port->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid,
", ", ", connection=",
ovs_port->connection_uuid, ovs_port->connection_uuid,
"")); ""));
_signal_emit_device_removed(self, ovs_port->name, NM_DEVICE_TYPE_OVS_PORT, NULL); _signal_emit_device_removed(self, ovs_port->name, NM_DEVICE_TYPE_OVS_PORT, NULL);
@ -2122,11 +2123,12 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
gs_free char *strtmp1 = NULL; gs_free char *strtmp1 = NULL;
gs_free char *strtmp2 = NULL; gs_free char *strtmp2 = NULL;
_LOGT("obj[port:%s]: changed a port: %s%s%s, external-ids=%s, other-config=%s", _LOGT(
key, "monitor: %s: port changed: obj[port:%s]%s%s, external-ids=%s, other-config=%s",
ovs_port->name, ovs_port->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid,
", ", ", connection=",
ovs_port->connection_uuid, ovs_port->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_port->external_ids)), (strtmp1 = _strdict_to_string(ovs_port->external_ids)),
@ -2146,11 +2148,11 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
.other_config = g_steal_pointer(&other_config_arr), .other_config = g_steal_pointer(&other_config_arr),
}; };
g_hash_table_add(priv->ports, ovs_port); g_hash_table_add(priv->ports, ovs_port);
_LOGT("obj[port:%s]: added a port: %s%s%s, external-ids=%s, other-config=%s", _LOGT("monitor: %s: port added: obj[port:%s]%s%s, external-ids=%s, other-config=%s",
key,
ovs_port->name, ovs_port->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_port->connection_uuid,
", ", ", connection=",
ovs_port->connection_uuid, ovs_port->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_port->external_ids)), (strtmp1 = _strdict_to_string(ovs_port->external_ids)),
@ -2192,11 +2194,11 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
&unused)) &unused))
continue; continue;
_LOGT("obj[bridge:%s]: removed a bridge: %s%s%s", _LOGT("monitor: %s: bridge removed: obj[bridge:%s]%s%s",
key,
ovs_bridge->name, ovs_bridge->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid,
", ", ", connection=",
ovs_bridge->connection_uuid, ovs_bridge->connection_uuid,
"")); ""));
_signal_emit_device_removed(self, ovs_bridge->name, NM_DEVICE_TYPE_OVS_BRIDGE, NULL); _signal_emit_device_removed(self, ovs_bridge->name, NM_DEVICE_TYPE_OVS_BRIDGE, NULL);
@ -2243,11 +2245,12 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
gs_free char *strtmp1 = NULL; gs_free char *strtmp1 = NULL;
gs_free char *strtmp2 = NULL; gs_free char *strtmp2 = NULL;
_LOGT("obj[bridge:%s]: changed a bridge: %s%s%s, external-ids=%s, other-config=%s", _LOGT("monitor: %s: bridge changed: obj[bridge:%s]%s%s, external-ids=%s, "
key, "other-config=%s",
ovs_bridge->name, ovs_bridge->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid,
", ", ", connection=",
ovs_bridge->connection_uuid, ovs_bridge->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_bridge->external_ids)), (strtmp1 = _strdict_to_string(ovs_bridge->external_ids)),
@ -2267,11 +2270,11 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
.other_config = g_steal_pointer(&other_config_arr), .other_config = g_steal_pointer(&other_config_arr),
}; };
g_hash_table_add(priv->bridges, ovs_bridge); g_hash_table_add(priv->bridges, ovs_bridge);
_LOGT("obj[bridge:%s]: added a bridge: %s%s%s, external-ids=%s, other-config=%s", _LOGT("monitor: %s: bridge added: obj[bridge:%s]%s%s, external-ids=%s, other-config=%s",
key,
ovs_bridge->name, ovs_bridge->name,
key,
NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid, NM_PRINT_FMT_QUOTED2(ovs_bridge->connection_uuid,
", ", ", connection=",
ovs_bridge->connection_uuid, ovs_bridge->connection_uuid,
""), ""),
(strtmp1 = _strdict_to_string(ovs_bridge->external_ids)), (strtmp1 = _strdict_to_string(ovs_bridge->external_ids)),