Skip to content

Commit

Permalink
[qfix] Delete only generated vxlan vni on error (#1177)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
  • Loading branch information
glazychev-art authored Nov 25, 2021
1 parent 845b520 commit 73e9530
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/networkservice/common/mechanisms/vxlan/vni/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func (v *vniServer) Request(ctx context.Context, request *networkservice.Network
return conn, err
}

if vni, ok := load(ctx, metadata.IsClient(v)); ok {
vni, loaded := load(ctx, metadata.IsClient(v))
if loaded {
mechanism.SetVNI(vni)
logger.WithField("vni", vni).Debugf("vni loaded from metadata")
} else {
Expand All @@ -114,7 +115,7 @@ func (v *vniServer) Request(ctx context.Context, request *networkservice.Network
}

conn, err := next.Server(ctx).Request(ctx, request)
if err != nil {
if err != nil && !loaded {
delete(ctx, metadata.IsClient(v))
v.Map.Delete(k)

Expand Down

0 comments on commit 73e9530

Please sign in to comment.