mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +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:
@ -26,38 +26,38 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// DefaultControllerServer points to default driver
|
||||
// DefaultControllerServer points to default driver.
|
||||
type DefaultControllerServer struct {
|
||||
Driver *CSIDriver
|
||||
}
|
||||
|
||||
// ControllerPublishVolume publish volume on node
|
||||
// ControllerPublishVolume publish volume on node.
|
||||
func (cs *DefaultControllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// ControllerUnpublishVolume unpublish on node
|
||||
// ControllerUnpublishVolume unpublish on node.
|
||||
func (cs *DefaultControllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// ControllerExpandVolume expand volume
|
||||
// ControllerExpandVolume expand volume.
|
||||
func (cs *DefaultControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// ListVolumes lists volumes
|
||||
// ListVolumes lists volumes.
|
||||
func (cs *DefaultControllerServer) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// GetCapacity get volume capacity
|
||||
// GetCapacity get volume capacity.
|
||||
func (cs *DefaultControllerServer) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// ControllerGetCapabilities implements the default GRPC callout.
|
||||
// Default supports all capabilities
|
||||
// Default supports all capabilities.
|
||||
func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
||||
util.TraceLog(ctx, "Using default ControllerGetCapabilities")
|
||||
|
||||
@ -66,17 +66,17 @@ func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateSnapshot creates snapshot
|
||||
// CreateSnapshot creates snapshot.
|
||||
func (cs *DefaultControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// DeleteSnapshot deletes snapshot
|
||||
// DeleteSnapshot deletes snapshot.
|
||||
func (cs *DefaultControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// ListSnapshots lists snapshots
|
||||
// ListSnapshots lists snapshots.
|
||||
func (cs *DefaultControllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
)
|
||||
|
||||
// CSIDriver stores driver information
|
||||
// CSIDriver stores driver information.
|
||||
type CSIDriver struct {
|
||||
name string
|
||||
nodeID string
|
||||
@ -67,7 +67,7 @@ func NewCSIDriver(name, v, nodeID string) *CSIDriver {
|
||||
}
|
||||
|
||||
// ValidateControllerServiceRequest validates the controller
|
||||
// plugin capabilities
|
||||
// plugin capabilities.
|
||||
func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) error {
|
||||
if c == csi.ControllerServiceCapability_RPC_UNKNOWN {
|
||||
return nil
|
||||
@ -82,7 +82,7 @@ func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapa
|
||||
}
|
||||
|
||||
// AddControllerServiceCapabilities stores the controller capabilities
|
||||
// in driver object
|
||||
// in driver object.
|
||||
func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type) {
|
||||
var csc []*csi.ControllerServiceCapability
|
||||
|
||||
@ -94,7 +94,7 @@ func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceC
|
||||
d.cap = csc
|
||||
}
|
||||
|
||||
// AddVolumeCapabilityAccessModes stores volume access modes
|
||||
// AddVolumeCapabilityAccessModes stores volume access modes.
|
||||
func (d *CSIDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode {
|
||||
var vca []*csi.VolumeCapability_AccessMode
|
||||
for _, c := range vc {
|
||||
@ -105,7 +105,7 @@ func (d *CSIDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_Acc
|
||||
return vca
|
||||
}
|
||||
|
||||
// GetVolumeCapabilityAccessModes returns access modes
|
||||
// GetVolumeCapabilityAccessModes returns access modes.
|
||||
func (d *CSIDriver) GetVolumeCapabilityAccessModes() []*csi.VolumeCapability_AccessMode {
|
||||
return d.vc
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// DefaultIdentityServer stores driver object
|
||||
// DefaultIdentityServer stores driver object.
|
||||
type DefaultIdentityServer struct {
|
||||
Driver *CSIDriver
|
||||
}
|
||||
|
||||
// GetPluginInfo returns plugin information
|
||||
// GetPluginInfo returns plugin information.
|
||||
func (ids *DefaultIdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
|
||||
util.TraceLog(ctx, "Using default GetPluginInfo")
|
||||
|
||||
@ -49,12 +49,12 @@ func (ids *DefaultIdentityServer) GetPluginInfo(ctx context.Context, req *csi.Ge
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Probe returns empty response
|
||||
// Probe returns empty response.
|
||||
func (ids *DefaultIdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) {
|
||||
return &csi.ProbeResponse{}, nil
|
||||
}
|
||||
|
||||
// GetPluginCapabilities returns plugin capabilities
|
||||
// GetPluginCapabilities returns plugin capabilities.
|
||||
func (ids *DefaultIdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||
util.TraceLog(ctx, "Using default capabilities")
|
||||
return &csi.GetPluginCapabilitiesResponse{
|
||||
|
@ -31,28 +31,28 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
)
|
||||
|
||||
// DefaultNodeServer stores driver object
|
||||
// DefaultNodeServer stores driver object.
|
||||
type DefaultNodeServer struct {
|
||||
Driver *CSIDriver
|
||||
Type string
|
||||
}
|
||||
|
||||
// NodeStageVolume returns unimplemented response
|
||||
// NodeStageVolume returns unimplemented response.
|
||||
func (ns *DefaultNodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// NodeUnstageVolume returns unimplemented response
|
||||
// NodeUnstageVolume returns unimplemented response.
|
||||
func (ns *DefaultNodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// NodeExpandVolume returns unimplemented response
|
||||
// NodeExpandVolume returns unimplemented response.
|
||||
func (ns *DefaultNodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// NodeGetInfo returns node ID
|
||||
// NodeGetInfo returns node ID.
|
||||
func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
||||
util.TraceLog(ctx, "Using default NodeGetInfo")
|
||||
|
||||
@ -66,7 +66,7 @@ func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetIn
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NodeGetCapabilities returns RPC unknow capability
|
||||
// NodeGetCapabilities returns RPC unknow capability.
|
||||
func (ns *DefaultNodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||
util.TraceLog(ctx, "Using default NodeGetCapabilities")
|
||||
|
||||
@ -83,7 +83,7 @@ func (ns *DefaultNodeServer) NodeGetCapabilities(ctx context.Context, req *csi.N
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NodeGetVolumeStats returns volume stats
|
||||
// NodeGetVolumeStats returns volume stats.
|
||||
func (ns *DefaultNodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
|
||||
var err error
|
||||
targetPath := req.GetVolumePath()
|
||||
@ -175,7 +175,7 @@ func (ns *DefaultNodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.No
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ConstructMountOptions returns only unique mount options in slice
|
||||
// ConstructMountOptions returns only unique mount options in slice.
|
||||
func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability) []string {
|
||||
if m := volCap.GetMount(); m != nil {
|
||||
hasOption := func(options []string, opt string) bool {
|
||||
@ -195,7 +195,7 @@ func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability)
|
||||
return mountOptions
|
||||
}
|
||||
|
||||
// MountOptionContains checks the opt is present in mountOptions
|
||||
// MountOptionContains checks the opt is present in mountOptions.
|
||||
func MountOptionContains(mountOptions []string, opt string) bool {
|
||||
for _, mnt := range mountOptions {
|
||||
if mnt == opt {
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
)
|
||||
|
||||
// NonBlockingGRPCServer defines Non blocking GRPC server interfaces
|
||||
// NonBlockingGRPCServer defines Non blocking GRPC server interfaces.
|
||||
type NonBlockingGRPCServer interface {
|
||||
// Start services at the endpoint
|
||||
Start(endpoint, hstOptions string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, metrics bool)
|
||||
@ -45,24 +45,24 @@ type NonBlockingGRPCServer interface {
|
||||
ForceStop()
|
||||
}
|
||||
|
||||
// NewNonBlockingGRPCServer return non-blocking GRPC
|
||||
// NewNonBlockingGRPCServer return non-blocking GRPC.
|
||||
func NewNonBlockingGRPCServer() NonBlockingGRPCServer {
|
||||
return &nonBlockingGRPCServer{}
|
||||
}
|
||||
|
||||
// NonBlocking server
|
||||
// NonBlocking server.
|
||||
type nonBlockingGRPCServer struct {
|
||||
wg sync.WaitGroup
|
||||
server *grpc.Server
|
||||
}
|
||||
|
||||
// Start start service on endpoint
|
||||
// Start start service on endpoint.
|
||||
func (s *nonBlockingGRPCServer) Start(endpoint, hstOptions string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, metrics bool) {
|
||||
s.wg.Add(1)
|
||||
go s.serve(endpoint, hstOptions, ids, cs, ns, metrics)
|
||||
}
|
||||
|
||||
// Wait blocks until the WaitGroup counter
|
||||
// Wait blocks until the WaitGroup counter.
|
||||
func (s *nonBlockingGRPCServer) Wait() {
|
||||
s.wg.Wait()
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ func parseEndpoint(ep string) (string, string, error) {
|
||||
return "", "", fmt.Errorf("invalid endpoint: %v", ep)
|
||||
}
|
||||
|
||||
// NewVolumeCapabilityAccessMode returns volume access mode
|
||||
// NewVolumeCapabilityAccessMode returns volume access mode.
|
||||
func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode {
|
||||
return &csi.VolumeCapability_AccessMode{Mode: mode}
|
||||
}
|
||||
|
||||
// NewDefaultNodeServer initializes default node server
|
||||
// NewDefaultNodeServer initializes default node server.
|
||||
func NewDefaultNodeServer(d *CSIDriver, t string, topology map[string]string) *DefaultNodeServer {
|
||||
d.topology = topology
|
||||
return &DefaultNodeServer{
|
||||
@ -57,21 +57,21 @@ func NewDefaultNodeServer(d *CSIDriver, t string, topology map[string]string) *D
|
||||
}
|
||||
}
|
||||
|
||||
// NewDefaultIdentityServer initializes default identity servier
|
||||
// NewDefaultIdentityServer initializes default identity servier.
|
||||
func NewDefaultIdentityServer(d *CSIDriver) *DefaultIdentityServer {
|
||||
return &DefaultIdentityServer{
|
||||
Driver: d,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDefaultControllerServer initializes default controller server
|
||||
// NewDefaultControllerServer initializes default controller server.
|
||||
func NewDefaultControllerServer(d *CSIDriver) *DefaultControllerServer {
|
||||
return &DefaultControllerServer{
|
||||
Driver: d,
|
||||
}
|
||||
}
|
||||
|
||||
// NewControllerServiceCapability returns controller capabilities
|
||||
// NewControllerServiceCapability returns controller capabilities.
|
||||
func NewControllerServiceCapability(ctrlCap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
|
||||
return &csi.ControllerServiceCapability{
|
||||
Type: &csi.ControllerServiceCapability_Rpc{
|
||||
@ -82,7 +82,7 @@ func NewControllerServiceCapability(ctrlCap csi.ControllerServiceCapability_RPC_
|
||||
}
|
||||
}
|
||||
|
||||
// RunNodePublishServer starts node server
|
||||
// RunNodePublishServer starts node server.
|
||||
func RunNodePublishServer(endpoint, hstOption string, d *CSIDriver, ns csi.NodeServer, m bool) {
|
||||
ids := NewDefaultIdentityServer(d)
|
||||
|
||||
@ -91,7 +91,7 @@ func RunNodePublishServer(endpoint, hstOption string, d *CSIDriver, ns csi.NodeS
|
||||
s.Wait()
|
||||
}
|
||||
|
||||
// RunControllerPublishServer starts controller server
|
||||
// RunControllerPublishServer starts controller server.
|
||||
func RunControllerPublishServer(endpoint, hstOption string, d *CSIDriver, cs csi.ControllerServer, m bool) {
|
||||
ids := NewDefaultIdentityServer(d)
|
||||
|
||||
@ -100,7 +100,7 @@ func RunControllerPublishServer(endpoint, hstOption string, d *CSIDriver, cs csi
|
||||
s.Wait()
|
||||
}
|
||||
|
||||
// RunControllerandNodePublishServer starts both controller and node server
|
||||
// RunControllerandNodePublishServer starts both controller and node server.
|
||||
func RunControllerandNodePublishServer(endpoint, hstOption string, d *CSIDriver, cs csi.ControllerServer, ns csi.NodeServer, m bool) {
|
||||
ids := NewDefaultIdentityServer(d)
|
||||
|
||||
|
Reference in New Issue
Block a user