summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-12-09 11:45:32 +0100
committerThomas Haller <thaller@redhat.com>2015-03-05 12:55:51 +0100
commite67ca4417692efe14b3be3263d09d237a1406492 (patch)
tree8841c01826bbf181e1b2ef1e37895719d4e71fad
parent5be37c7b30342026649cf0ad2d653ca16ef09ac3 (diff)
downloadNetworkManager-e67ca4417692efe14b3be3263d09d237a1406492.tar.gz
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. (cherry picked from commit e14ea6818a7edab2438b8fc4664a4499cc981748)
-rw-r--r--src/settings/nm-settings-connection.c10
-rw-r--r--src/settings/nm-settings-connection.h1
-rw-r--r--src/settings/plugins/example/nm-example-connection.c1
-rw-r--r--src/settings/plugins/ibft/nm-ibft-connection.c1
-rw-r--r--src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c1
-rw-r--r--src/settings/plugins/ifcfg-rh/plugin.c1
-rw-r--r--src/settings/plugins/ifnet/nm-ifnet-connection.c1
-rw-r--r--src/settings/plugins/ifnet/plugin.c1
-rw-r--r--src/settings/plugins/keyfile/nm-keyfile-connection.c1
-rw-r--r--src/settings/plugins/keyfile/plugin.c2
10 files changed, 16 insertions, 4 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 9618ccd9ee..b5e1e56812 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -447,6 +447,7 @@ gboolean
nm_settings_connection_replace_settings (NMSettingsConnection *self,
NMConnection *new_connection,
gboolean update_unsaved,
+ const char *log_diff_name,
GError **error)
{
NMSettingsConnectionPrivate *priv;
@@ -472,7 +473,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,
@@ -532,9 +534,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);
@@ -1365,7 +1367,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);
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index 8875097215..49661f38c6 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -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,
diff --git a/src/settings/plugins/example/nm-example-connection.c b/src/settings/plugins/example/nm-example-connection.c
index 2f0b20a08b..e125961130 100644
--- a/src/settings/plugins/example/nm-example-connection.c
+++ b/src/settings/plugins/example/nm-example-connection.c
@@ -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;
diff --git a/src/settings/plugins/ibft/nm-ibft-connection.c b/src/settings/plugins/ibft/nm-ibft-connection.c
index 5459a70504..c6a9054e47 100644
--- a/src/settings/plugins/ibft/nm-ibft-connection.c
+++ b/src/settings/plugins/ibft/nm-ibft-connection.c
@@ -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);
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
index 014f69e44a..9005a375f0 100644
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
@@ -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
diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c
index 458e62898d..e608a29f88 100644
--- a/src/settings/plugins/ifcfg-rh/plugin.c
+++ b/src/settings/plugins/ifcfg-rh/plugin.c
@@ -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 ();
diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c
index c84ad5ed95..693e653288 100644
--- a/src/settings/plugins/ifnet/nm-ifnet-connection.c
+++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c
@@ -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);
diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c
index 37e2907777..218e44aa08 100644
--- a/src/settings/plugins/ifnet/plugin.c
+++ b/src/settings/plugins/ifnet/plugin.c
@@ -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 ();
diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.c b/src/settings/plugins/keyfile/nm-keyfile-connection.c
index 9ff65a20aa..8fb94302d7 100644
--- a/src/settings/plugins/keyfile/nm-keyfile-connection.c
+++ b/src/settings/plugins/keyfile/nm-keyfile-connection.c
@@ -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;
diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c
index f7c9211c7e..e79ad551b8 100644
--- a/src/settings/plugins/keyfile/plugin.c
+++ b/src/settings/plugins/keyfile/plugin.c
@@ -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 ();