Commit e14ea681 authored by Thomas Haller's avatar Thomas Haller

settings: log connection diffs in replace_settings only where appropriate

Only log connection diffs when we update a connection that we actually
care about.

Note that most plugin specific connections use
nm_settings_connection_replace_settings() in their constructor
to initialize themselves. These occurrences are not interesting
and spam the logfile.
parent 750f01df
......@@ -450,6 +450,7 @@ gboolean
nm_settings_connection_replace_settings (NMSettingsConnection *self,
NMConnection *new_connection,
gboolean update_unsaved,
const char *log_diff_name,
GError **error)
{
NMSettingsConnectionPrivate *priv;
......@@ -475,7 +476,8 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
*/
g_signal_handlers_block_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE));
nm_utils_log_connection_diff (new_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, "update connection", "++ ");
if (log_diff_name)
nm_utils_log_connection_diff (new_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, log_diff_name, "++ ");
nm_connection_replace_settings_from_connection (NM_CONNECTION (self), new_connection);
nm_settings_connection_set_flags (self,
......@@ -535,9 +537,9 @@ replace_and_commit (NMSettingsConnection *self,
{
GError *error = NULL;
if (nm_settings_connection_replace_settings (self, new_connection, TRUE, &error)) {
if (nm_settings_connection_replace_settings (self, new_connection, TRUE, "replace-and-commit-disk", &error))
nm_settings_connection_commit_changes (self, callback, user_data);
} else {
else {
g_assert (error);
if (callback)
callback (self, error, user_data);
......@@ -1367,7 +1369,7 @@ update_auth_cb (NMSettingsConnection *self,
con_update_cb,
info);
} else {
if (!nm_settings_connection_replace_settings (self, info->new_settings, TRUE, &local))
if (!nm_settings_connection_replace_settings (self, info->new_settings, TRUE, "replace-and-commit-memory", &local))
g_assert (local);
con_update_cb (self, local, info);
g_clear_error (&local);
......
......@@ -123,6 +123,7 @@ void nm_settings_connection_commit_changes (NMSettingsConnection *connection,
gboolean nm_settings_connection_replace_settings (NMSettingsConnection *self,
NMConnection *new_connection,
gboolean update_unsaved,
const char *log_diff_name,
GError **error);
void nm_settings_connection_replace_and_commit (NMSettingsConnection *self,
......
......@@ -82,6 +82,7 @@ nm_example_connection_new (const char *full_path,
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
tmp,
TRUE,
NULL,
error)) {
g_object_unref (object);
object = NULL;
......
......@@ -46,6 +46,7 @@ nm_ibft_connection_new (const GPtrArray *block, GError **error)
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
source,
FALSE,
NULL,
error))
g_clear_object (&object);
......
......@@ -235,6 +235,7 @@ nm_ifcfg_connection_new (NMConnection *source,
if (nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
tmp,
update_unsaved,
NULL,
error))
nm_ifcfg_connection_check_devtimeout (NM_IFCFG_CONNECTION (object));
else
......
......@@ -340,6 +340,7 @@ connection_new_or_changed (SCPluginIfcfg *self,
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (existing),
NM_CONNECTION (new),
FALSE, /* don't set Unsaved */
"ifcfg-rh-update",
&error)) {
/* Shouldn't ever get here as 'new' was verified by the reader already */
g_assert_not_reached ();
......
......@@ -82,6 +82,7 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name)
nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
tmp,
update_unsaved,
NULL,
NULL);
g_object_unref (tmp);
......
......@@ -313,6 +313,7 @@ reload_connections (NMSystemConfigInterface *config)
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (old),
NM_CONNECTION (new),
FALSE, /* don't set Unsaved */
"ifnet-update",
&error)) {
/* Shouldn't ever get here as 'new' was verified by the reader already */
g_assert_not_reached ();
......
......@@ -76,6 +76,7 @@ nm_keyfile_connection_new (NMConnection *source,
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object),
tmp,
update_unsaved,
NULL,
error)) {
g_object_unref (object);
object = NULL;
......
......@@ -126,6 +126,7 @@ update_connection (SCPluginKeyfile *self,
if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (connection),
NM_CONNECTION (tmp),
FALSE, /* don't set Unsaved */
"keyfile-update",
&error)) {
/* Shouldn't ever get here as 'new' was verified by the reader already */
g_assert_not_reached ();
......@@ -182,6 +183,7 @@ new_connection (SCPluginKeyfile *self,
if (!nm_settings_connection_replace_settings (connection,
NM_CONNECTION (tmp),
FALSE, /* don't set Unsaved */
"keyfile-update-new",
&error)) {
/* Shouldn't ever get here as 'tmp' was verified by the reader already */
g_assert_not_reached ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment