Commit 32670b52 authored by Dan Williams's avatar Dan Williams
Browse files

dcb: ignore fcoeadm success errors like "Connection already created"

$ /usr/sbin/fcoeadm -m fabric -c enp3s0f0
fcoeadm: Connection already created on interface enp3s0f0
Try 'fcoeadm --help' for more information.
$ echo $?
3
$

Also now log error output of failed commands instead of only when
debug logging is enabled.
parent 4515099a
......@@ -315,11 +315,19 @@ run_helper (char **argv, guint which, gpointer user_data, GError **error)
&outmsg, &errmsg, &exit_status, error);
/* Log any stderr output */
if (success && WIFEXITED (exit_status) && WEXITSTATUS (exit_status) && (errmsg || outmsg)) {
nm_log_dbg (LOGD_DCB, "'%s' failed: '%s'",
cmdline, (errmsg && strlen (errmsg)) ? errmsg : outmsg);
g_set_error (error, NM_DCB_ERROR, NM_DCB_ERROR_HELPER_FAILED,
"Failed to run '%s'", cmdline);
success = FALSE;
gboolean ignore_error = FALSE;
/* Ignore fcoeadm "success" errors like when FCoE is already set up */
if (errmsg && strstr (errmsg, "Connection already created"))
ignore_error = TRUE;
if (ignore_error == FALSE) {
nm_log_warn (LOGD_DCB, "'%s' failed: '%s'",
cmdline, (errmsg && strlen (errmsg)) ? errmsg : outmsg);
g_set_error (error, NM_DCB_ERROR, NM_DCB_ERROR_HELPER_FAILED,
"Failed to run '%s'", cmdline);
success = FALSE;
}
}
g_free (outmsg);
g_free (errmsg);
......
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