diff mbox series

[ovs-dev,v2] bfd: Improve state change log message.

Message ID 2d84e0cbc3c68cfbc2a8c22571e4a7c26175d253.1709670667.git.tredaelli@redhat.com
State Accepted
Commit 07c2ef5cd00ae416ef2ebefeab3cbc4def745275
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,v2] bfd: Improve state change log message. | expand

Checks

Context Check Description
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Timothy Redaelli March 5, 2024, 8:37 p.m. UTC
A log message like this one:

2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
Down".

can be hard to read since '->' usually represents a status change, but
in this case the diagnostic code stays constant. Update the log message to
avoid such ambiguity. The log message for the above event become:

2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session
Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session
Down")

Reported-by: Alex Stupnikov <astupnik@redhat.com>
Reported-at: https://bugzilla.redhat.com/2258496
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---

v1 -> v2:
Restructured the message format as suggested by Ilya Maximets and Eelco
Chaudron to avoid ambiguity

---
 lib/bfd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Eelco Chaudron March 8, 2024, 10:22 a.m. UTC | #1
On 5 Mar 2024, at 21:37, Timothy Redaelli wrote:

> A log message like this one:
>
> 2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
> change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
> Down".
>
> can be hard to read since '->' usually represents a status change, but
> in this case the diagnostic code stays constant. Update the log message to
> avoid such ambiguity. The log message for the above event become:
>
> 2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
> change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session
> Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session
> Down")
>
> Reported-by: Alex Stupnikov <astupnik@redhat.com>
> Reported-at: https://bugzilla.redhat.com/2258496
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>

Thanks for following up, the change looks good to me!

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Ilya Maximets March 8, 2024, 9:24 p.m. UTC | #2
On 3/8/24 11:22, Eelco Chaudron wrote:
> 
> 
> On 5 Mar 2024, at 21:37, Timothy Redaelli wrote:
> 
>> A log message like this one:
>>
>> 2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
>> change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
>> Down".
>>
>> can be hard to read since '->' usually represents a status change, but
>> in this case the diagnostic code stays constant. Update the log message to
>> avoid such ambiguity. The log message for the above event become:
>>
>> 2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
>> change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session
>> Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session
>> Down")
>>
>> Reported-by: Alex Stupnikov <astupnik@redhat.com>
>> Reported-at: https://bugzilla.redhat.com/2258496
>> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> 
> Thanks for following up, the change looks good to me!
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> 

Thanks, Timothy and Eelco!

Applied and backported down to 2.17 as previously discussed.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/bfd.c b/lib/bfd.c
index 9af258917..b8149e789 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -1130,10 +1130,11 @@  bfd_set_state(struct bfd *bfd, enum state state, enum diag diag)
         if (!VLOG_DROP_INFO(&rl)) {
             struct ds ds = DS_EMPTY_INITIALIZER;
 
-            ds_put_format(&ds, "%s: BFD state change: %s->%s"
-                          " \"%s\"->\"%s\".\n",
+            ds_put_format(&ds, "%s: BFD state change: (bfd.SessionState: %s,"
+                          " bfd.LocalDiag: \"%s\") -> (bfd.SessionState: %s,"
+                          " bfd.LocalDiag: \"%s\")\n",
                           bfd->name, bfd_state_str(bfd->state),
-                          bfd_state_str(state), bfd_diag_str(bfd->diag),
+                          bfd_diag_str(bfd->diag), bfd_state_str(state),
                           bfd_diag_str(diag));
             bfd_put_details(&ds, bfd);
             VLOG_INFO("%s", ds_cstr(&ds));