Skip to content

Commit

Permalink
Merge branch 'master' into fix/rebuild-connection-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Glitchfix authored Dec 11, 2023
2 parents bb9d796 + 8ca0d50 commit ce27973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions api/server/sdk/volume_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import (
"google.golang.org/grpc/status"
)

const (
authorizationKey = "authorization"
)

// Start a volume migration
func (s *VolumeServer) Start(
ctx context.Context,
Expand All @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions csi/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit ce27973

Please sign in to comment.