From 09ffaee7c3499cc87b283954f881645a33b50e08 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Sun, 12 Jul 2020 10:25:14 +0530 Subject: [PATCH] cleanup: rename newVolumeOptionsFromVersion1Context for more clarity rename newVolumeOptionsFromVersion1Context to newVolumeOptionsFromMonitorList to provide more clarity to the function readers and also fixed comments. Signed-off-by: Madhu Rajanna --- internal/cephfs/nodeserver.go | 6 +++--- internal/cephfs/volumeoptions.go | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/cephfs/nodeserver.go b/internal/cephfs/nodeserver.go index cea6662a7..35108ca5e 100644 --- a/internal/cephfs/nodeserver.go +++ b/internal/cephfs/nodeserver.go @@ -94,7 +94,7 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol return nil, status.Error(codes.Internal, err.Error()) } - // check for pre-provisioned volumes (plugin versions > 1.0.0) + // gets mon IPs from the supplied cluster info volOptions, _, err = newVolumeOptionsFromStaticVolume(string(volID), req.GetVolumeContext()) if err != nil { var ensv ErrNonStaticVolume @@ -102,8 +102,8 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol return nil, status.Error(codes.Internal, err.Error()) } - // check for volumes from plugin versions <= 1.0.0 - volOptions, _, err = newVolumeOptionsFromVersion1Context(string(volID), req.GetVolumeContext(), + // get mon IPs from the volume context + volOptions, _, err = newVolumeOptionsFromMonitorList(string(volID), req.GetVolumeContext(), req.GetSecrets()) if err != nil { return nil, status.Error(codes.Internal, err.Error()) diff --git a/internal/cephfs/volumeoptions.go b/internal/cephfs/volumeoptions.go index 0ca5edcf0..c8f20c83c 100644 --- a/internal/cephfs/volumeoptions.go +++ b/internal/cephfs/volumeoptions.go @@ -307,10 +307,9 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret return &volOptions, &vid, nil } -// newVolumeOptionsFromVersion1Context generates a new instance of volumeOptions and -// volumeIdentifier from the provided CSI volume context, if the provided context was -// for a volume created by version 1.0.0 (or prior) of the CSI plugin -func newVolumeOptionsFromVersion1Context(volID string, options, secrets map[string]string) (*volumeOptions, *volumeIdentifier, error) { +// newVolumeOptionsFromMonitorList generates a new instance of volumeOptions and +// volumeIdentifier from the provided CSI volume context +func newVolumeOptionsFromMonitorList(volID string, options, secrets map[string]string) (*volumeOptions, *volumeIdentifier, error) { var ( opts volumeOptions vid volumeIdentifier @@ -318,7 +317,7 @@ func newVolumeOptionsFromVersion1Context(volID string, options, secrets map[stri err error ) - // Check if monitors is part of the options, that is an indicator this is an 1.0.0 volume + // Check if monitors is part of the options if err = extractOption(&opts.Monitors, "monitors", options); err != nil { return nil, nil, err }