region: lbagent: vrrp.advert_int must be the same inside cluster

This commit is contained in:
Yousong Zhou
2020-04-10 15:55:15 +08:00
parent e46f6dc0e1
commit 168248ef97
+7
View File
@@ -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
}