Re: [ovs-discuss] bond: bond/show next balance time is a negative value.

2024-02-02 Thread Ilya Maximets via discuss
On 2/1/24 04:42, Huangzhidong via discuss wrote:
> Hi
> 
> When I use bond/show to get next balance time, it sometimes get a negative 
> value.
> 
> It can easily reproduce by run shell scripts:
> 
> while true; do
> ovs-appctl bond/show | grep next
> done
> 
> and it can be easily fixed by:
> 
> ofproto/bond.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/ofproto/bond.c b/ofproto/bond.c
> index cfdf44f85..384ffdb08 100644
> --- a/ofproto/bond.c
> +++ b/ofproto/bond.c
> @@ -1539,7 +1539,7 @@ bond_print_details(struct ds *ds, const struct bond 
> *bond)
>  if (bond_is_balanced(bond)) {
>  ds_put_format(ds, "next rebalance: %lld ms\n",
> -  bond->next_rebalance - time_msec());
> +    (bond->next_rebalance + bond->rebalance_interval - 
> time_msec()) % bond->rebalance_interval);
>  }
>  ds_put_format(ds, "lacp_status: %s\n",

Hi,

My understanding is that we print out negative value because rebalancing
is already overdue, i.e. we should have been rebalanced X ms ago.  And
that indicates that rebalancing will be performed as soon as possible.
Your suggested change will make the value positive, but it will no longer
be correct in this case.  We could print out a zero, I guess, instead of
a negative value, but, I think, the negative value is somewhat useful,
because we can tell how far behind OVS is on the rebalancing.

Does that make sense?

Best regards, Ilya Maximets.
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


[ovs-discuss] bond: bond/show next balance time is a negative value.

2024-02-02 Thread Huangzhidong via discuss
Hi

When I use bond/show to get next balance time, it sometimes get a negative 
value.

It can easily reproduce by run shell scripts:
while true; do
ovs-appctl bond/show | grep next
done

and it can be easily fixed by:

ofproto/bond.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/bond.c b/ofproto/bond.c
index cfdf44f85..384ffdb08 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -1539,7 +1539,7 @@ bond_print_details(struct ds *ds, const struct bond *bond)
 if (bond_is_balanced(bond)) {
 ds_put_format(ds, "next rebalance: %lld ms\n",
-  bond->next_rebalance - time_msec());
+(bond->next_rebalance + bond->rebalance_interval - 
time_msec()) % bond->rebalance_interval);
 }
 ds_put_format(ds, "lacp_status: %s\n",

Best Regards
-
?


???
This e-mail and its attachments contain confidential information from New H3C, 
which is
intended only for the person or entity whose address is listed above. Any use 
of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender
by phone or email immediately and delete it!
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss