devices: improve slave release log messages

Rather than putting "success %d" in the message, log different
messages (at different priorities) for success and failure.
This commit is contained in:
Dan Winship 2014-02-25 16:41:33 -05:00
parent c48ba1ab10
commit 01b7bef6b4
4 changed files with 31 additions and 13 deletions

View file

@ -447,10 +447,15 @@ release_slave (NMDevice *device, NMDevice *slave)
success = nm_platform_link_release (nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
nm_log_info (LOGD_BOND, "(%s): released bond slave %s (success %d)",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave),
success);
if (success) {
nm_log_info (LOGD_BOND, "(%s): released bond slave %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
} else {
nm_log_warn (LOGD_BOND, "(%s): failed to release bond slave %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
}
g_object_notify (G_OBJECT (device), "slaves");
/* Kernel bonding code "closes" the slave when releasing it, (which clears

View file

@ -404,10 +404,16 @@ release_slave (NMDevice *device, NMDevice *slave)
success = nm_platform_link_release (nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
nm_log_info (LOGD_BRIDGE, "(%s): detached bridge port %s (success %d)",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave),
success);
if (success) {
nm_log_info (LOGD_BRIDGE, "(%s): detached bridge port %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
} else {
nm_log_warn (LOGD_BRIDGE, "(%s): failed to detach bridge port %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
}
g_object_notify (G_OBJECT (device), NM_DEVICE_BRIDGE_SLAVES);
return success;
}

View file

@ -717,10 +717,15 @@ release_slave (NMDevice *device, NMDevice *slave)
success = nm_platform_link_release (nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
nm_log_info (LOGD_TEAM, "(%s): released team port %s (success %d)",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave),
success);
if (success) {
nm_log_info (LOGD_TEAM, "(%s): released team port %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
} else {
nm_log_warn (LOGD_TEAM, "(%s): failed to release team port %s",
nm_device_get_ip_iface (device),
nm_device_get_ip_iface (slave));
}
g_object_notify (G_OBJECT (device), "slaves");
/* Kernel team code "closes" the port when releasing it, (which clears

View file

@ -960,7 +960,9 @@ nm_device_release_one_slave (NMDevice *dev, NMDevice *slave)
if (info->enslaved) {
success = NM_DEVICE_GET_CLASS (dev)->release_slave (dev, slave);
g_warn_if_fail (success);
/* The release_slave() implementation logs success/failure (in the
* correct device-specific log domain), so we don't have to do anything.
*/
}
if (priv->state == NM_DEVICE_STATE_FAILED)