Skip to content

Commit

Permalink
Merge pull request #931 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
zoning: allow any default instance names
  • Loading branch information
TrekkieCoder authored Jan 12, 2025
2 parents d240c10 + a48aee9 commit 5955773
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const BFDPort = 3784
const BFDDefRetryCount = 3
const (
// CIDefault - Default CI Instance name
CIDefault = "default"
CIDefault = "llb-inst0"
)

const (
Expand Down
12 changes: 0 additions & 12 deletions pkg/loxinet/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,6 @@ func (h *CIStateH) CIStateGetInst(inst string) (string, error) {
return ci.StateStr, nil
}

if inst == cmn.CIDefault {
for ciStr, ci := range h.ClusterMap {
instNum, err := parseInstance(ciStr)
if err != nil {
continue
}
if instNum == 0 {
return ci.StateStr, nil
}
}
}

return "NOT_DEFINED", errors.New("not found")
}

Expand Down
14 changes: 8 additions & 6 deletions pkg/loxinet/gobgpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,11 @@ func (gbh *GoBgpH) initBgpClient() {
gbh.advertiseAllVIPs(ciname)
}

if ciname == cmn.CIDefault {
if ci.hastate == cmn.CIStateBackup {
ciState, err := mh.has.CIStateGetInst(cmn.CIDefault)
if err == nil {
if ciState == "BACKUP" {
gbh.resetBGPPolicy(true)
} else if ci.hastate == cmn.CIStateMaster {
} else if ciState == "MASTER" {
gbh.resetBGPPolicy(false)
}
}
Expand Down Expand Up @@ -850,10 +851,11 @@ func (gbh *GoBgpH) UpdateCIState(instance string, state int, vip net.IP) {

gbh.advertiseAllVIPs(instance)
if update {
if instance == cmn.CIDefault {
if ci.hastate == cmn.CIStateBackup {
ciState, err := mh.has.CIStateGetInst(cmn.CIDefault)
if err == nil {
if ciState == "BACKUP" {
gbh.resetBGPPolicy(true)
} else if ci.hastate == cmn.CIStateMaster {
} else if ciState == "MASTER" {
gbh.resetBGPPolicy(false)
}
}
Expand Down

0 comments on commit 5955773

Please sign in to comment.