From d700274f3e464d2f4d7d556010c9aa3f4099274d Mon Sep 17 00:00:00 2001 From: riya-singhal31 Date: Wed, 24 May 2023 19:13:15 +0530 Subject: [PATCH] rbd: remove context where its not being used Signed-off-by: riya-singhal31 (cherry picked from commit 347b4d288553a62fada4e69134c381ec3107e256) --- internal/rbd/controllerserver.go | 2 +- internal/rbd/encryption.go | 7 +++---- internal/rbd/nodeserver.go | 2 +- internal/rbd/rbd_journal.go | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index efa324407..b7f3beb5a 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -191,7 +191,7 @@ func (cs *ControllerServer) parseVolCreateRequest( // get the owner of the PVC which is required for few encryption related operations rbdVol.Owner = k8s.GetOwner(req.GetParameters()) - err = rbdVol.initKMS(ctx, req.GetParameters(), req.GetSecrets()) + err = rbdVol.initKMS(req.GetParameters(), req.GetSecrets()) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } diff --git a/internal/rbd/encryption.go b/internal/rbd/encryption.go index aadf3f9ba..bd5ced998 100644 --- a/internal/rbd/encryption.go +++ b/internal/rbd/encryption.go @@ -110,7 +110,7 @@ func (ri *rbdImage) isFileEncrypted() bool { } func IsFileEncrypted(ctx context.Context, volOptions map[string]string) (bool, error) { - _, encType, err := ParseEncryptionOpts(ctx, volOptions, util.EncryptionTypeInvalid) + _, encType, err := ParseEncryptionOpts(volOptions, util.EncryptionTypeInvalid) if err != nil { return false, err } @@ -306,8 +306,8 @@ func (rv *rbdVolume) openEncryptedDevice(ctx context.Context, devicePath string) return mapperFilePath, nil } -func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[string]string) error { - kmsID, encType, err := ParseEncryptionOpts(ctx, volOptions, rbdDefaultEncryptionType) +func (ri *rbdImage) initKMS(volOptions, credentials map[string]string) error { + kmsID, encType, err := ParseEncryptionOpts(volOptions, rbdDefaultEncryptionType) if err != nil { return err } @@ -332,7 +332,6 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str // ParseEncryptionOpts returns kmsID and sets Owner attribute. func ParseEncryptionOpts( - ctx context.Context, volOptions map[string]string, fallbackEncType util.EncryptionType, ) (string, util.EncryptionType, error) { diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 359b3fdf0..c4b7396ac 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -224,7 +224,7 @@ func (ns *NodeServer) populateRbdVol( return nil, status.Error(codes.Internal, err.Error()) } - err = rv.initKMS(ctx, req.GetVolumeContext(), req.GetSecrets()) + err = rv.initKMS(req.GetVolumeContext(), req.GetSecrets()) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/internal/rbd/rbd_journal.go b/internal/rbd/rbd_journal.go index f1a2da95b..468ea6bc0 100644 --- a/internal/rbd/rbd_journal.go +++ b/internal/rbd/rbd_journal.go @@ -572,7 +572,7 @@ func RegenerateJournal( rbdVol.Owner = owner - kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeNone) + kmsID, encryptionType, err = ParseEncryptionOpts(volumeAttributes, util.EncryptionTypeNone) if err != nil { return "", err }