mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: add context to mirror interface
adding required ctx to the mirror interface as ctx is required for the volumegroup operations. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
8788e5ec08
commit
37970ae212
@ -300,7 +300,7 @@ func (rs *ReplicationServer) EnableVolumeReplication(ctx context.Context,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -313,7 +313,7 @@ func (rs *ReplicationServer) EnableVolumeReplication(ctx context.Context,
|
||||
|
||||
return nil, getGRPCError(err)
|
||||
}
|
||||
err = mirror.EnableMirroring(mirroringMode)
|
||||
err = mirror.EnableMirroring(ctx, mirroringMode)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -365,7 +365,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -378,7 +378,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context,
|
||||
case librbd.MirrorImageDisabling.String():
|
||||
return nil, status.Errorf(codes.Aborted, "%s is in disabling state", volumeID)
|
||||
case librbd.MirrorImageEnabled.String():
|
||||
err = corerbd.DisableVolumeReplication(mirror, info.IsPrimary(), force)
|
||||
err = corerbd.DisableVolumeReplication(mirror, ctx, info.IsPrimary(), force)
|
||||
if err != nil {
|
||||
return nil, getGRPCError(err)
|
||||
}
|
||||
@ -427,7 +427,7 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -447,9 +447,9 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
|
||||
if req.GetForce() {
|
||||
// workaround for https://github.com/ceph/ceph-csi/issues/2736
|
||||
// TODO: remove this workaround when the issue is fixed
|
||||
err = mirror.ForcePromote(cr)
|
||||
err = mirror.ForcePromote(ctx, cr)
|
||||
} else {
|
||||
err = mirror.Promote(req.GetForce())
|
||||
err = mirror.Promote(ctx, req.GetForce())
|
||||
}
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
@ -527,7 +527,7 @@ func (rs *ReplicationServer) DemoteVolume(ctx context.Context,
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -556,7 +556,7 @@ func (rs *ReplicationServer) DemoteVolume(ctx context.Context,
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
err = mirror.Demote()
|
||||
err = mirror.Demote(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -630,7 +630,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
// in case of Resync the image will get deleted and gets recreated and
|
||||
// it takes time for this operation.
|
||||
@ -648,7 +648,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
|
||||
return nil, status.Error(codes.InvalidArgument, "image is in primary state")
|
||||
}
|
||||
|
||||
sts, err := mirror.GetGlobalMirroringStatus()
|
||||
sts, err := mirror.GetGlobalMirroringStatus(ctx)
|
||||
if err != nil {
|
||||
// the image gets recreated after issuing resync
|
||||
if errors.Is(err, corerbd.ErrImageNotFound) {
|
||||
@ -719,7 +719,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
|
||||
}
|
||||
log.DebugLog(ctx, "image %s, savedImageTime=%v, currentImageTime=%v", rbdVol, st, creationTime.AsTime())
|
||||
if req.GetForce() && st.Equal(creationTime.AsTime()) {
|
||||
err = mirror.Resync()
|
||||
err = mirror.Resync(ctx)
|
||||
if err != nil {
|
||||
return nil, getGRPCError(err)
|
||||
}
|
||||
@ -846,7 +846,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
info, err := mirror.GetMirroringInfo()
|
||||
info, err := mirror.GetMirroringInfo(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, err.Error())
|
||||
|
||||
@ -862,7 +862,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
|
||||
return nil, status.Error(codes.InvalidArgument, "image is not in primary state")
|
||||
}
|
||||
|
||||
mirrorStatus, err := mirror.GetGlobalMirroringStatus()
|
||||
mirrorStatus, err := mirror.GetGlobalMirroringStatus(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, corerbd.ErrImageNotFound) {
|
||||
return nil, status.Error(codes.Aborted, err.Error())
|
||||
|
Reference in New Issue
Block a user