cleanup: address godot warnings

Top level comments should end in a period

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug
2020-07-19 17:51:03 +05:30
committed by mergify[bot]
parent cb7ab307dd
commit 7f94a57908
48 changed files with 233 additions and 233 deletions

View File

@ -202,7 +202,7 @@ func validateRequestedVolumeSize(rbdVol, parentVol *rbdVolume, rbdSnap *rbdSnaps
return nil
}
// CreateVolume creates the volume in backend
// CreateVolume creates the volume in backend.
func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
if err := cs.validateVolumeReq(ctx, req); err != nil {
return nil, err
@ -357,7 +357,7 @@ func flattenTemporaryClonedImages(ctx context.Context, rbdVol *rbdVolume, cr *ut
// checkFlatten ensures that that the image chain depth is not reached
// hardlimit or softlimit. if the softlimit is reached it adds a task and
// return success,the hardlimit is reached it starts a task to flatten the
// image and return Aborted
// image and return Aborted.
func checkFlatten(ctx context.Context, rbdVol *rbdVolume, cr *util.Credentials) error {
err := rbdVol.flattenRbdImage(ctx, cr, false, rbdHardMaxCloneDepth, rbdSoftMaxCloneDepth)
if err != nil {
@ -931,7 +931,7 @@ func (cs *ControllerServer) doSnapshotClone(ctx context.Context, parentVol *rbdV
}
// DeleteSnapshot deletes the snapshot in backend and removes the
// snapshot metadata from store
// snapshot metadata from store.
func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT); err != nil {
klog.Errorf(util.Log(ctx, "invalid delete snapshot req: %v"), protosanitizer.StripSecrets(req))
@ -1022,7 +1022,7 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
return &csi.DeleteSnapshotResponse{}, nil
}
// ControllerExpandVolume expand RBD Volumes on demand based on resizer request
// ControllerExpandVolume expand RBD Volumes on demand based on resizer request.
func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_EXPAND_VOLUME); err != nil {
klog.Errorf(util.Log(ctx, "invalid expand volume req: %v"), protosanitizer.StripSecrets(req))

View File

@ -34,7 +34,7 @@ const (
csiConfigFile = "/etc/ceph-csi-config/config.json"
)
// Driver contains the default identity,node and controller struct
// Driver contains the default identity,node and controller struct.
type Driver struct {
cd *csicommon.CSIDriver
@ -62,19 +62,19 @@ var (
skipForceFlatten bool
)
// NewDriver returns new rbd driver
// NewDriver returns new rbd driver.
func NewDriver() *Driver {
return &Driver{}
}
// NewIdentityServer initialize a identity server for rbd CSI driver
// NewIdentityServer initialize a identity server for rbd CSI driver.
func NewIdentityServer(d *csicommon.CSIDriver) *IdentityServer {
return &IdentityServer{
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
}
}
// NewControllerServer initialize a controller server for rbd CSI driver
// NewControllerServer initialize a controller server for rbd CSI driver.
func NewControllerServer(d *csicommon.CSIDriver) *ControllerServer {
return &ControllerServer{
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
@ -94,7 +94,7 @@ func NewNodeServer(d *csicommon.CSIDriver, t string, topology map[string]string)
}
// Run start a non-blocking grpc controller,node and identityserver for
// rbd CSI driver which can serve multiple parallel requests
// rbd CSI driver which can serve multiple parallel requests.
func (r *Driver) Run(conf *util.Config) {
var err error
var topology map[string]string

View File

@ -16,7 +16,7 @@ limitations under the License.
package rbd
// ErrImageNotFound is returned when image name is not found in the cluster on the given pool
// ErrImageNotFound is returned when image name is not found in the cluster on the given pool.
type ErrImageNotFound struct {
imageName string
err error
@ -33,7 +33,7 @@ func (e ErrImageNotFound) Unwrap() error {
}
// ErrSnapNotFound is returned when snap name passed is not found in the list of snapshots for the
// given image
// given image.
type ErrSnapNotFound struct {
snapName string
err error
@ -50,7 +50,7 @@ func (e ErrSnapNotFound) Unwrap() error {
}
// ErrVolNameConflict is generated when a requested CSI volume name already exists on RBD but with
// different properties, and hence is in conflict with the passed in CSI volume name
// different properties, and hence is in conflict with the passed in CSI volume name.
type ErrVolNameConflict struct {
requestName string
err error
@ -67,7 +67,7 @@ func (e ErrVolNameConflict) Unwrap() error {
}
// ErrInvalidVolID is returned when a CSI passed VolumeID does not conform to any known volume ID
// formats
// formats.
type ErrInvalidVolID struct {
err error
}
@ -82,7 +82,7 @@ func (e ErrInvalidVolID) Unwrap() error {
return e.err
}
// ErrMissingStash is returned when the image metadata stash file is not found
// ErrMissingStash is returned when the image metadata stash file is not found.
type ErrMissingStash struct {
err error
}
@ -97,7 +97,7 @@ func (e ErrMissingStash) Unwrap() error {
return e.err
}
// ErrFlattenInProgress is returned when flatten is inprogess for an image
// ErrFlattenInProgress is returned when flatten is inprogess for an image.
type ErrFlattenInProgress struct {
err error
}

View File

@ -30,7 +30,7 @@ type IdentityServer struct {
*csicommon.DefaultIdentityServer
}
// GetPluginCapabilities returns available capabilities of the rbd driver
// GetPluginCapabilities returns available capabilities of the rbd driver.
func (is *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{

View File

@ -38,7 +38,7 @@ import (
)
// NodeServer struct of ceph rbd driver with supported methods of CSI
// node server spec
// node server spec.
type NodeServer struct {
*csicommon.DefaultNodeServer
mounter mount.Interface
@ -49,7 +49,7 @@ type NodeServer struct {
// stageTransaction struct represents the state a transaction was when it either completed
// or failed
// this transaction state can be used to rollback the transaction
// this transaction state can be used to rollback the transaction.
type stageTransaction struct {
// isStagePathCreated represents whether the mount path to stage the volume on was created or not
isStagePathCreated bool
@ -375,7 +375,7 @@ func (ns *NodeServer) createStageMountPoint(ctx context.Context, mountPath strin
}
// NodePublishVolume mounts the volume mounted to the device path to the target
// path
// path.
func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
err := util.ValidateNodePublishVolumeRequest(req)
if err != nil {
@ -539,7 +539,7 @@ func (ns *NodeServer) createTargetMountPath(ctx context.Context, mountPath strin
return notMnt, err
}
// 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) {
err := util.ValidateNodeUnpublishVolumeRequest(req)
if err != nil {
@ -585,7 +585,7 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
}
// getStagingTargetPath concats either NodeStageVolumeRequest's or
// NodeUnstageVolumeRequest's target path with the volumeID
// NodeUnstageVolumeRequest's target path with the volumeID.
func getStagingTargetPath(req interface{}) string {
switch vr := req.(type) {
case *csi.NodeStageVolumeRequest:
@ -597,7 +597,7 @@ func getStagingTargetPath(req interface{}) string {
return ""
}
// 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 {
@ -680,7 +680,7 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
return &csi.NodeUnstageVolumeResponse{}, nil
}
// NodeExpandVolume resizes rbd volumes
// NodeExpandVolume resizes rbd volumes.
func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
volumeID := req.GetVolumeId()
if volumeID == "" {
@ -740,7 +740,7 @@ func getDevicePath(ctx context.Context, volumePath string) (string, error) {
return "", fmt.Errorf("failed to get device for stagingtarget path %v", volumePath)
}
// 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{

View File

@ -56,7 +56,7 @@ func init() {
hasNBD = checkRbdNbdTools()
}
// rbdDeviceInfo strongly typed JSON spec for rbd device list output (of type krbd)
// rbdDeviceInfo strongly typed JSON spec for rbd device list output (of type krbd).
type rbdDeviceInfo struct {
ID string `json:"id"`
Pool string `json:"pool"`
@ -67,7 +67,7 @@ type rbdDeviceInfo struct {
// nbdDeviceInfo strongly typed JSON spec for rbd-nbd device list output (of type nbd)
// NOTE: There is a bug in rbd output that returns id as number for nbd, and string for krbd, thus
// requiring 2 different JSON structures to unmarshal the output.
// NOTE: image key is "name" in krbd output and "image" in nbd output, which is another difference
// NOTE: image key is "name" in krbd output and "image" in nbd output, which is another difference.
type nbdDeviceInfo struct {
ID int64 `json:"id"`
Pool string `json:"pool"`
@ -76,7 +76,7 @@ type nbdDeviceInfo struct {
}
// rbdGetDeviceList queries rbd about mapped devices and returns a list of rbdDeviceInfo
// It will selectively list devices mapped using krbd or nbd as specified by accessType
// It will selectively list devices mapped using krbd or nbd as specified by accessType.
func rbdGetDeviceList(accessType string) ([]rbdDeviceInfo, error) {
// rbd device list --format json --device-type [krbd|nbd]
var (
@ -278,7 +278,7 @@ func detachRBDDevice(ctx context.Context, devicePath, volumeID string, encrypted
}
// detachRBDImageOrDeviceSpec detaches an rbd imageSpec or devicePath, with additional checking
// when imageSpec is used to decide if image is already unmapped
// when imageSpec is used to decide if image is already unmapped.
func detachRBDImageOrDeviceSpec(ctx context.Context, imageOrDeviceSpec string, isImageSpec, ndbType, encrypted bool, volumeID string) error {
var output []byte

View File

@ -339,7 +339,7 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
}
// reserveSnap is a helper routine to request a rbdSnapshot name reservation and generate the
// volume ID for the generated name
// volume ID for the generated name.
func reserveSnap(ctx context.Context, rbdSnap *rbdSnapshot, rbdVol *rbdVolume, cr *util.Credentials) error {
var (
err error
@ -407,7 +407,7 @@ func updateTopologyConstraints(rbdVol *rbdVolume, rbdSnap *rbdSnapshot) error {
}
// reserveVol is a helper routine to request a rbdVolume name reservation and generate the
// volume ID for the generated name
// volume ID for the generated name.
func reserveVol(ctx context.Context, rbdVol *rbdVolume, rbdSnap *rbdSnapshot, cr *util.Credentials) error {
var (
err error
@ -453,7 +453,7 @@ func reserveVol(ctx context.Context, rbdVol *rbdVolume, rbdSnap *rbdSnapshot, cr
return nil
}
// undoSnapReservation is a helper routine to undo a name reservation for rbdSnapshot
// undoSnapReservation is a helper routine to undo a name reservation for rbdSnapshot.
func undoSnapReservation(ctx context.Context, rbdSnap *rbdSnapshot, cr *util.Credentials) error {
j, err := snapJournal.Connect(rbdSnap.Monitors, cr)
if err != nil {
@ -468,7 +468,7 @@ func undoSnapReservation(ctx context.Context, rbdSnap *rbdSnapshot, cr *util.Cre
return err
}
// undoVolReservation is a helper routine to undo a name reservation for rbdVolume
// undoVolReservation is a helper routine to undo a name reservation for rbdVolume.
func undoVolReservation(ctx context.Context, rbdVol *rbdVolume, cr *util.Credentials) error {
j, err := volJournal.Connect(rbdVol.Monitors, cr)
if err != nil {

View File

@ -67,7 +67,7 @@ const (
imageOptionCloneFormat = librbd.RbdImageOption(12)
)
// rbdVolume represents a CSI volume and its RBD image specifics
// rbdVolume represents a CSI volume and its RBD image specifics.
type rbdVolume struct {
// RbdImageName is the name of the RBD image backing this rbdVolume. This does not have a
// JSON tag as it is not stashed in JSON encoded config maps in v1.0.0
@ -114,7 +114,7 @@ type rbdVolume struct {
ioctx *rados.IOContext
}
// rbdSnapshot represents a CSI snapshot and its RBD snapshot specifics
// rbdSnapshot represents a CSI snapshot and its RBD snapshot specifics.
type rbdSnapshot struct {
// SourceVolumeID is the volume ID of RbdImageName, that is exchanged with CSI drivers
// RbdImageName is the name of the RBD image, that is this rbdSnapshot's source image
@ -144,7 +144,7 @@ var (
supportedFeatures = sets.NewString(librbd.FeatureNameLayering)
)
// Connect an rbdVolume to the Ceph cluster
// Connect an rbdVolume to the Ceph cluster.
func (rv *rbdVolume) Connect(cr *util.Credentials) error {
if rv.conn != nil {
return nil
@ -170,12 +170,12 @@ func (rv *rbdVolume) Destroy() {
}
}
// String returns the image-spec (pool/image) format of the image
// String returns the image-spec (pool/image) format of the image.
func (rv *rbdVolume) String() string {
return fmt.Sprintf("%s/%s", rv.Pool, rv.RbdImageName)
}
// String returns the snap-spec (pool/image@snap) format of the snapshot
// String returns the snap-spec (pool/image@snap) format of the snapshot.
func (rs *rbdSnapshot) String() string {
return fmt.Sprintf("%s/%s@%s", rs.Pool, rs.RbdImageName, rs.RbdSnapName)
}
@ -239,7 +239,7 @@ func (rv *rbdVolume) openIoctx() error {
}
// getImageID queries rbd about the given image and stores its id, returns
// ErrImageNotFound if provided image is not found
// ErrImageNotFound if provided image is not found.
func (rv *rbdVolume) getImageID() error {
if rv.ImageID != "" {
return nil
@ -313,7 +313,7 @@ func rbdStatus(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) (boo
// addRbdManagerTask adds a ceph manager task to execute command
// asynchronously. If command is not found returns a bool set to false
// example arg ["trash", "remove","pool/image"]
// example arg ["trash", "remove","pool/image"].
func addRbdManagerTask(ctx context.Context, pOpts *rbdVolume, arg []string) (bool, error) {
var output []byte
args := []string{"rbd", "task", "add"}
@ -530,7 +530,7 @@ func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint
}
// genSnapFromSnapID generates a rbdSnapshot structure from the provided identifier, updating
// the structure with elements from on-disk snapshot metadata as well
// the structure with elements from on-disk snapshot metadata as well.
func genSnapFromSnapID(ctx context.Context, rbdSnap *rbdSnapshot, snapshotID string, cr *util.Credentials) error {
var (
options map[string]string
@ -589,7 +589,7 @@ func genSnapFromSnapID(ctx context.Context, rbdSnap *rbdSnapshot, snapshotID str
}
// genVolFromVolID generates a rbdVolume structure from the provided identifier, updating
// the structure with elements from on-disk image metadata as well
// the structure with elements from on-disk image metadata as well.
func genVolFromVolID(ctx context.Context, volumeID string, cr *util.Credentials, secrets map[string]string) (*rbdVolume, error) {
var (
options map[string]string
@ -794,7 +794,7 @@ func genSnapFromOptions(ctx context.Context, rbdVol *rbdVolume, snapOptions map[
return rbdSnap
}
// hasSnapshotFeature checks if Layering is enabled for this image
// hasSnapshotFeature checks if Layering is enabled for this image.
func (rv *rbdVolume) hasSnapshotFeature() bool {
return (uint64(rv.imageFeatureSet) & librbd.FeatureLayering) == librbd.FeatureLayering
}
@ -874,7 +874,7 @@ func (rv *rbdVolume) cloneRbdImageFromSnapshot(ctx context.Context, pSnapOpts *r
return nil
}
// imageInfo strongly typed JSON spec for image info
// imageInfo strongly typed JSON spec for image info.
type imageInfo struct {
ObjectUUID string `json:"name"`
Size int64 `json:"size"`
@ -883,7 +883,7 @@ type imageInfo struct {
Parent parentInfo `json:"parent"`
}
// parentInfo spec for parent volume info
// parentInfo spec for parent volume info.
type parentInfo struct {
Image string `json:"image"`
Pool string `json:"pool"`
@ -891,7 +891,7 @@ type parentInfo struct {
}
// updateVolWithImageInfo updates provided rbdVolume with information from on-disk data
// regarding the same
// regarding the same.
func (rv *rbdVolume) updateVolWithImageInfo(cr *util.Credentials) error {
// rbd --format=json info [image-spec | snap-spec]
var imgInfo imageInfo
@ -931,7 +931,7 @@ func (rv *rbdVolume) updateVolWithImageInfo(cr *util.Credentials) error {
}
// getImageInfo queries rbd about the given image and returns its metadata, and returns
// ErrImageNotFound if provided image is not found
// ErrImageNotFound if provided image is not found.
func (rv *rbdVolume) getImageInfo() error {
image, err := rv.open()
if err != nil {
@ -962,7 +962,7 @@ func (rv *rbdVolume) getImageInfo() error {
/*
checkSnapExists queries rbd about the snapshots of the given image and returns
ErrImageNotFound if provided image is not found, and ErrSnapNotFound if
provided snap is not found in the images snapshot list
provided snap is not found in the images snapshot list.
*/
func (rv *rbdVolume) checkSnapExists(rbdSnap *rbdSnapshot) error {
image, err := rv.open()
@ -985,7 +985,7 @@ func (rv *rbdVolume) checkSnapExists(rbdSnap *rbdSnapshot) error {
return ErrSnapNotFound{rbdSnap.RbdSnapName, fmt.Errorf("snap %s not found", rbdSnap.String())}
}
// rbdImageMetadataStash strongly typed JSON spec for stashed RBD image metadata
// rbdImageMetadataStash strongly typed JSON spec for stashed RBD image metadata.
type rbdImageMetadataStash struct {
Version int `json:"Version"`
Pool string `json:"pool"`
@ -994,16 +994,16 @@ type rbdImageMetadataStash struct {
Encrypted bool `json:"encrypted"`
}
// file name in which image metadata is stashed
// file name in which image metadata is stashed.
const stashFileName = "image-meta.json"
// spec returns the image-spec (pool/image) format of the image
// spec returns the image-spec (pool/image) format of the image.
func (ri *rbdImageMetadataStash) String() string {
return fmt.Sprintf("%s/%s", ri.Pool, ri.ImageName)
}
// stashRBDImageMetadata stashes required fields into the stashFileName at the passed in path, in
// JSON format
// JSON format.
func stashRBDImageMetadata(volOptions *rbdVolume, path string) error {
var imgMeta = rbdImageMetadataStash{
Version: 2, // there are no checks for this at present
@ -1031,7 +1031,7 @@ func stashRBDImageMetadata(volOptions *rbdVolume, path string) error {
return nil
}
// lookupRBDImageMetadataStash reads and returns stashed image metadata at passed in path
// lookupRBDImageMetadataStash reads and returns stashed image metadata at passed in path.
func lookupRBDImageMetadataStash(path string) (rbdImageMetadataStash, error) {
var imgMeta rbdImageMetadataStash
@ -1053,7 +1053,7 @@ func lookupRBDImageMetadataStash(path string) (rbdImageMetadataStash, error) {
return imgMeta, nil
}
// cleanupRBDImageMetadataStash cleans up any stashed metadata at passed in path
// cleanupRBDImageMetadataStash cleans up any stashed metadata at passed in path.
func cleanupRBDImageMetadataStash(path string) error {
fPath := filepath.Join(path, stashFileName)
if err := os.Remove(fPath); err != nil {
@ -1063,7 +1063,7 @@ func cleanupRBDImageMetadataStash(path string) error {
return nil
}
// resizeRBDImage resizes the given volume to new size
// resizeRBDImage resizes the given volume to new size.
func resizeRBDImage(rbdVol *rbdVolume, cr *util.Credentials) error {
var output []byte
@ -1100,7 +1100,7 @@ func (rv *rbdVolume) SetMetadata(key, value string) error {
return image.SetMetadata(key, value)
}
// checkRbdImageEncrypted verifies if rbd image was encrypted when created
// checkRbdImageEncrypted verifies if rbd image was encrypted when created.
func (rv *rbdVolume) checkRbdImageEncrypted(ctx context.Context) (string, error) {
value, err := rv.GetMetadata(encryptionMetaKey)
if err != nil {
@ -1122,7 +1122,7 @@ func (rv *rbdVolume) ensureEncryptionMetadataSet(status string) error {
return nil
}
// SnapshotInfo holds snapshots details
// SnapshotInfo holds snapshots details.
type snapshotInfo struct {
ID int `json:"id"`
Name string `json:"name"`