mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
rbd: rename deleteImage()
to Delete()
Renaming the `Delete()` function makes it easier to implement the upcoming `Volume` interface. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
6b5ef1d76a
commit
8d5e1aad4e
@ -141,7 +141,7 @@ func (rv *rbdVolume) createCloneFromImage(ctx context.Context, parentVol *rbdVol
|
||||
defer func() {
|
||||
if err != nil {
|
||||
log.DebugLog(ctx, "Removing clone image %q", rv)
|
||||
errDefer := rv.deleteImage(ctx)
|
||||
errDefer := rv.Delete(ctx)
|
||||
if errDefer != nil {
|
||||
log.ErrorLog(ctx, "failed to delete clone image %q: %v", rv, errDefer)
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ func (cs *ControllerServer) CreateVolume(
|
||||
metadata := k8s.GetVolumeMetadata(req.GetParameters())
|
||||
err = rbdVol.setAllMetadata(metadata)
|
||||
if err != nil {
|
||||
if deleteErr := rbdVol.deleteImage(ctx); deleteErr != nil {
|
||||
if deleteErr := rbdVol.Delete(ctx); deleteErr != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v", rbdVol, deleteErr)
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ func checkFlatten(ctx context.Context, rbdVol *rbdVolume, cr *util.Credentials)
|
||||
if errors.Is(err, ErrFlattenInProgress) {
|
||||
return status.Error(codes.Aborted, err.Error())
|
||||
}
|
||||
if errDefer := rbdVol.deleteImage(ctx); errDefer != nil {
|
||||
if errDefer := rbdVol.Delete(ctx); errDefer != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v", rbdVol, errDefer)
|
||||
|
||||
return status.Error(codes.Internal, err.Error())
|
||||
@ -681,7 +681,7 @@ func (cs *ControllerServer) createVolumeFromSnapshot(
|
||||
defer func() {
|
||||
if err != nil {
|
||||
log.DebugLog(ctx, "Removing clone image %q", rbdVol)
|
||||
errDefer := rbdVol.deleteImage(ctx)
|
||||
errDefer := rbdVol.Delete(ctx)
|
||||
if errDefer != nil {
|
||||
log.ErrorLog(ctx, "failed to delete clone image %q: %v", rbdVol, errDefer)
|
||||
}
|
||||
@ -764,7 +764,7 @@ func (cs *ControllerServer) createBackingImage(
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if deleteErr := rbdVol.deleteImage(ctx); deleteErr != nil {
|
||||
if deleteErr := rbdVol.Delete(ctx); deleteErr != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v", rbdVol, deleteErr)
|
||||
}
|
||||
}
|
||||
@ -1029,7 +1029,7 @@ func cleanupRBDImage(ctx context.Context,
|
||||
|
||||
// Deleting rbd image
|
||||
log.DebugLog(ctx, "deleting image %s", rbdVol.RbdImageName)
|
||||
if err = rbdVol.deleteImage(ctx); err != nil {
|
||||
if err = rbdVol.Delete(ctx); err != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v",
|
||||
rbdVol, err)
|
||||
|
||||
@ -1188,7 +1188,7 @@ func (cs *ControllerServer) CreateSnapshot(
|
||||
defer func() {
|
||||
if err != nil {
|
||||
log.DebugLog(ctx, "Removing clone image %q", rbdVol)
|
||||
errDefer := rbdVol.deleteImage(ctx)
|
||||
errDefer := rbdVol.Delete(ctx)
|
||||
if errDefer != nil {
|
||||
log.ErrorLog(ctx, "failed to delete clone image %q: %v", rbdVol, errDefer)
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func deleteMigratedVolume(ctx context.Context, parsedMigHandle *migrationVolID,
|
||||
return err
|
||||
}
|
||||
defer rv.Destroy(ctx)
|
||||
err = rv.deleteImage(ctx)
|
||||
err = rv.Delete(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s, err: %v", rv, err)
|
||||
}
|
||||
|
@ -627,8 +627,8 @@ func (ri *rbdImage) ensureImageCleanup(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// deleteImage deletes a ceph image with provision and volume options.
|
||||
func (ri *rbdImage) deleteImage(ctx context.Context) error {
|
||||
// Delete deletes a ceph image with provision and volume options.
|
||||
func (ri *rbdImage) Delete(ctx context.Context) error {
|
||||
image := ri.RbdImageName
|
||||
|
||||
log.DebugLog(ctx, "rbd: delete %s using mon %s, pool %s", image, ri.Monitors, ri.Pool)
|
||||
@ -706,7 +706,7 @@ func (ri *rbdImage) trashRemoveImage(ctx context.Context) error {
|
||||
// DeleteTempImage deletes the temporary image created for volume datasource.
|
||||
func (rv *rbdVolume) DeleteTempImage(ctx context.Context) error {
|
||||
tempClone := rv.generateTempClone()
|
||||
err := tempClone.deleteImage(ctx)
|
||||
err := tempClone.Delete(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrImageNotFound) {
|
||||
return tempClone.ensureImageCleanup(ctx)
|
||||
|
@ -56,7 +56,7 @@ func createRBDClone(
|
||||
errSnap := parentVol.deleteSnapshot(ctx, snap)
|
||||
if errSnap != nil {
|
||||
log.ErrorLog(ctx, "failed to delete snapshot: %v", errSnap)
|
||||
delErr := cloneRbdVol.deleteImage(ctx)
|
||||
delErr := cloneRbdVol.Delete(ctx)
|
||||
if delErr != nil {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v", cloneRbdVol, delErr)
|
||||
}
|
||||
@ -85,7 +85,7 @@ func cleanUpSnapshot(
|
||||
}
|
||||
|
||||
if rbdVol != nil {
|
||||
err := rbdVol.deleteImage(ctx)
|
||||
err := rbdVol.Delete(ctx)
|
||||
if err != nil {
|
||||
if !errors.Is(err, ErrImageNotFound) {
|
||||
log.ErrorLog(ctx, "failed to delete rbd image %q with error: %v", rbdVol, err)
|
||||
|
Loading…
Reference in New Issue
Block a user