Skip to content

Commit 4980814

Browse files
committed
minor fixes for sanity
1 parent 9baea0a commit 4980814

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

netmaster/master/api.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -423,26 +423,30 @@ func ServiceProviderUpdateHandler(w http.ResponseWriter, r *http.Request, vars m
423423

424424
provider := mastercfg.ProviderDb[providerDbID]
425425
if provider == nil {
426-
log.Errorf("Provider not present in Provider DB. Invalid state")
426+
// It is not a provider . Ignore event
427+
return nil, nil
427428
}
429+
428430
for _, serviceID := range provider.Services {
429431
service := mastercfg.ServiceLBDb[serviceID]
430432
providerID := getProviderID(provider)
431433
if providerID == "" {
432-
return nil, fmt.Errorf("Invalid ProviderID from providerInfp:{%v}", provider)
434+
return nil, fmt.Errorf("Invalid ProviderID from providerInfo:{%v}", provider)
433435
}
434-
delete(service.Providers, providerID)
435-
436-
serviceLbState := &mastercfg.CfgServiceLBState{}
437-
serviceLbState.StateDriver = stateDriver
438-
err = serviceLbState.Read(serviceID)
439-
if err != nil {
440-
return nil, err
436+
if service.Providers[providerID] != nil {
437+
delete(service.Providers, providerID)
438+
439+
serviceLbState := &mastercfg.CfgServiceLBState{}
440+
serviceLbState.StateDriver = stateDriver
441+
err = serviceLbState.Read(serviceID)
442+
if err != nil {
443+
return nil, err
444+
}
445+
delete(serviceLbState.Providers, providerID)
446+
serviceLbState.Write()
447+
delete(mastercfg.ProviderDb, providerDbID)
448+
SvcProviderUpdate(serviceID, false)
441449
}
442-
delete(serviceLbState.Providers, providerID)
443-
serviceLbState.Write()
444-
delete(mastercfg.ProviderDb, providerDbID)
445-
SvcProviderUpdate(serviceID, false)
446450
}
447451

448452
}

systemtests/bgp_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,6 @@ func (s *systemtestSuite) CheckBgpRouteDistribution(c *C, containers []*containe
936936
for _, cont := range containers {
937937
nodeCount = 0
938938
for _, node := range s.nodes {
939-
logrus.Infof("Checking on Node %s", node.Name)
940939
out, _ := node.tbnode.RunCommandWithOutput("/opt/gopath/bin/gobgp global rib")
941940
fmt.Println(out)
942941
if strings.Contains(out, cont.eth0) {
@@ -967,7 +966,6 @@ func (s *systemtestSuite) CheckBgpRouteDistributionIPList(c *C, ips []string) ([
967966
for _, ip := range ips {
968967
nodeCount = 0
969968
for _, node := range s.nodes {
970-
logrus.Infof("Checking on Node %s", node.Name)
971969
out, _ := node.tbnode.RunCommandWithOutput("/opt/gopath/bin/gobgp global rib")
972970
fmt.Println(out)
973971
if strings.Contains(out, ip) {

0 commit comments

Comments
 (0)