rbd: split mirror functions off into rbdMrror type

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2025-04-15 14:15:53 +02:00
committed by mergify[bot]
parent af4431f60b
commit b0994a5356
3 changed files with 63 additions and 43 deletions

View File

@ -1024,7 +1024,14 @@ func (cs *ControllerServer) DeleteVolume(
func cleanupRBDImage(ctx context.Context,
rbdVol *rbdVolume, cr *util.Credentials,
) (*csi.DeleteVolumeResponse, error) {
info, err := rbdVol.GetMirroringInfo(ctx)
rm, err := rbdVol.ToMirror()
if err != nil {
log.ErrorLog(ctx, err.Error())
return nil, status.Error(codes.Internal, err.Error())
}
info, err := rm.GetMirroringInfo(ctx)
if err != nil {
log.ErrorLog(ctx, err.Error())
@ -1043,7 +1050,7 @@ func cleanupRBDImage(ctx context.Context,
// the image on all the remote (secondary) clusters will get
// auto-deleted. This helps in garbage collecting the OMAP, PVC and PV
// objects after failback operation.
sts, rErr := rbdVol.GetGlobalMirroringStatus(ctx)
sts, rErr := rm.GetGlobalMirroringStatus(ctx)
if rErr != nil {
return nil, status.Error(codes.Internal, rErr.Error())
}