Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: gh-813 Fixed unnecessary error logs #818

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,9 @@ func ModLink(link nlp.Link, add bool) int {
Link: linkState, State: state, Mtu: mtu, Master: master, Real: real,
TunID: tunId, TunDst: tunDst, TunSrc: tunSrc})
if err != nil {
tk.LogIt(tk.LogError, "[NLP] Port %v, %v, %v, %v add failed\n", name, ifMac, state, mtu)
fmt.Println(err)
if !strings.Contains(err.Error(), "port exists") {
tk.LogIt(tk.LogError, "[NLP] Port %v, %v, %v, %v add failed\n", name, ifMac, state, mtu)
}
} else {
tk.LogIt(tk.LogInfo, "[NLP] Port %v, %v, %v, %v add [OK]\n", name, ifMac, state, mtu)
}
Expand All @@ -917,7 +918,6 @@ func ModLink(link nlp.Link, add bool) int {
ret, err = hooks.NetPortDel(&cmn.PortMod{Dev: name, Ptype: pType})
if err != nil {
tk.LogIt(tk.LogError, "[NLP] Port %v, %v, %v, %v delete failed\n", name, ifMac, state, mtu)
fmt.Println(err)
} else {
tk.LogIt(tk.LogInfo, "[NLP] Port %v, %v, %v, %v delete [OK]\n", name, ifMac, state, mtu)
}
Expand Down Expand Up @@ -1627,50 +1627,48 @@ func LbSessionGet(done bool) int {

if _, err := os.Stat(opt.Opts.ConfigPath + "/EPconfig.txt"); errors.Is(err, os.ErrNotExist) {
if err != nil {
tk.LogIt(tk.LogInfo, "[NLP] No EndPoint config file : %s \n", err.Error())
tk.LogIt(tk.LogInfo, "[NLP] Continuing without EP config file: %s\n", err.Error())
}
} else {
applyEPConfig()
}
tk.LogIt(tk.LogInfo, "[NLP] EndPoint done\n")
tk.LogIt(tk.LogInfo, "[NLP] EndPoint config process done\n")

if _, err := os.Stat(opt.Opts.ConfigPath + "/lbconfig.txt"); errors.Is(err, os.ErrNotExist) {
if err != nil {
tk.LogIt(tk.LogInfo, "[NLP] No load balancer config file : %s \n", err.Error())
tk.LogIt(tk.LogInfo, "[NLP] Continuing without LB config file : %s \n", err.Error())
}
} else {
applyLoadBalancerConfig()
}
tk.LogIt(tk.LogInfo, "[NLP] LoadBalancer config done\n")

tk.LogIt(tk.LogInfo, "[NLP] LoadBalancer done\n")
if _, err := os.Stat(opt.Opts.ConfigPath + "/sessionconfig.txt"); errors.Is(err, os.ErrNotExist) {
if err != nil {
tk.LogIt(tk.LogInfo, "[NLP] No Session config file : %s \n", err.Error())
tk.LogIt(tk.LogInfo, "[NLP] Continuing without Session config file : %s \n", err.Error())
}
} else {
applySessionConfig()
}
tk.LogIt(tk.LogInfo, "[NLP] Session config done\n")

tk.LogIt(tk.LogInfo, "[NLP] Session done\n")
if _, err := os.Stat(opt.Opts.ConfigPath + "/sessionulclconfig.txt"); errors.Is(err, os.ErrNotExist) {
if err != nil {
tk.LogIt(tk.LogInfo, "[NLP] No UlCl config file : %s \n", err.Error())
tk.LogIt(tk.LogInfo, "[NLP] Continuing without UlCl config file : %s \n", err.Error())
}
} else {
applyUlClConfig()
}
tk.LogIt(tk.LogInfo, "[NLP] Session UlCl config done\n")

tk.LogIt(tk.LogInfo, "[NLP] Session UlCl done\n")
if _, err := os.Stat(opt.Opts.ConfigPath + "/FWconfig.txt"); errors.Is(err, os.ErrNotExist) {
if err != nil {
tk.LogIt(tk.LogInfo, "[NLP] No Firewall config file : %s \n", err.Error())
tk.LogIt(tk.LogInfo, "[NLP] Continuing without Firewall config file : %s \n", err.Error())
}
} else {
applyFWConfig()
}
tk.LogIt(tk.LogInfo, "[NLP] Firewall done\n")

tk.LogIt(tk.LogInfo, "[NLP] LbSessionGet done\n")
tk.LogIt(tk.LogInfo, "[NLP] Firewall config done\n")
}

return 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/loxinet/gobgpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ func (gbh *GoBgpH) processRouteSingle(p *goBgpRouteInfo, showIdentifier bgp.BGPA

tk.LogIt(tk.LogInfo, format, pathStr...)

if err := gbh.syncRoute(p, showIdentifier); err != nil {
if err := gbh.syncRoute(p); err != nil {
tk.LogIt(tk.LogError, " failed to "+format, pathStr...)
}
}

func (gbh *GoBgpH) syncRoute(p *goBgpRouteInfo, showIdentifier bgp.BGPAddPathMode) error {
func (gbh *GoBgpH) syncRoute(p *goBgpRouteInfo) error {
if gbh.noNlp {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/loxinet/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (P *PortsH) PortAdd(name string, osid int, ptype int, zone string,
return 0, nil
}
}
tk.LogIt(tk.LogError, "port add - %s exists\n", name)
tk.LogIt(tk.LogTrace, "port add - %s exists\n", name)
return PortExistsErr, errors.New("port exists")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/loxinet/utils_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func awsAssociateElasticIp(vIP, eIP net.IP, add bool) error {

tk.LogIt(tk.LogInfo, "AWS adding elastic IP : %s\n", eIP.String())
if !add {
return awsDisassociateElasticIpWithInterface(ctx, eipAssociateID, niID)
return awsDisassociateElasticIpWithInterface(ctx, eipAssociateID)
}
return awsAssociateElasticIpWithInterface(ctx, eipID, niID, vIP)
}
Expand All @@ -723,7 +723,7 @@ func awsAssociateElasticIpWithInterface(ctx context.Context, eipID, niID string,
return err
}

func awsDisassociateElasticIpWithInterface(ctx context.Context, eipAssociateID, niID string) error {
func awsDisassociateElasticIpWithInterface(ctx context.Context, eipAssociateID string) error {
_, err := ec2Client.DisassociateAddress(ctx, &ec2.DisassociateAddressInput{
AssociationId: &eipAssociateID,
})
Expand Down
Loading