mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
internal: reformat long lines in internal/rbd package to 120 chars
We have many declarations and invocations..etc with long lines which are very difficult to follow while doing code reading. This address the issues in below files, and restrict the line length to 120 chars. -internal/rbd/rbd_attach.go -internal/rbd/rbd_journal.go -internal/rbd/rbd_util.go -internal/rbd/replicationcontrollerserver.go -internal/rbd/snapshot.go Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
e829308249
commit
8f82a30c21
@ -23,7 +23,11 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
)
|
||||
|
||||
func createRBDClone(ctx context.Context, parentVol, cloneRbdVol *rbdVolume, snap *rbdSnapshot, cr *util.Credentials) error {
|
||||
func createRBDClone(
|
||||
ctx context.Context,
|
||||
parentVol, cloneRbdVol *rbdVolume,
|
||||
snap *rbdSnapshot,
|
||||
cr *util.Credentials) error {
|
||||
// create snapshot
|
||||
err := parentVol.createSnapshot(ctx, snap)
|
||||
if err != nil {
|
||||
@ -35,8 +39,17 @@ func createRBDClone(ctx context.Context, parentVol, cloneRbdVol *rbdVolume, snap
|
||||
// create clone image and delete snapshot
|
||||
err = cloneRbdVol.cloneRbdImageFromSnapshot(ctx, snap, parentVol)
|
||||
if err != nil {
|
||||
util.ErrorLog(ctx, "failed to clone rbd image %s from snapshot %s: %v", cloneRbdVol.RbdImageName, snap.RbdSnapName, err)
|
||||
err = fmt.Errorf("failed to clone rbd image %s from snapshot %s: %w", cloneRbdVol.RbdImageName, snap.RbdSnapName, err)
|
||||
util.ErrorLog(
|
||||
ctx,
|
||||
"failed to clone rbd image %s from snapshot %s: %v",
|
||||
cloneRbdVol.RbdImageName,
|
||||
snap.RbdSnapName,
|
||||
err)
|
||||
err = fmt.Errorf(
|
||||
"failed to clone rbd image %s from snapshot %s: %w",
|
||||
cloneRbdVol.RbdImageName,
|
||||
snap.RbdSnapName,
|
||||
err)
|
||||
}
|
||||
errSnap := parentVol.deleteSnapshot(ctx, snap)
|
||||
if errSnap != nil {
|
||||
@ -63,14 +76,17 @@ func createRBDClone(ctx context.Context, parentVol, cloneRbdVol *rbdVolume, snap
|
||||
|
||||
// cleanUpSnapshot removes the RBD-snapshot (rbdSnap) from the RBD-image
|
||||
// (parentVol) and deletes the RBD-image rbdVol.
|
||||
func cleanUpSnapshot(ctx context.Context, parentVol *rbdVolume, rbdSnap *rbdSnapshot, rbdVol *rbdVolume, cr *util.Credentials) error {
|
||||
if parentVol != nil && rbdSnap != nil {
|
||||
err := parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
if !errors.Is(err, ErrSnapNotFound) {
|
||||
util.ErrorLog(ctx, "failed to delete snapshot %q: %v", rbdSnap, err)
|
||||
return err
|
||||
}
|
||||
func cleanUpSnapshot(
|
||||
ctx context.Context,
|
||||
parentVol *rbdVolume,
|
||||
rbdSnap *rbdSnapshot,
|
||||
rbdVol *rbdVolume,
|
||||
cr *util.Credentials) error {
|
||||
err := parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
if !errors.Is(err, ErrSnapNotFound) {
|
||||
util.ErrorLog(ctx, "failed to delete snapshot %q: %v", rbdSnap, err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +120,12 @@ func generateVolFromSnap(rbdSnap *rbdSnapshot) *rbdVolume {
|
||||
return vol
|
||||
}
|
||||
|
||||
func undoSnapshotCloning(ctx context.Context, parentVol *rbdVolume, rbdSnap *rbdSnapshot, cloneVol *rbdVolume, cr *util.Credentials) error {
|
||||
func undoSnapshotCloning(
|
||||
ctx context.Context,
|
||||
parentVol *rbdVolume,
|
||||
rbdSnap *rbdSnapshot,
|
||||
cloneVol *rbdVolume,
|
||||
cr *util.Credentials) error {
|
||||
err := cleanUpSnapshot(ctx, parentVol, rbdSnap, cloneVol, cr)
|
||||
if err != nil {
|
||||
util.ErrorLog(ctx, "failed to clean up %s or %s: %v", cloneVol, rbdSnap, err)
|
||||
|
Reference in New Issue
Block a user