From d1cb444072177eded84f1f2d785fe38ba8412b10 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:32:28 +0700 Subject: [PATCH] add logs before creating and deleting tap intefaces (#849) Signed-off-by: NikitaSkrynnik --- .../mechanisms/kernel/kerneltap/common.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/networkservice/mechanisms/kernel/kerneltap/common.go b/pkg/networkservice/mechanisms/kernel/kerneltap/common.go index 2dc43aec..67058ccb 100644 --- a/pkg/networkservice/mechanisms/kernel/kerneltap/common.go +++ b/pkg/networkservice/mechanisms/kernel/kerneltap/common.go @@ -21,6 +21,7 @@ package kerneltap import ( "context" + "runtime/debug" "time" interfaces "github.com/networkservicemesh/govpp/binapi/interface" @@ -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") @@ -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, })