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:
@ -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"`
|
||||
|
Reference in New Issue
Block a user