mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
rbd: remove context where its not being used
Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
(cherry picked from commit 347b4d2885
)
This commit is contained in:
parent
826f392a9f
commit
d700274f3e
@ -191,7 +191,7 @@ func (cs *ControllerServer) parseVolCreateRequest(
|
|||||||
// get the owner of the PVC which is required for few encryption related operations
|
// get the owner of the PVC which is required for few encryption related operations
|
||||||
rbdVol.Owner = k8s.GetOwner(req.GetParameters())
|
rbdVol.Owner = k8s.GetOwner(req.GetParameters())
|
||||||
|
|
||||||
err = rbdVol.initKMS(ctx, req.GetParameters(), req.GetSecrets())
|
err = rbdVol.initKMS(req.GetParameters(), req.GetSecrets())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ func (ri *rbdImage) isFileEncrypted() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsFileEncrypted(ctx context.Context, volOptions map[string]string) (bool, error) {
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -306,8 +306,8 @@ func (rv *rbdVolume) openEncryptedDevice(ctx context.Context, devicePath string)
|
|||||||
return mapperFilePath, nil
|
return mapperFilePath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[string]string) error {
|
func (ri *rbdImage) initKMS(volOptions, credentials map[string]string) error {
|
||||||
kmsID, encType, err := ParseEncryptionOpts(ctx, volOptions, rbdDefaultEncryptionType)
|
kmsID, encType, err := ParseEncryptionOpts(volOptions, rbdDefaultEncryptionType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -332,7 +332,6 @@ func (ri *rbdImage) initKMS(ctx context.Context, volOptions, credentials map[str
|
|||||||
|
|
||||||
// ParseEncryptionOpts returns kmsID and sets Owner attribute.
|
// ParseEncryptionOpts returns kmsID and sets Owner attribute.
|
||||||
func ParseEncryptionOpts(
|
func ParseEncryptionOpts(
|
||||||
ctx context.Context,
|
|
||||||
volOptions map[string]string,
|
volOptions map[string]string,
|
||||||
fallbackEncType util.EncryptionType,
|
fallbackEncType util.EncryptionType,
|
||||||
) (string, util.EncryptionType, error) {
|
) (string, util.EncryptionType, error) {
|
||||||
|
@ -224,7 +224,7 @@ func (ns *NodeServer) populateRbdVol(
|
|||||||
return nil, status.Error(codes.Internal, err.Error())
|
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 {
|
if err != nil {
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ func RegenerateJournal(
|
|||||||
|
|
||||||
rbdVol.Owner = owner
|
rbdVol.Owner = owner
|
||||||
|
|
||||||
kmsID, encryptionType, err = ParseEncryptionOpts(ctx, volumeAttributes, util.EncryptionTypeNone)
|
kmsID, encryptionType, err = ParseEncryptionOpts(volumeAttributes, util.EncryptionTypeNone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user