From d4f65c986d5c6d78fb345db040c599c45e76cb6a Mon Sep 17 00:00:00 2001 From: Neelesh Thakur Date: Wed, 6 Dec 2023 10:30:34 -0800 Subject: [PATCH 1/2] PWX-35277: copy auth token to the outgoing gRPC metadata (#2378) Need to explicitly copy the auth token to the outgoing gRPC metadata when forwarding the request to another node. Signed-off-by: Neelesh Thakur --- api/server/sdk/volume_migrate.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/server/sdk/volume_migrate.go b/api/server/sdk/volume_migrate.go index dca0591d3..1723314e6 100644 --- a/api/server/sdk/volume_migrate.go +++ b/api/server/sdk/volume_migrate.go @@ -27,6 +27,10 @@ import ( "google.golang.org/grpc/status" ) +const ( + authorizationKey = "authorization" +) + // Start a volume migration func (s *VolumeServer) Start( ctx context.Context, @@ -43,6 +47,11 @@ func (s *VolumeServer) Start( // Forward the request to some other node and set the context metadata so that // the request is terminated at the receiving node. rctx := metadata.AppendToOutgoingContext(ctx, ContextRoundRobinTerminateKey, "true") + // append auth + auth := md.Get(authorizationKey) + if len(auth) > 0 { + rctx = metadata.AppendToOutgoingContext(rctx, authorizationKey, auth[0]) + } remoteConn, remote, err := s.balancer().GetRemoteNodeConnection(rctx) if err == nil && remote { return api.NewOpenStorageMigrateClient(remoteConn).Start(rctx, req) From 8ca0d50dfb4aaa700c3269fe2b9920c1973eca04 Mon Sep 17 00:00:00 2001 From: Grant Griffiths Date: Wed, 6 Dec 2023 13:08:21 -0800 Subject: [PATCH 2/2] PWX-35292: Reduce log level for chatty log Volume was deleted (#2380) Signed-off-by: Grant Griffiths --- csi/node.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/csi/node.go b/csi/node.go index 5c056d3cc..cd8c4a1b7 100644 --- a/csi/node.go +++ b/csi/node.go @@ -73,7 +73,6 @@ func (s *OsdCsiServer) NodeGetInfo( // target path on the node. // // TODO: Support READ ONLY Mounts -// func (s *OsdCsiServer) NodePublishVolume( ctx context.Context, req *csi.NodePublishVolumeRequest, @@ -236,14 +235,14 @@ func (s *OsdCsiServer) NodeUnpublishVolume( vols, err := s.driver.Enumerate(&api.VolumeLocator{VolumeIds: []string{req.GetVolumeId()}}, nil) if err != nil || len(vols) < 1 { if err == kvdb.ErrNotFound { - clogger.WithContext(ctx).Infof("Volume %s was deleted or cannot be found: %s", req.GetVolumeId(), err.Error()) + clogger.WithContext(ctx).Tracef("Volume %s was deleted or cannot be found: %s", req.GetVolumeId(), err.Error()) return &csi.NodeUnpublishVolumeResponse{}, nil } else if err != nil { return nil, status.Errorf(codes.NotFound, "Volume id %s not found: %s", req.GetVolumeId(), err.Error()) } else { - clogger.WithContext(ctx).Infof("Volume %s was deleted or cannot be found", req.GetVolumeId()) + clogger.WithContext(ctx).Tracef("Volume %s was deleted or cannot be found", req.GetVolumeId()) return &csi.NodeUnpublishVolumeResponse{}, nil } }