From 168248ef9757bc8e940d5d8416f69b75c196a469 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 10 Apr 2020 15:40:03 +0800 Subject: [PATCH] region: lbagent: vrrp.advert_int must be the same inside cluster --- pkg/compute/models/loadbalanceragents.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/compute/models/loadbalanceragents.go b/pkg/compute/models/loadbalanceragents.go index 9b41d33e0c..ada55618c5 100644 --- a/pkg/compute/models/loadbalanceragents.go +++ b/pkg/compute/models/loadbalanceragents.go @@ -148,6 +148,9 @@ func (p *SLoadbalancerAgentParamsVrrp) validatePeer(pp *SLoadbalancerAgentParams if p.VirtualRouterId != pp.VirtualRouterId { return fmt.Errorf("vrrp virtual_router_id of peer lbagents must be the same: %d != %d", p.VirtualRouterId, pp.VirtualRouterId) } + if p.AdvertInt != pp.AdvertInt { + return fmt.Errorf("vrrp advert_int of peer lbagents must be the same: %d != %d", p.AdvertInt, pp.AdvertInt) + } if p.Preempt != pp.Preempt { return fmt.Errorf("vrrp preempt property of peer lbagents must be the same: %v != %v", p.Preempt, pp.Preempt) } @@ -162,6 +165,9 @@ func (p *SLoadbalancerAgentParamsVrrp) needsUpdatePeer(pp *SLoadbalancerAgentPar if p.VirtualRouterId != pp.VirtualRouterId { return true } + if p.AdvertInt != pp.AdvertInt { + return true + } if p.Preempt != pp.Preempt { return true } @@ -173,6 +179,7 @@ func (p *SLoadbalancerAgentParamsVrrp) needsUpdatePeer(pp *SLoadbalancerAgentPar func (p *SLoadbalancerAgentParamsVrrp) updateBy(pp *SLoadbalancerAgentParamsVrrp) { p.VirtualRouterId = pp.VirtualRouterId + p.AdvertInt = pp.AdvertInt p.Preempt = pp.Preempt p.Pass = pp.Pass }