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

fix: Add mutex to configurator dump #1804

Merged
merged 1 commit into from
May 12, 2021
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
6 changes: 4 additions & 2 deletions plugins/configurator/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ import (
"go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
)

const (
waitDoneCheckPendingPeriod = time.Millisecond * 10
)

// configuratorServer implements DataSyncer service.
type configuratorServer struct {
pb.UnimplementedConfiguratorServiceServer
Expand Down Expand Up @@ -75,8 +79,6 @@ func (svc *configuratorServer) Get(context.Context, *pb.GetRequest) (*pb.GetResp
return &pb.GetResponse{Config: config}, nil
}

const waitDoneCheckPendingPeriod = time.Millisecond * 10

// Update adds configuration data present in data request to the VPP/Linux
func (svc *configuratorServer) Update(ctx context.Context, req *pb.UpdateRequest) (*pb.UpdateResponse, error) {
ctx, task := trace.NewTask(ctx, "grpc.Update")
Expand Down
14 changes: 10 additions & 4 deletions plugins/configurator/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package configurator
import (
"context"
"errors"
"sync"

"go.ligato.io/cn-infra/v2/logging"

Expand Down Expand Up @@ -48,16 +49,18 @@ import (
type dumpService struct {
log logging.Logger

mux sync.Mutex

// VPP Handlers
ifHandler ifvppcalls.InterfaceVppRead
l2Handler l2vppcalls.L2VppAPI
l3Handler l3vppcalls.L3VppAPI
ipsecHandler ipsecvppcalls.IPSecVPPRead
// plugins
aclHandler aclvppcalls.ACLVppRead
abfHandler abfvppcalls.ABFVppRead
natHandler natvppcalls.NatVppRead
puntHandler vppcalls.PuntVPPRead
aclHandler aclvppcalls.ACLVppRead
abfHandler abfvppcalls.ABFVppRead
natHandler natvppcalls.NatVppRead
puntHandler vppcalls.PuntVPPRead
wireguardHandler wireguardvppcalls.WgVppRead

// Linux handlers
Expand All @@ -69,6 +72,9 @@ type dumpService struct {
func (svc *dumpService) Dump(ctx context.Context, req *rpc.DumpRequest) (*rpc.DumpResponse, error) {
defer trackOperation("Dump")()

svc.mux.Lock()
defer svc.mux.Unlock()

svc.log.Debugf("Received Dump request..")

dump := newConfig()
Expand Down