Skip to content

rbd: implement GetReplicationDestinationInfo for volumes and groups - #6366

Open
rewantsoni wants to merge 7 commits into
ceph:develfrom
rewantsoni:implement-replication
Open

rbd: implement GetReplicationDestinationInfo for volumes and groups#6366
rewantsoni wants to merge 7 commits into
ceph:develfrom
rewantsoni:implement-replication

Conversation

@rewantsoni

@rewantsoni rewantsoni commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Describe what this PR does

Implement the change for the GetReplicationDestinationInfo RPC as per the design proposal in #6316

Is there anything that requires special attention

Provide any external context for the change, if any.

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@rewantsoni
rewantsoni force-pushed the implement-replication branch 5 times, most recently from cef70f8 to 6180c2c Compare July 1, 2026 08:02
@rewantsoni
rewantsoni marked this pull request as ready for review July 16, 2026 08:38
@rewantsoni

Copy link
Copy Markdown
Contributor Author

Testing:

configmap:
[
  {
    "clusterID": "9e95757b-963f-4011-a4dd-1848d1f799cb",
    "monitors": [
      "10.0.15.28:3300",
      "10.0.28.165:3300",
      "10.0.38.212:3300"
    ],
    "cephFS": {
      "subvolumeGroup": "client-1",
      "kernelMountOptions": "ms_mode=prefer-crc",
      "fuseMountOptions": "",
      "radosNamespace": "client-1",
      "controllerPublishSecretRef": {
        "name": "csi-cephfs-provisioner-9e95757b-963f-4011-a4dd-1848d1f799cb",
        "namespace": "openshift-storage"
      }
    },
    "rbd": {
      "radosNamespace": "client-1",
      "controllerPublishSecretRef": {
        "name": "csi-rbd-provisioner-9e95757b-963f-4011-a4dd-1848d1f799cb",
        "namespace": "openshift-storage"
      },
      "nodePublishSecretRef": {}
    },
    "nfs": {},
    "nvmeof": {
      "controllerPublishSecretRef": {}
    },
    "readAffinity": {
      "enabled": true,
      "crushLocationLabels": [
        "kubernetes.io/hostname",
        "topology.kubernetes.io/region",
        "topology.kubernetes.io/zone",
        "topology.rook.io/datacenter",
        "topology.rook.io/room",
        "topology.rook.io/pod",
        "topology.rook.io/pdu",
        "topology.rook.io/row",
        "topology.rook.io/rack",
        "topology.rook.io/chassis"
      ]
    },
    "replicationDestination": {
      "remoteClusterID": "1465416b-2258-4cc1-80ec-066a90272d5e",
      "rbd": {
        "remotePoolMapping": {
          "ocs-storagecluster-cephblockpool": {
            "poolID": "2"
          }
        }
      }
    }
  }
]

rewantsoni@Mac ~/work/scripts ❯ k get pv pvc-dfc0c3ff-65ff-4cc0-8c3e-d3211fe60f68 -oyaml | yq .spec.csi.volumeHandle
0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-7b993f10-5d0c-4b96-a377-d1b9b34af8a4

sh-5.1# /tmp/grpcurl -plaintext -unix -import-path /tmp/proto -proto replication.proto -d '{"replication_source":{"volume":{"volume_id":"0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-
7b993f10-5d0c-4b96-a377-d1b9b34af8a4"}},"secrets":{"userID":"csi-rbd-provisioner-ceph-user-g1-9e95757b-963f-4011-a4dd-1848d1f799cb","userKey":"AQBA0lRqQ29cMhAAvZd0vqWUc3nmt08U5P0vHA=="}}' /csi/csi-addo
ns.sock replication.Controller/GetReplicationDestinationInfo
{
  "replicationDestination": {
    "volume": {
      "volumeId": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-7b993f10-5d0c-4b96-a377-d1b9b34af8a4"
    }
  }
}

For Group


sh-5.1# /tmp/grpcurl -plaintext -unix -import-path /tmp/proto -proto replication.proto -d '{"replication_source":{"volumegroup":{"volume_group_id":"0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-000000
0000000002-eb55e868-e30b-443f-b7a5-a91316233c80"}},"secrets":{"userID":"csi-rbd-provisioner-ceph-user-g1-9e95757b-963f-4011-a4dd-1848d1f799cb","userKey":"AQBA0lRqQ29cMhAAvZd0vqWUc3nmt08U5P0vHA=="}}' /c
si/csi-addons.sock replication.Controller/GetReplicationDestinationInfo
{
  "replicationDestination": {
    "volumegroup": {
      "volumeGroupId": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-eb55e868-e30b-443f-b7a5-a91316233c80",
      "volumeIds": {
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-090f42f3-9ed9-4ee5-b7b2-8a0d97849efa": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-090f42f3-9ed9-4ee5-b7b2-
8a0d97849efa",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-0d3cff5c-5b14-4635-b68a-935e92eacbee": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-0d3cff5c-5b14-4635-b68a-
935e92eacbee",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-273f45d6-d750-48a6-811c-f17d218859ab": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-273f45d6-d750-48a6-811c-
f17d218859ab",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-2d53cb41-399d-43b7-8974-e81b23b39111": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-2d53cb41-399d-43b7-8974-
e81b23b39111",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-41e7dc53-53e0-40cc-a3a7-38db04415e59": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-41e7dc53-53e0-40cc-a3a7-
38db04415e59",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-78428e9c-fbd8-484a-afc6-ca11ddef092c": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-78428e9c-fbd8-484a-afc6-
ca11ddef092c",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-7b993f10-5d0c-4b96-a377-d1b9b34af8a4": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-7b993f10-5d0c-4b96-a377-
d1b9b34af8a4",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-80fedfc6-b125-4617-b7ad-6eb2ce06b264": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-80fedfc6-b125-4617-b7ad-
6eb2ce06b264",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-abee2272-9870-4981-a82d-312ddcb47660": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-abee2272-9870-4981-a82d-
312ddcb47660",
        "0001-0024-9e95757b-963f-4011-a4dd-1848d1f799cb-0000000000000002-cc52668e-ed9a-4485-8483-525cc897403b": "0001-0024-1465416b-2258-4cc1-80ec-066a90272d5e-0000000000000002-cc52668e-ed9a-4485-8483-
525cc897403b"
      }
    }
  }
}

@Rakshith-R
Rakshith-R requested a review from a team July 17, 2026 05:33
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
req *replication.GetReplicationDestinationInfoRequest,
) (*replication.GetReplicationDestinationInfoResponse, error) {
// Validate request
if req.GetReplicationSource() == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not validate for empty secrets too?

Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go
Comment thread internal/csi-addons/rbd/replication.go Outdated
@rewantsoni
rewantsoni force-pushed the implement-replication branch 4 times, most recently from 4451914 to 2ffd5f3 Compare July 28, 2026 11:21
@rewantsoni
rewantsoni force-pushed the implement-replication branch from 2ffd5f3 to 79d9e7a Compare July 28, 2026 11:29
@nixpanic

Copy link
Copy Markdown
Member

Maybe rename this PR to something like this?

rbd: implement GetReplicationDestinationInfo for volumes and groups

@rewantsoni rewantsoni changed the title implement the change for GetReplicationDestinationInfo rbd: implement GetReplicationDestinationInfo for volumes and groups Jul 28, 2026
@mergify mergify Bot added the component/rbd Issues related to RBD label Jul 28, 2026
@rewantsoni
rewantsoni force-pushed the implement-replication branch from 79d9e7a to 486d005 Compare July 28, 2026 16:57
@Rakshith-R
Rakshith-R requested a review from Copilot July 29, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support in the RBD CSI-Addons replication service for the new GetReplicationDestinationInfo RPC, enabling DR orchestrators to map source volume/volume-group CSI IDs to their corresponding destination IDs across mirrored clusters (including optional pool ID remapping via ConfigMap).

Changes:

  • Vendor-bump github.com/csi-addons/spec and regenerate protobuf/grpc stubs to include the new RPC + capability enum.
  • Implement GetReplicationDestinationInfo in the RBD CSI-Addons replication server for both volumes and volume groups, including replicationDestination ConfigMap schema support.
  • Extend cluster mapping utilities/tests and add unit tests for destination-ID mapping and basic RPC request validation.

Reviewed changes

Copilot reviewed 10 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/csi-addons/rbd/replication.go Implements the new RPC and ID mapping helper for volumes and volume groups.
internal/csi-addons/rbd/replication_destination_test.go Adds unit tests for destination ID mapping logic and request validation.
internal/csi-addons/rbd/identity.go Advertises the new CSI-Addons replication capability.
internal/util/csiconfig.go Adds accessor for replication destination config from CSI config.
internal/util/cluster_mapping.go Adds helper to resolve mapped cluster IDs (cluster-mapping.json).
internal/util/cluster_mapping_test.go Adds unit tests for mapped cluster ID resolution.
api/deploy/kubernetes/csi-config-map.go Extends CSI config schema with replication destination configuration.
vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/csi-config-map.go Vendored copy of the CSI config schema update.
PendingReleaseNotes.md Documents the new RPC and configuration behavior.
docs/design/proposals/replication-destination-info.md Updates design proposal with capability advertisement details.
go.mod / go.sum Updates dependency version for csi-addons spec.
vendor/modules.txt Updates vendored module versions.
vendor/github.com/csi-addons/spec/lib/go/replication/replication.pb.go Vendored protobuf changes for new messages/types.
vendor/github.com/csi-addons/spec/lib/go/replication/replication_grpc.pb.go Vendored grpc service changes for new RPC.
vendor/github.com/csi-addons/spec/lib/go/identity/identity.pb.go Vendored capability enum update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/csi-addons/rbd/replication.go
Comment thread internal/csi-addons/rbd/replication.go
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread internal/csi-addons/rbd/replication.go Outdated
Comment thread PendingReleaseNotes.md Outdated
@rewantsoni
rewantsoni force-pushed the implement-replication branch 4 times, most recently from af236c2 to 26e6c47 Compare July 30, 2026 05:01

@iPraveenParihar iPraveenParihar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

questions

// ReplicationDestination defines the destination cluster for replication.
// Populated by ceph-csi-operator from ReplicationDestinationConfig CR.
// +optional
ReplicationDestination *ReplicationDestinationInfo `json:"replicationDestination,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be part of csi: add ReplicationDestinationInfo to ConfigMap schema commit

Comment thread internal/csi-addons/rbd/replication.go
Comment thread internal/csi-addons/rbd/replication.go
Comment thread internal/csi-addons/rbd/replication.go Outdated
@rewantsoni
rewantsoni force-pushed the implement-replication branch 2 times, most recently from caae413 to 439a006 Compare August 3, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 16 changed files in this pull request and generated 1 comment.

Suppressed comments (5)

internal/csi-addons/rbd/replication.go:1143

  • getVolumeGroupReplicationDestinationInfo can panic when the request sets the ReplicationSource type to volumegroup but leaves the volumegroup message unset (nil). volumeGroupSource is dereferenced without a nil check, so malformed requests can crash the server instead of returning InvalidArgument.
	volumeGroupID := volumeGroupSource.GetVolumeGroupId()
	if volumeGroupID == "" {
		return nil, status.Error(codes.InvalidArgument, "empty volume group ID in request")
	}

internal/csi-addons/rbd/replication.go:1202

  • Same issue as above: the replicationDestination lookup uses localClusterID, but the error message reports clusterID. This makes failures harder to interpret when cluster-mapping.json remaps IDs.
	destInfo, err := util.GetReplicationDestinationInfo(util.CsiConfigFile, localClusterID)
	if err != nil {
		return nil, status.Error(
			codes.Internal,
			fmt.Sprintf(
				"failed to get replication destination info for cluster %s: %s",
				clusterID,
				err.Error(),
			),

internal/csi-addons/rbd/replication.go:1113

  • The error message reports clusterID, but the lookup is performed using localClusterID (after applying GetMappedClusterID). This can mislead debugging because the reported cluster is not the one that was used to read the replicationDestination config.

This issue also appears on line 1194 of the same file.

	destInfo, err := util.GetReplicationDestinationInfo(util.CsiConfigFile, localClusterID)
	if err != nil {
		return nil, status.Error(
			codes.Internal,
			fmt.Sprintf(
				"failed to get replication destination info for cluster %s: %s",
				clusterID,
				err.Error(),
			),

internal/util/cluster_mapping.go:201

  • getMappedClusterID can incorrectly remap a clusterID even when that clusterID already exists in the CSI config (e.g., when config.json contains both local and remote clusters). That would flip a local clusterID to its remote counterpart, contradicting the function comment and causing callers to use the wrong cluster config.
	clusterMappingInfo, err := getClusterMappingInfo(clusterID, clusterMappingFile)
	if err != nil {
		return "", err
	}

internal/util/cluster_mapping.go:220

  • When validating whether the mapped cluster exists, errors from readClusterInfo are silently ignored. This can mask real configuration/read failures (e.g., unreadable/invalid config.json) and fall back to returning the original clusterID, which is likely wrong. Only ErrConfigNotFound should be ignored; other errors should be returned.
				if _, err := readClusterInfo(csiConfigFile, mappedClusterID); err == nil {
					log.DebugLog(ctx,
						"mapped cluster ID %q to local cluster ID %q",
						clusterID,
						mappedClusterID)

Comment thread internal/csi-addons/rbd/replication.go
Update the replication destination info proposal to document that
the GET_REPLICATION_DESTINATION_INFO capability must be advertised
via GetCapabilities RPC.

This allows DR orchestrators to discover whether the driver supports
the GetReplicationDestinationInfo feature.

Signed-off-by: Rewant Soni <resoni@redhat.com>
Add ReplicationDestinationInfo, RemoteRBDDetails, and RemotePoolDetails
structures to the ClusterInfo ConfigMap schema. This enables CSI driver
to map source volume/group IDs to destination volume/group IDs when
pool IDs differ across mirrored clusters.

Signed-off-by: Rewant Soni <resoni@redhat.com>
Update csi-addons/spec from b5a7205f6a79 to d4a373713b9a to include
GetReplicationDestinationInfo RPC definitions for volume and volume
group replication.

Signed-off-by: Rewant Soni <resoni@redhat.com>
@rewantsoni
rewantsoni force-pushed the implement-replication branch from 439a006 to 83c5a05 Compare August 4, 2026 10:10
@rewantsoni

Copy link
Copy Markdown
Contributor Author

Testing:

rewantsoni@Mac ~/work/scripts ❯ k get cm ceph-csi-config -oyaml | yq '.data."config.json"'
[{"clusterID":"42ceda1d-b18d-4d63-95ad-708fc0c61744","monitors":["10.0.1.197:3300","10.0.31.76:3300","10.0.38.183:3300"],"cephFS":{"subvolumeGroup":"resoni-c1-client-1","kernelMountOptions":"ms_mode=prefer-crc","fuseMountOptions":"","rado
sNamespace":"resoni-c1-client-1","controllerPublishSecretRef":{"name":"csi-cephfs-provisioner-42ceda1d-b18d-4d63-95ad-708fc0c61744","namespace":"openshift-storage"}},"rbd":{"radosNamespace":"resoni-c1-client-1","controllerPublishSecretRef
":{"name":"csi-rbd-provisioner-42ceda1d-b18d-4d63-95ad-708fc0c61744","namespace":"openshift-storage"},"nodePublishSecretRef":{"name":"csi-rbd-node-42ceda1d-b18d-4d63-95ad-708fc0c61744","namespace":"openshift-storage"}},"nfs":{},"nvmeof":{
"controllerPublishSecretRef":{}},"readAffinity":{"enabled":true,"crushLocationLabels":["kubernetes.io/hostname","topology.kubernetes.io/region","topology.kubernetes.io/zone","topology.rook.io/datacenter","topology.rook.io/room","topology.
rook.io/pod","topology.rook.io/pdu","topology.rook.io/row","topology.rook.io/rack","topology.rook.io/chassis"]},"replicationDestination":{"remoteClusterID":"447af91f-794b-400d-a972-b6c5275c3113","rbd":{"remotePoolMapping":{"ocs-storageclu
ster-cephblockpool":{"poolID":"2"},"pool-2":{"poolID":"5"}}}}}]

Logs from rbdplugin ----
I0806 06:59:21.022697       1 utils.go:361] ID: 77 GRPC call: /replication.Controller/GetReplicationDestinationInfo
I0806 06:59:21.022749       1 utils.go:362] ID: 77 GRPC request: {"replication_source":{"volumegroup":{"volume_group_id":"0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1"}},"secrets":"***stripped***"}
I0806 06:59:21.025250       1 omap.go:219] ID: 77 got omap values: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.group.7322879e-8909-4cd5-851a-55c4e51c36c1"): map[0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-622af6d6-c6ce-4341-ad9a-e2add529cc05: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-80fe8a6f-dc38-4b27-8924-06fdfe25c442: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-885b6286-57e2-4fac-be47-735cbd225020: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-8bd23b44-36b9-4da9-943f-07b1b7e9baa9: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-a531c8b2-dd59-41b1-a751-a54b35a679aa: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-afe0b5a2-20c2-410c-a334-4cffcec75ee8: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-b4050f0f-6d39-4e6b-9015-dff2e48d44ef: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-cf7bd188-293d-4d63-8efb-189b0b43aa58: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-e61d2147-b6d9-459a-9346-4e1f39185f6f: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08: csi.creationtime:2026-08-06T06:59:07.019376896Z csi.groupname:csi-vol-group-7322879e-8909-4cd5-851a-55c4e51c36c1 csi.volname:vgrcontent-d82f3556-06c0-4a7c-bdb9-bed6e419b9ac]
I0806 06:59:21.025276       1 util.go:195] ID: 77 object for volume group "0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1" has been initialized
I0806 06:59:21.027265       1 omap.go:219] ID: 77 got omap values: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.group.7322879e-8909-4cd5-851a-55c4e51c36c1"): map[0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-622af6d6-c6ce-4341-ad9a-e2add529cc05: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-80fe8a6f-dc38-4b27-8924-06fdfe25c442: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-885b6286-57e2-4fac-be47-735cbd225020: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-8bd23b44-36b9-4da9-943f-07b1b7e9baa9: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-a531c8b2-dd59-41b1-a751-a54b35a679aa: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-afe0b5a2-20c2-410c-a334-4cffcec75ee8: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-b4050f0f-6d39-4e6b-9015-dff2e48d44ef: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-cf7bd188-293d-4d63-8efb-189b0b43aa58: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-e61d2147-b6d9-459a-9346-4e1f39185f6f: 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08: csi.creationtime:2026-08-06T06:59:07.019376896Z csi.groupname:csi-vol-group-7322879e-8909-4cd5-851a-55c4e51c36c1 csi.volname:vgrcontent-d82f3556-06c0-4a7c-bdb9-bed6e419b9ac]
I0806 06:59:21.028467       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.cf7bd188-293d-4d63-8efb-189b0b43aa58"): map[csi.imageid:1c3d3203a7bd5 csi.imagename:csi-vol-cf7bd188-293d-4d63-8efb-189b0b43aa58 csi.volname:pvc-65524996-3647-44b5-8b89-0633229d611c csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.060930       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.622af6d6-c6ce-4341-ad9a-e2add529cc05"): map[csi.imageid:1c3d3102fbebb csi.imagename:csi-vol-622af6d6-c6ce-4341-ad9a-e2add529cc05 csi.volname:pvc-6a2aee79-dc37-4cc4-bc28-20cbd425c89f csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.102191       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.8bd23b44-36b9-4da9-943f-07b1b7e9baa9"): map[csi.imageid:1c3d3b09f6b6b csi.imagename:csi-vol-8bd23b44-36b9-4da9-943f-07b1b7e9baa9 csi.volname:pvc-34e1e5c9-9538-49e1-8afd-f25e00c8d6ff csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.131181       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.a531c8b2-dd59-41b1-a751-a54b35a679aa"): map[csi.imageid:1c3d3be76fde2 csi.imagename:csi-vol-a531c8b2-dd59-41b1-a751-a54b35a679aa csi.volname:pvc-45e0c81b-3980-452f-a287-a0f771a3f107 csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.171587       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.b4050f0f-6d39-4e6b-9015-dff2e48d44ef"): map[csi.imageid:1c3d358ce36fc csi.imagename:csi-vol-b4050f0f-6d39-4e6b-9015-dff2e48d44ef csi.volname:pvc-334fd14d-ed5d-49b1-8ceb-e674a260888a csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.196998       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.f7f0b75b-d9ef-4156-97b1-65caa2cc3a08"): map[csi.imageid:1c3d3dcbc477 csi.imagename:csi-vol-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08 csi.volname:pvc-e980bc2f-dfc7-4de7-8619-df0d5765165f csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.222588       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.80fe8a6f-dc38-4b27-8924-06fdfe25c442"): map[csi.imageid:1c3d3d4c801c3 csi.imagename:csi-vol-80fe8a6f-dc38-4b27-8924-06fdfe25c442 csi.volname:pvc-84b0a95a-4689-4d01-a12c-f348e13003df csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.263818       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.885b6286-57e2-4fac-be47-735cbd225020"): map[csi.imageid:1c3d371a63308 csi.imagename:csi-vol-885b6286-57e2-4fac-be47-735cbd225020 csi.volname:pvc-9be59b52-25f6-47d9-b1c7-4a32561c0732 csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.293595       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.afe0b5a2-20c2-410c-a334-4cffcec75ee8"): map[csi.imageid:1c3d3619f8b50 csi.imagename:csi-vol-afe0b5a2-20c2-410c-a334-4cffcec75ee8 csi.volname:pvc-1ddf7436-3696-41fe-99de-c8ba3e8ec5e4 csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.323362       1 omap.go:87] ID: 77 got omap values by keys: (pool="pool-2", namespace="resoni-c1-client-1", name="csi.volume.e61d2147-b6d9-459a-9346-4e1f39185f6f"): map[csi.imageid:1c3d3e757c968 csi.imagename:csi-vol-e61d2147-b6d9-459a-9346-4e1f39185f6f csi.volname:pvc-7d97fb58-9fa3-49ba-aad7-bfa54c021a27 csi.volume.owner:test-rbd-pool-2-sc-remote]
I0806 06:59:21.362796       1 volume_group.go:111] ID: 77 GetVolumeGroup(0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1) returns {commonVolumeGroup:{id:0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1 requestName:vgrcontent-d82f3556-06c0-4a7c-bdb9-bed6e419b9ac name:csi-vol-group-7322879e-8909-4cd5-851a-55c4e51c36c1 creationTime:0x1e57b07df8d8 clusterID:42ceda1d-b18d-4d63-95ad-708fc0c61744 objectUUID:7322879e-8909-4cd5-851a-55c4e51c36c1 credentials:0x1e57b0b11aa0 conn:<nil> ioctx:<nil> monitors:10.0.1.197:3300,10.0.31.76:3300,10.0.38.183:3300 pool:pool-2 namespace:resoni-c1-client-1 csiDriver:default journal:0x1e57b13098a0} volumes:[0x1e57b10c8488 0x1e57b10c86c8 0x1e57b1106d88 0x1e57b1106fc8 0x1e57b1107208 0x1e57b1107448 0x1e57b1107688 0x1e57b11078c8 0x1e57b1107b08 0x1e57b1107d48] volumesToFree:[0x1e57b10c8488 0x1e57b10c86c8 0x1e57b1106d88 0x1e57b1106fc8 0x1e57b1107208 0x1e57b1107448 0x1e57b1107688 0x1e57b11078c8 0x1e57b1107b08 0x1e57b1107d48]}
I0806 06:59:21.362965       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.362978       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-7322879e-8909-4cd5-851a-55c4e51c36c1
I0806 06:59:21.362984       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.362989       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-cf7bd188-293d-4d63-8efb-189b0b43aa58 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-cf7bd188-293d-4d63-8efb-189b0b43aa58
I0806 06:59:21.362994       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.362999       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-622af6d6-c6ce-4341-ad9a-e2add529cc05 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-622af6d6-c6ce-4341-ad9a-e2add529cc05
I0806 06:59:21.363005       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363015       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-8bd23b44-36b9-4da9-943f-07b1b7e9baa9 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-8bd23b44-36b9-4da9-943f-07b1b7e9baa9
I0806 06:59:21.363022       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363026       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-a531c8b2-dd59-41b1-a751-a54b35a679aa to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-a531c8b2-dd59-41b1-a751-a54b35a679aa
I0806 06:59:21.363030       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363036       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-b4050f0f-6d39-4e6b-9015-dff2e48d44ef to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-b4050f0f-6d39-4e6b-9015-dff2e48d44ef
I0806 06:59:21.363039       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363044       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08
I0806 06:59:21.363048       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363053       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-80fe8a6f-dc38-4b27-8924-06fdfe25c442 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-80fe8a6f-dc38-4b27-8924-06fdfe25c442
I0806 06:59:21.363057       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363061       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-885b6286-57e2-4fac-be47-735cbd225020 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-885b6286-57e2-4fac-be47-735cbd225020
I0806 06:59:21.363066       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363070       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-afe0b5a2-20c2-410c-a334-4cffcec75ee8 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-afe0b5a2-20c2-410c-a334-4cffcec75ee8
I0806 06:59:21.363108       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.363113       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-e61d2147-b6d9-459a-9346-4e1f39185f6f to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-e61d2147-b6d9-459a-9346-4e1f39185f6f
I0806 06:59:21.363210       1 utils.go:368] ID: 77 GRPC response: {"replication_destination":{"volumegroup":{"volume_group_id":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-7322879e-8909-4cd5-851a-55c4e51c36c1","volume_ids":{"0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-622af6d6-c6ce-4341-ad9a-e2add529cc05":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-622af6d6-c6ce-4341-ad9a-e2add529cc05","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-80fe8a6f-dc38-4b27-8924-06fdfe25c442":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-80fe8a6f-dc38-4b27-8924-06fdfe25c442","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-885b6286-57e2-4fac-be47-735cbd225020":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-885b6286-57e2-4fac-be47-735cbd225020","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-8bd23b44-36b9-4da9-943f-07b1b7e9baa9":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-8bd23b44-36b9-4da9-943f-07b1b7e9baa9","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-a531c8b2-dd59-41b1-a751-a54b35a679aa":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-a531c8b2-dd59-41b1-a751-a54b35a679aa","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-afe0b5a2-20c2-410c-a334-4cffcec75ee8":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-afe0b5a2-20c2-410c-a334-4cffcec75ee8","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-b4050f0f-6d39-4e6b-9015-dff2e48d44ef":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-b4050f0f-6d39-4e6b-9015-dff2e48d44ef","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-cf7bd188-293d-4d63-8efb-189b0b43aa58":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-cf7bd188-293d-4d63-8efb-189b0b43aa58","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-e61d2147-b6d9-459a-9346-4e1f39185f6f":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-e61d2147-b6d9-459a-9346-4e1f39185f6f","0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08":"0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-f7f0b75b-d9ef-4156-97b1-65caa2cc3a08"}}}}

@rewantsoni
rewantsoni force-pushed the implement-replication branch from 83c5a05 to 5a2473f Compare August 6, 2026 07:27
@rewantsoni
rewantsoni requested a review from a team as a code owner August 6, 2026 07:27
Madhu-1
Madhu-1 previously approved these changes Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 17 changed files in this pull request and generated no new comments.

Suppressed comments (1)

internal/csi-common/utils.go:262

  • The new ReplicationSource oneof cases can panic if the oneof wrapper is present but its payload message is nil (e.g., &replication.ReplicationSource_Volume{}), because r.Volume/r.Volumegroup is dereferenced unconditionally. Also, this switch does not extract a ReqID for the new GetReplicationDestinationInfoRequest, so logs for that RPC won’t include a request/volume identifier.
	case *replication.ReplicationSource_Volume:
		reqID = r.Volume.GetVolumeId()
	case *replication.ReplicationSource_Volumegroup:
		reqID = r.Volumegroup.GetVolumeGroupId()

@iPraveenParihar iPraveenParihar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rewantsoni few nits.
Rest LGTM.
Thanks!

Tagging @ceph/ceph-csi-contributors for Review

Comment thread internal/util/cluster_mapping.go
Comment thread internal/csi-addons/rbd/replication.go
remotePoolDetails.PoolID, poolName, clusterID, err)
}
remotePoolID = parsedPoolID
log.DebugLog(ctx, "mapped pool %s from ID %d to remote ID %d", poolName, sourceID.LocationID, remotePoolID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it should be logging concern.

@Madhu-1 @Rakshith-R For VolumeGroup path, this would be called per image and flood log with mapped pool pool-2 from ID 6 to remote ID 5 since groups are scoped at pool and all images will be in same pool unless we plan to support different pool?

I0806 06:59:21.362965       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.362978       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-7322879e-8909-4cd5-851a-55c4e51c36c1 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-7322879e-8909-4cd5-851a-55c4e51c36c1
I0806 06:59:21.362984       1 replication.go:1331] ID: 77 mapped pool pool-2 from ID 6 to remote ID 5
I0806 06:59:21.362989       1 replication.go:1349] ID: 77 mapped source ID 0001-0024-42ceda1d-b18d-4d63-95ad-708fc0c61744-0000000000000006-cf7bd188-293d-4d63-8efb-189b0b43aa58 to destination ID 0001-0024-447af91f-794b-400d-a972-b6c5275c3113-0000000000000005-cf7bd188-293d-4d63-8efb-189b0b43aa58

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it should be supported no limitation from rbd. i agree with concern but its required for debugging.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 @rewantsoni any ideas to minimize logging for groups to reduce spam ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rakshith-R Since this information is crucial and required for debugging, I would say that we can live with this. When we have groups from different pools enabled this information would be more useful.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rakshith-R Since this information is crucial and required for debugging, I would say that we can live with this. When we have groups from different pools enabled this information would be more useful.

I don't think that's anywhere on the roadmap ?
but okay

@iPraveenParihar

Copy link
Copy Markdown
Contributor

Pull request overview

Copilot reviewed 11 out of 17 changed files in this pull request and generated no new comments.

Suppressed comments (1)
internal/csi-common/utils.go:262

  • The new ReplicationSource oneof cases can panic if the oneof wrapper is present but its payload message is nil (e.g., &replication.ReplicationSource_Volume{}), because r.Volume/r.Volumegroup is dereferenced unconditionally. Also, this switch does not extract a ReqID for the new GetReplicationDestinationInfoRequest, so logs for that RPC won’t include a request/volume identifier.
	case *replication.ReplicationSource_Volume:
		reqID = r.Volume.GetVolumeId()
	case *replication.ReplicationSource_Volumegroup:
		reqID = r.Volumegroup.GetVolumeGroupId()

@rewantsoni Can you check this and rule out if not correct?

@rewantsoni
rewantsoni force-pushed the implement-replication branch from 5a2473f to 9830703 Compare August 6, 2026 08:56
@mergify
mergify Bot dismissed Madhu-1’s stale review August 6, 2026 08:56

Pull request has been modified.

Add GetReplicationDestinationInfo RPC implementation for both volume
and volume group replication. This RPC maps source volume/group IDs to
destination IDs by using the replicationDestination configuration from
the ConfigMap.

Signed-off-by: Rewant Soni <resoni@redhat.com>
Add GET_REPLICATION_DESTINATION_INFO to the list of advertised
capabilities in GetCapabilities RPC.

The capability is advertised on controller servers and applies to both
volume and volume group replication, as both are handled by the same
Replication Controller service.

Signed-off-by: Rewant Soni <resoni@redhat.com>
Add unit tests for GetReplicationDestinationInfo RPC

Signed-off-by: Rewant Soni <resoni@redhat.com>
Document the new GetReplicationDestinationInfo RPC feature in the
pending release notes for v3.18.

This RPC enables DR orchestrators to map source volume/volume group IDs
to destination IDs across mirrored clusters when pools have different
IDs, supporting both single volumes and volume groups with pool-based
mapping configuration.

Signed-off-by: Rewant Soni <resoni@redhat.com>
@rewantsoni
rewantsoni force-pushed the implement-replication branch from 9830703 to 81eaa8f Compare August 6, 2026 09:03

@iPraveenParihar iPraveenParihar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/rbd Issues related to RBD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants