On 3/25/25 12:21 AM, Vladislav Odintsov wrote:
> Rebalancing stats are printed once in a run with INFO log level.
> Old detailed per-hash rebalancing stats now printed with DBG log level.
> 
> Reported-at: 
> https://mail.openvswitch.org/pipermail/ovs-dev/2025-March/422028.html
> Suggested-by: Ilya Maximets <i.maxim...@ovn.org>
> Signed-off-by: Vladislav Odintsov <vlodintsov@k2.cloud>
> ---
> v1 -> v2:
>   - Addressed Ilya's review comments.
>   - Added NEWS entry.
> ---
>  NEWS           |  4 ++++
>  ofproto/bond.c | 34 +++++++++++++++++++++++++---------
>  2 files changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index 966729665..72a902dda 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -14,6 +14,10 @@ Post-v3.5.0
>     - ovs-tcpdump:
>       * Update the --mirror-to option, adding support for specifying an
>         existing port as a mirror interface.
> +   - Bonding:
> +     * Bond rebalancing log messages of INFO log level is highly reduced: 
> they
> +       are printed once in rebalance run.  Previous detailed log messaged 
> moved
> +       to DBG log level.
>  
>  
>  v3.5.0 - 17 Feb 2025
> diff --git a/ofproto/bond.c b/ofproto/bond.c
> index 45a36fabb..adba1501d 100644
> --- a/ofproto/bond.c
> +++ b/ofproto/bond.c
> @@ -1197,13 +1197,13 @@ bond_shift_load(struct bond_entry *hash, struct 
> bond_member *to)
>      struct bond *bond = from->bond;
>      uint64_t delta = hash->tx_bytes;
>  
> -    VLOG_INFO("bond %s: shift %"PRIu64"kB of load (with hash %"PRIdPTR") "
> -              "from %s to %s (now carrying %"PRIu64"kB and "
> -              "%"PRIu64"kB load, respectively)",
> -              bond->name, delta / 1024, hash - bond->hash,
> -              from->name, to->name,
> -              (from->tx_bytes - delta) / 1024,
> -              (to->tx_bytes + delta) / 1024);
> +    VLOG_DBG("bond %s: shift %"PRIu64"kB of load (with hash %"PRIdPTR") "
> +             "from %s to %s (now carrying %"PRIu64"kB and "
> +             "%"PRIu64"kB load, respectively)",
> +             bond->name, delta / 1024, hash - bond->hash,
> +             from->name, to->name,
> +             (from->tx_bytes - delta) / 1024,
> +             (to->tx_bytes + delta) / 1024);
>  
>      /* Shift load away from 'from' to 'to'. */
>      from->tx_bytes -= delta;
> @@ -1434,8 +1434,24 @@ bond_rebalance(struct bond *bond)
>          e->tx_bytes /= 2;
>      }
>  
> -    if (use_recirc && rebalanced) {
> -        bond_update_post_recirc_rules__(bond,true);
> +    if (rebalanced) {
> +        struct ds member_stats = DS_EMPTY_INITIALIZER;
> +        int i = 0;
> +
> +        HMAP_FOR_EACH (member, hmap_node, &bond->members) {
> +            if (++i > 1) {
> +                ds_put_cstr(&member_stats, " and ");
> +            }
> +            ds_put_format(&member_stats, "%s:%"PRIu64"kB", member->name,
> +                          member->tx_bytes / 1024);
> +        }
> +        VLOG_INFO("bond %s: rebalanced (now carrying: %s)",
> +                  bond->name, member_stats.string);

We should not use the internal members of the dynamic string.
This should be ds_cstr() or ds_cstr_ro().

I fixed that and applied this one patch to main with also a small
adjustment int the NEWS entry.

Thanks!

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to