Skip to content

rbd: implement GetReplicationDestinationInfo for volumes and groups - #6366

Merged
mergify[bot] merged 7 commits into
ceph:develfrom
rewantsoni:implement-replication
Aug 7, 2026
Merged

rbd: implement GetReplicationDestinationInfo for volumes and groups#6366
mergify[bot] merged 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
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

rebase

🛑 The pull request rule doesn't match anymore

Details

This action has been cancelled.

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>
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>
@ceph-csi-bot
ceph-csi-bot force-pushed the implement-replication branch from 81eaa8f to aa1b615 Compare August 7, 2026 11:51
@ceph-csi-bot ceph-csi-bot added ok-to-test Label to trigger E2E tests and removed queued/rebase labels Aug 7, 2026
@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.35

@ceph-csi-bot ceph-csi-bot added ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. and removed ok-to-test Label to trigger E2E tests labels Aug 7, 2026
@mergify mergify Bot removed the ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. label Aug 7, 2026
@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member

/retest ci/centos/mini-e2e/k8s-1.35

@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member

/retest ci/centos/mini-e2e/k8s-1.35

Failed with

nfs Test NFS CSI [It] create a PVC clone and bind it to an app

@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Deprecation notice: This pull request comes from a fork and was queued with update_method=rebase and update_bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the merge queue will no longer be able to rebase fork pull requests with this configuration. To avoid disruption, switch to update_method=merge in your queue rule.

@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-07 16:16 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-07 16:17 UTC · at aa1b615b89703683d948ac243e7f22edd3ef192e · rebase

This pull request spent 35 seconds in the queue, including 5 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 7a90925 into ceph:devel Aug 7, 2026
43 of 44 checks passed
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.

7 participants