mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
cephfs: implement the logic for unfencing procedure
this commit un-blocklists the clients provided in cidr for unfencing operation. Signed-off-by: Riya Singhal <rsinghal@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
1420ad193a
commit
14b06837d0
@ -89,3 +89,32 @@ func (fcs *FenceControllerServer) FenceClusterNetwork(
|
||||
|
||||
return &fence.FenceClusterNetworkResponse{}, nil
|
||||
}
|
||||
|
||||
// UnfenceClusterNetwork unblocks the access to a CIDR block by removing the network fence.
|
||||
func (fcs *FenceControllerServer) UnfenceClusterNetwork(
|
||||
ctx context.Context,
|
||||
req *fence.UnfenceClusterNetworkRequest,
|
||||
) (*fence.UnfenceClusterNetworkResponse, error) {
|
||||
err := validateNetworkFenceReq(req.GetCidrs(), req.Parameters)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
cr, err := util.NewUserCredentials(req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
defer cr.DeleteCredentials()
|
||||
|
||||
nwFence, err := nf.NewNetworkFence(ctx, cr, req.Cidrs, req.GetParameters())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
err = nwFence.RemoveNetworkFence(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to unfence CIDR block %q: %s", nwFence.Cidr, err.Error())
|
||||
}
|
||||
|
||||
return &fence.UnfenceClusterNetworkResponse{}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user