mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cleanup: address godot warnings
Top level comments should end in a period Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
@ -23,12 +23,12 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
)
|
||||
|
||||
// MDSMap is a representation of the mds map sub-structure returned by 'ceph fs get'
|
||||
// MDSMap is a representation of the mds map sub-structure returned by 'ceph fs get'.
|
||||
type MDSMap struct {
|
||||
FilesystemName string `json:"fs_name"`
|
||||
}
|
||||
|
||||
// CephFilesystemDetails is a representation of the main json structure returned by 'ceph fs get'
|
||||
// CephFilesystemDetails is a representation of the main json structure returned by 'ceph fs get'.
|
||||
type CephFilesystemDetails struct {
|
||||
ID int64 `json:"id"`
|
||||
MDSMap MDSMap `json:"mdsmap"`
|
||||
@ -53,7 +53,7 @@ func getFscID(ctx context.Context, monitors string, cr *util.Credentials, fsName
|
||||
return fsDetails.ID, nil
|
||||
}
|
||||
|
||||
// CephFilesystem is a representation of the json structure returned by 'ceph fs ls'
|
||||
// CephFilesystem is a representation of the json structure returned by 'ceph fs ls'.
|
||||
type CephFilesystem struct {
|
||||
Name string `json:"name"`
|
||||
MetadataPool string `json:"metadata_pool"`
|
||||
@ -87,7 +87,7 @@ func getMetadataPool(ctx context.Context, monitors string, cr *util.Credentials,
|
||||
return "", util.ErrPoolNotFound{Pool: fsName, Err: fmt.Errorf("fsName (%s) not found in Ceph cluster", fsName)}
|
||||
}
|
||||
|
||||
// CephFilesystemDump is a representation of the main json structure returned by 'ceph fs dump'
|
||||
// CephFilesystemDump is a representation of the main json structure returned by 'ceph fs dump'.
|
||||
type CephFilesystemDump struct {
|
||||
Filesystems []CephFilesystemDetails `json:"filesystems"`
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ type ControllerServer struct {
|
||||
VolumeLocks *util.VolumeLocks
|
||||
}
|
||||
|
||||
// createBackingVolume creates the backing subvolume and on any error cleans up any created entities
|
||||
// createBackingVolume creates the backing subvolume and on any error cleans up any created entities.
|
||||
func (cs *ControllerServer) createBackingVolume(ctx context.Context, volOptions *volumeOptions, vID *volumeIdentifier, secret map[string]string) error {
|
||||
cr, err := util.NewAdminCredentials(secret)
|
||||
if err != nil {
|
||||
@ -54,7 +54,7 @@ func (cs *ControllerServer) createBackingVolume(ctx context.Context, volOptions
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateVolume creates a reservation and the volume in backend, if it is not already present
|
||||
// CreateVolume creates a reservation and the volume in backend, if it is not already present.
|
||||
func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
||||
if err := cs.validateCreateVolumeRequest(req); err != nil {
|
||||
klog.Errorf(util.Log(ctx, "CreateVolumeRequest validation failed: %v"), err)
|
||||
@ -150,7 +150,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
return &csi.CreateVolumeResponse{Volume: volume}, nil
|
||||
}
|
||||
|
||||
// DeleteVolume deletes the volume in backend and its reservation
|
||||
// DeleteVolume deletes the volume in backend and its reservation.
|
||||
func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
||||
if err := cs.validateDeleteVolumeRequest(); err != nil {
|
||||
klog.Errorf(util.Log(ctx, "DeleteVolumeRequest validation failed: %v"), err)
|
||||
@ -256,7 +256,7 @@ func (cs *ControllerServer) ValidateVolumeCapabilities(
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ControllerExpandVolume expands CephFS Volumes on demand based on resizer request
|
||||
// ControllerExpandVolume expands CephFS Volumes on demand based on resizer request.
|
||||
func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
|
||||
if err := cs.validateExpandVolumeRequest(req); err != nil {
|
||||
klog.Errorf(util.Log(ctx, "ControllerExpandVolumeRequest validation failed: %v"), err)
|
||||
|
@ -37,7 +37,7 @@ const (
|
||||
radosNamespace = "csi"
|
||||
)
|
||||
|
||||
// Driver contains the default identity,node and controller struct
|
||||
// Driver contains the default identity,node and controller struct.
|
||||
type Driver struct {
|
||||
cd *csicommon.CSIDriver
|
||||
|
||||
@ -56,19 +56,19 @@ var (
|
||||
volJournal *journal.Config
|
||||
)
|
||||
|
||||
// NewDriver returns new ceph driver
|
||||
// NewDriver returns new ceph driver.
|
||||
func NewDriver() *Driver {
|
||||
return &Driver{}
|
||||
}
|
||||
|
||||
// NewIdentityServer initialize a identity server for ceph CSI driver
|
||||
// NewIdentityServer initialize a identity server for ceph CSI driver.
|
||||
func NewIdentityServer(d *csicommon.CSIDriver) *IdentityServer {
|
||||
return &IdentityServer{
|
||||
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
|
||||
}
|
||||
}
|
||||
|
||||
// NewControllerServer initialize a controller server for ceph CSI driver
|
||||
// NewControllerServer initialize a controller server for ceph CSI driver.
|
||||
func NewControllerServer(d *csicommon.CSIDriver) *ControllerServer {
|
||||
return &ControllerServer{
|
||||
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
|
||||
@ -85,7 +85,7 @@ func NewNodeServer(d *csicommon.CSIDriver, t string, topology map[string]string)
|
||||
}
|
||||
|
||||
// Run start a non-blocking grpc controller,node and identityserver for
|
||||
// ceph CSI driver which can serve multiple parallel requests
|
||||
// ceph CSI driver which can serve multiple parallel requests.
|
||||
func (fs *Driver) Run(conf *util.Config) {
|
||||
var err error
|
||||
var topology map[string]string
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package cephfs
|
||||
|
||||
// ErrInvalidVolID is returned when a CSI passed VolumeID is not conformant to any known volume ID
|
||||
// formats
|
||||
// formats.
|
||||
type ErrInvalidVolID struct {
|
||||
err error
|
||||
}
|
||||
@ -33,7 +33,7 @@ func (e ErrInvalidVolID) Unwrap() error {
|
||||
}
|
||||
|
||||
// ErrNonStaticVolume is returned when a volume is detected as not being
|
||||
// statically provisioned
|
||||
// statically provisioned.
|
||||
type ErrNonStaticVolume struct {
|
||||
err error
|
||||
}
|
||||
@ -48,7 +48,7 @@ func (e ErrNonStaticVolume) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrVolumeNotFound is returned when a subvolume is not found in CephFS
|
||||
// ErrVolumeNotFound is returned when a subvolume is not found in CephFS.
|
||||
type ErrVolumeNotFound struct {
|
||||
err error
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
// volumeIdentifier structure contains an association between the CSI VolumeID to its subvolume
|
||||
// name on the backing CephFS instance
|
||||
// name on the backing CephFS instance.
|
||||
type volumeIdentifier struct {
|
||||
FsSubvolName string
|
||||
VolumeID string
|
||||
@ -100,7 +100,7 @@ func checkVolExists(ctx context.Context, volOptions *volumeOptions, secret map[s
|
||||
return &vid, nil
|
||||
}
|
||||
|
||||
// undoVolReservation is a helper routine to undo a name reservation for a CSI VolumeName
|
||||
// undoVolReservation is a helper routine to undo a name reservation for a CSI VolumeName.
|
||||
func undoVolReservation(ctx context.Context, volOptions *volumeOptions, vid volumeIdentifier, secret map[string]string) error {
|
||||
cr, err := util.NewAdminCredentials(secret)
|
||||
if err != nil {
|
||||
@ -135,7 +135,7 @@ func updateTopologyConstraints(volOpts *volumeOptions) error {
|
||||
}
|
||||
|
||||
// reserveVol is a helper routine to request a UUID reservation for the CSI VolumeName and,
|
||||
// to generate the volume identifier for the reserved UUID
|
||||
// to generate the volume identifier for the reserved UUID.
|
||||
func reserveVol(ctx context.Context, volOptions *volumeOptions, secret map[string]string) (*volumeIdentifier, error) {
|
||||
var (
|
||||
vid volumeIdentifier
|
||||
|
@ -30,7 +30,7 @@ type IdentityServer struct {
|
||||
*csicommon.DefaultIdentityServer
|
||||
}
|
||||
|
||||
// GetPluginCapabilities returns available capabilities of the ceph driver
|
||||
// GetPluginCapabilities returns available capabilities of the ceph driver.
|
||||
func (is *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||
return &csi.GetPluginCapabilitiesResponse{
|
||||
Capabilities: []*csi.PluginCapability{
|
||||
|
@ -197,7 +197,7 @@ func (*NodeServer) mount(ctx context.Context, volOptions *volumeOptions, req *cs
|
||||
}
|
||||
|
||||
// NodePublishVolume mounts the volume mounted to the staging path to the target
|
||||
// path
|
||||
// path.
|
||||
func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
||||
mountOptions := []string{"bind", "_netdev"}
|
||||
if err := util.ValidateNodePublishVolumeRequest(req); err != nil {
|
||||
@ -250,7 +250,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
return &csi.NodePublishVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeUnpublishVolume unmounts the volume from the target path
|
||||
// NodeUnpublishVolume unmounts the volume from the target path.
|
||||
func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
||||
var err error
|
||||
if err = util.ValidateNodeUnpublishVolumeRequest(req); err != nil {
|
||||
@ -281,7 +281,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
|
||||
return &csi.NodeUnpublishVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeUnstageVolume unstages the volume from the staging path
|
||||
// NodeUnstageVolume unstages the volume from the staging path.
|
||||
func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
|
||||
var err error
|
||||
if err = util.ValidateNodeUnstageVolumeRequest(req); err != nil {
|
||||
@ -306,7 +306,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
|
||||
return &csi.NodeUnstageVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeGetCapabilities returns the supported capabilities of the node server
|
||||
// NodeGetCapabilities returns the supported capabilities of the node server.
|
||||
func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||
return &csi.NodeGetCapabilitiesResponse{
|
||||
Capabilities: []*csi.NodeServiceCapability{
|
||||
|
@ -76,7 +76,7 @@ func execCommandJSON(ctx context.Context, v interface{}, program string, args ..
|
||||
return nil
|
||||
}
|
||||
|
||||
// Controller service request validation
|
||||
// Controller service request validation.
|
||||
func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error {
|
||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||
return fmt.Errorf("invalid CreateVolumeRequest: %v", err)
|
||||
@ -108,7 +108,7 @@ func (cs *ControllerServer) validateDeleteVolumeRequest() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Controller expand volume request validation
|
||||
// Controller expand volume request validation.
|
||||
func (cs *ControllerServer) validateExpandVolumeRequest(req *csi.ControllerExpandVolumeRequest) error {
|
||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_EXPAND_VOLUME); err != nil {
|
||||
return fmt.Errorf("invalid ExpandVolumeRequest: %v", err)
|
||||
|
@ -67,7 +67,7 @@ var (
|
||||
)
|
||||
|
||||
// Load available ceph mounters installed on system into availableMounters
|
||||
// Called from driver.go's Run()
|
||||
// Called from driver.go's Run().
|
||||
func loadAvailableMounters(conf *util.Config) error {
|
||||
// #nosec
|
||||
fuseMounterProbe := exec.Command("ceph-fuse", "--version")
|
||||
|
@ -142,7 +142,7 @@ func getClusterInformation(options map[string]string) (*util.ClusterInfo, error)
|
||||
}
|
||||
|
||||
// newVolumeOptions generates a new instance of volumeOptions from the provided
|
||||
// CSI request parameters
|
||||
// CSI request parameters.
|
||||
func newVolumeOptions(ctx context.Context, requestName string, req *csi.CreateVolumeRequest,
|
||||
secret map[string]string) (*volumeOptions, error) {
|
||||
var (
|
||||
@ -218,7 +218,7 @@ func newVolumeOptions(ctx context.Context, requestName string, req *csi.CreateVo
|
||||
}
|
||||
|
||||
// newVolumeOptionsFromVolID generates a new instance of volumeOptions and volumeIdentifier
|
||||
// from the provided CSI VolumeID
|
||||
// from the provided CSI VolumeID.
|
||||
func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secrets map[string]string) (*volumeOptions, *volumeIdentifier, error) {
|
||||
var (
|
||||
vi util.CSIIdentifier
|
||||
@ -308,7 +308,7 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret
|
||||
}
|
||||
|
||||
// newVolumeOptionsFromMonitorList generates a new instance of volumeOptions and
|
||||
// volumeIdentifier from the provided CSI volume context
|
||||
// volumeIdentifier from the provided CSI volume context.
|
||||
func newVolumeOptionsFromMonitorList(volID string, options, secrets map[string]string) (*volumeOptions, *volumeIdentifier, error) {
|
||||
var (
|
||||
opts volumeOptions
|
||||
@ -361,7 +361,7 @@ func newVolumeOptionsFromMonitorList(volID string, options, secrets map[string]s
|
||||
|
||||
// newVolumeOptionsFromStaticVolume generates a new instance of volumeOptions and
|
||||
// volumeIdentifier from the provided CSI volume context, if the provided context is
|
||||
// detected to be a statically provisioned volume
|
||||
// detected to be a statically provisioned volume.
|
||||
func newVolumeOptionsFromStaticVolume(volID string, options map[string]string) (*volumeOptions, *volumeIdentifier, error) {
|
||||
var (
|
||||
opts volumeOptions
|
||||
|
Reference in New Issue
Block a user