mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: parse IP address
The address we get from ceph contains the ip in the format of 10.244.0.1:0/2686266785 we need to extract the client IP from this address, we already have a helper to extract it, This makes the helper more generic can be reused by multiple packages in the fence controller. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
facf805941
commit
b4592a55eb
@ -155,13 +155,23 @@ func (fcs *FenceControllerServer) GetFenceClients(
|
||||
return nil, status.Errorf(codes.Internal, "failed to get client address: %s", err)
|
||||
}
|
||||
|
||||
// The example address we get is 10.244.0.1:0/2686266785 from
|
||||
// which we need to extract the IP address.
|
||||
addr, err := nf.ParseClientIP(address)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to parse client address: %s", err)
|
||||
}
|
||||
|
||||
// adding /32 to the IP address to make it a CIDR block.
|
||||
addr += "/32"
|
||||
|
||||
resp := &fence.GetFenceClientsResponse{
|
||||
Clients: []*fence.ClientDetails{
|
||||
{
|
||||
Id: fsID,
|
||||
Addresses: []*fence.CIDR{
|
||||
{
|
||||
Cidr: address,
|
||||
Cidr: addr,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user