Skip to content

Commit

Permalink
add logs before creating and deleting tap intefaces (#849)
Browse files Browse the repository at this point in the history
Signed-off-by: NikitaSkrynnik <[email protected]>
  • Loading branch information
NikitaSkrynnik authored Sep 13, 2024
1 parent 5db6156 commit d1cb444
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/networkservice/mechanisms/kernel/kerneltap/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package kerneltap

import (
"context"
"runtime/debug"
"time"

interfaces "github.com/networkservicemesh/govpp/binapi/interface"
Expand Down Expand Up @@ -77,6 +78,13 @@ func create(ctx context.Context, conn *networkservice.Connection, vppConn api.Co
tapCreate.TapFlags ^= tapv2.TAP_API_FLAG_TUN
}

deadline, ok := ctx.Deadline()
if ok {
timeout := time.Until(deadline)
log.FromContext(ctx).Infof("timeout before creating tap inteface: %v", timeout)
log.FromContext(ctx).Infof("stack trace: %s", string(debug.Stack()))
}

rsp, err := tapv2.NewServiceClient(vppConn).TapCreateV3(ctx, tapCreate)
if err != nil {
return errors.Wrap(err, "vppapi TapCreateV3 returned error")
Expand Down Expand Up @@ -147,6 +155,13 @@ func del(ctx context.Context, conn *networkservice.Connection, vppConn api.Conne
return nil
}
now := time.Now()

deadline, ok := ctx.Deadline()
if ok {
timeout := time.Until(deadline)
log.FromContext(ctx).Infof("timeout before deleting tap inteface: %v", timeout)
log.FromContext(ctx).Infof("stack trace: %s", string(debug.Stack()))
}
_, err := tapv2.NewServiceClient(vppConn).TapDeleteV2(ctx, &tapv2.TapDeleteV2{
SwIfIndex: swIfIndex,
})
Expand Down

0 comments on commit d1cb444

Please sign in to comment.