mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
rbd: return FailedPrecondition error message
In case of the DR the image on the primary site cannot be demoted as the cluster is down, during failover the image need to be force promoted. RBD returns `Device or resource busy` error message if the image cannot be promoted for above reason. Return FailedPrecondition so that replication operator can send request to force promote the image. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
403532c9a6
commit
d7838defcf
@ -299,6 +299,15 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
|
|||||||
err = rbdVol.promoteImage(req.Force)
|
err = rbdVol.promoteImage(req.Force)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.ErrorLog(ctx, err.Error())
|
util.ErrorLog(ctx, err.Error())
|
||||||
|
// In case of the DR the image on the primary site cannot be
|
||||||
|
// demoted as the cluster is down, during failover the image need
|
||||||
|
// to be force promoted. RBD returns `Device or resource busy`
|
||||||
|
// error message if the image cannot be promoted for above reason.
|
||||||
|
// Return FailedPrecondition so that replication operator can send
|
||||||
|
// request to force promote the image.
|
||||||
|
if strings.Contains(err.Error(), "Device or resource busy") {
|
||||||
|
return nil, status.Error(codes.FailedPrecondition, err.Error())
|
||||||
|
}
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user