rbd: use force from PromoteVolume Request

instead of fetching the force option from the
parameters. Use the Force field available in
the PromoteVolume Request.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-04-06 10:53:38 +05:30 committed by mergify[bot]
parent 385a751b8e
commit 403532c9a6

View File

@ -283,11 +283,6 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
} }
return nil, err return nil, err
} }
// extract the force option
force, err := getForceOption(ctx, req.GetParameters())
if err != nil {
return nil, err
}
mirroringInfo, err := rbdVol.getImageMirroringInfo() mirroringInfo, err := rbdVol.getImageMirroringInfo()
if err != nil { if err != nil {
@ -301,7 +296,7 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
// promote secondary to primary // promote secondary to primary
if !mirroringInfo.Primary { if !mirroringInfo.Primary {
err = rbdVol.promoteImage(force) err = rbdVol.promoteImage(req.Force)
if err != nil { if err != nil {
util.ErrorLog(ctx, err.Error()) util.ErrorLog(ctx, err.Error())
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())