Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: use pre-existing volume group if content matches #5221

Merged
merged 6 commits into from
Mar 27, 2025

Conversation

nixpanic
Copy link
Member

@nixpanic nixpanic commented Mar 13, 2025

CSI-Addons Volume Groups makes it possible to create a long-living volume group. This is incompatible with the VolumeGroupSnapshot feature, as that creates a temporary VolumeGroup before creating a snapshot of it. When a Volume is already part of a different Volume Group, things will fail.

In order to make both features compatible with each other, the following things are required:

  • VolumeGroupSnapshot functions may need to reuse an existing VolumeGroup
  • VolumeGroup creation should verify that all Volumes are in the same existing VolumeGroup, or no group at all
  • existing VolumeGroups should be inspected and the volumes in the group should match the volumes in the VolumeGroupSnapshot request
  • if a VolumeGroupSnapshot request reuses an existing VolumeGroup, the VolumeGroup should not be deleted after creating the snapshots

Depends-on: #5184

@nixpanic nixpanic added the component/rbd Issues related to RBD label Mar 13, 2025
@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from 65987ab to 12f7dce Compare March 14, 2025 17:11
@nixpanic
Copy link
Member Author

Manually testing by creating a VolumeGroup with the csi-addons tool:

$ oc -n openshift-storage rsh -c csi-addons csi-rbdplugin-provisioner-6c58bb4dcb-xdf7r
sh-5.1# csi-addons -operation CreateVolumeGroup -parameters clusterID=openshift-storage,pool=ocs-storagecluster-cephblockpool -volumegroupname manual-vg -secret openshift-storage/rook-csi-rbd-provisioner -endpoint unix:///csi/csi-addons.sock -volumeids 0001-0011-openshift-storage-0000000000000001-00af5b70-aa80-41e4-8870-8f10dfcb8414,0001-0011-openshift-storage-0000000000000001-0a658de9-22ec-4c2c-9bf6-dceddd044b9e,0001-0011-openshift-storage-0000000000000001-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055,0001-0011-openshift-storage-0000000000000001-859bdaef-052f-4de9-a076-506b97249788,0001-0011-openshift-storage-0000000000000001-3b3fea75-bfd8-46f2-bcbf-2a36c1e326c7,0001-0011-openshift-storage-0000000000000001-1a23b796-3111-469a-b682-cd12f7640e7e,0001-0011-openshift-storage-0000000000000001-0c7d3eb5-eefc-45f3-a98a-fbdadda465f6
Volume Group created: volume_group:{volume_group_id:"0001-0011-openshift-storage-0000000000000001-cd0f91ed-9e28-4560-914f-251cb4fe5da0"  volume_ids:"0001-0011-openshift-storage-0000000000000001-00af5b70-aa80-41e4-8870-8f10dfcb8414"  volume_ids:"0001-0011-openshift-storage-0000000000000001-0a658de9-22ec-4c2c-9bf6-dceddd044b9e"  volume_ids:"0001-0011-openshift-storage-0000000000000001-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055"  volume_ids:"0001-0011-openshift-storage-0000000000000001-859bdaef-052f-4de9-a076-506b97249788"  volume_ids:"0001-0011-openshift-storage-0000000000000001-3b3fea75-bfd8-46f2-bcbf-2a36c1e326c7"  volume_ids:"0001-0011-openshift-storage-0000000000000001-1a23b796-3111-469a-b682-cd12f7640e7e"  volume_ids:"0001-0011-openshift-storage-0000000000000001-0c7d3eb5-eefc-45f3-a98a-fbdadda465f6"}

Then creating a VolumeGroupSnapshot with the same volumes fails:

I0314 17:02:45.465235       1 utils.go:266] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 GRPC call: /csi.v1.GroupController/CreateVolumeGroupSnapshot
I0314 17:02:45.465290       1 utils.go:267] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 GRPC request: {"name":"groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721","parameters":{"clusterID":"openshift-storage","csi.storage.k8s.io/volumegroupsnapshot/name":"rbd-groupsnapshot","csi.storage.k8s.io/volumegroupsnapshot/namespace":"default","csi.storage.k8s.io/volumegroupsnapshotcontent/name":"groupsnapcontent-69cc2d64-41af-438b-86bc-c44fdcd46721","pool":"ocs-storagecluster-cephblockpool"},"secrets":"***stripped***","source_volume_ids":["0001-0011-openshift-storage-0000000000000001-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055","0001-0011-openshift-storage-0000000000000001-859bdaef-052f-4de9-a076-506b97249788","0001-0011-openshift-storage-0000000000000001-0c7d3eb5-eefc-45f3-a98a-fbdadda465f6","0001-0011-openshift-storage-0000000000000001-0a658de9-22ec-4c2c-9bf6-dceddd044b9e","0001-0011-openshift-storage-0000000000000001-1a23b796-3111-469a-b682-cd12f7640e7e","0001-0011-openshift-storage-0000000000000001-3b3fea75-bfd8-46f2-bcbf-2a36c1e326c7"]}
I0314 17:02:45.469433       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.6a6f2bb0-803e-4c8a-bdb6-e948f3bac055"): map[csi.imageid:139ba33b2239 csi.imagename:csi-vol-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055 csi.volname:pvc-94c7f8e6-c4c0-4e67-8cca-217aad09af8c csi.volume.owner:default]
I0314 17:02:45.493552       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.859bdaef-052f-4de9-a076-506b97249788"): map[csi.imageid:139bc2dc848a csi.imagename:csi-vol-859bdaef-052f-4de9-a076-506b97249788 csi.volname:pvc-ac6c7a5f-e4c2-4cd3-b4fc-fd8f47f19b12 csi.volume.owner:default]
I0314 17:02:45.511361       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.0c7d3eb5-eefc-45f3-a98a-fbdadda465f6"): map[csi.imageid:139b675904bc csi.imagename:csi-vol-0c7d3eb5-eefc-45f3-a98a-fbdadda465f6 csi.volname:pvc-f95bf3a4-c829-4aba-8e0b-ff7b8fd6aa61 csi.volume.owner:default]
I0314 17:02:45.541308       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.0a658de9-22ec-4c2c-9bf6-dceddd044b9e"): map[csi.imageid:139bfa0d5b82 csi.imagename:csi-vol-0a658de9-22ec-4c2c-9bf6-dceddd044b9e csi.volname:pvc-723a88f3-3f5a-45f4-bec7-5a9ea3bbd558 csi.volume.owner:default]
I0314 17:02:45.558096       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.1a23b796-3111-469a-b682-cd12f7640e7e"): map[csi.imageid:139b9f680337 csi.imagename:csi-vol-1a23b796-3111-469a-b682-cd12f7640e7e csi.volname:pvc-f1e2077d-0a3b-499a-9702-b120f87d5461 csi.volume.owner:default]
I0314 17:02:45.579144       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.3b3fea75-bfd8-46f2-bcbf-2a36c1e326c7"): map[csi.imageid:139b7ed8c531 csi.imagename:csi-vol-3b3fea75-bfd8-46f2-bcbf-2a36c1e326c7 csi.volname:pvc-d4a22c0e-e8bd-4e6b-a19f-1553fada21d9 csi.volume.owner:default]
I0314 17:02:45.599865       1 group_controllerserver.go:119] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 all 6 Volumes for VolumeGroup "groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721" have been found
I0314 17:02:45.739809       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.groups.default"): map[csi.volume.group.groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721:aed5d689-0346-40eb-838d-8dafaaac2413]
I0314 17:02:45.740394       1 omap.go:221] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.group.aed5d689-0346-40eb-838d-8dafaaac2413"): map[csi.creationtime:2025-03-14T17:02:17.101995004Z csi.groupname:csi-vol-group-aed5d689-0346-40eb-838d-8dafaaac2413 csi.volname:groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721]
I0314 17:02:45.740417       1 manager.go:153] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got UUID "aed5d689-0346-40eb-838d-8dafaaac2413" for group "groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721"
I0314 17:02:45.740603       1 util.go:183] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 object for volume group "0001-0011-openshift-storage-0000000000000001-aed5d689-0346-40eb-838d-8dafaaac2413" has been initialized
I0314 17:02:45.742113       1 omap.go:221] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.group.aed5d689-0346-40eb-838d-8dafaaac2413"): map[csi.creationtime:2025-03-14T17:02:17.101995004Z csi.groupname:csi-vol-group-aed5d689-0346-40eb-838d-8dafaaac2413 csi.volname:groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721]
I0314 17:02:45.742140       1 group_snapshot.go:115] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 GetVolumeGroupSnapshot(0001-0011-openshift-storage-0000000000000001-aed5d689-0346-40eb-838d-8dafaaac2413) returns {commonVolumeGroup:{id:0001-0011-openshift-storage-0000000000000001-aed5d689-0346-40eb-838d-8dafaaac2413 requestName:groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 name:csi-vol-group-aed5d689-0346-40eb-838d-8dafaaac2413 creationTime:0xc00090d5f0 clusterID:openshift-storage objectUUID:aed5d689-0346-40eb-838d-8dafaaac2413 credentials:0xc000730600 conn:<nil> ioctx:<nil> monitors:172.30.98.44:3300,172.30.108.232:3300,172.30.190.108:3300 pool:ocs-storagecluster-cephblockpool namespace: csiDriver:default journal:0xc0007c5f50} snapshots:[] snapshotsToFree:[]}
I0314 17:02:45.742158       1 group_controllerserver.go:162] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 need to create new volume group snapshot, failed to get existing one with name "groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721": volume group snapshot "ocs-storagecluster-cephblockpool/csi-vol-group-aed5d689-0346-40eb-838d-8dafaaac2413" is incomplete, it has no snapshots
I0314 17:02:45.967015       1 omap.go:89] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.groups.default"): map[csi.volume.group.csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0:82c37309-9e16-4d04-8145-5b2150c8308b]
I0314 17:02:45.968262       1 omap.go:221] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.group.82c37309-9e16-4d04-8145-5b2150c8308b"): map[csi.creationtime:2025-03-14T17:02:17.330879735Z csi.groupname:csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b csi.volname:csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0]
I0314 17:02:45.968494       1 util.go:183] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 object for volume group "0001-0011-openshift-storage-0000000000000001-82c37309-9e16-4d04-8145-5b2150c8308b" has been initialized
I0314 17:02:45.970532       1 omap.go:221] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.group.82c37309-9e16-4d04-8145-5b2150c8308b"): map[csi.creationtime:2025-03-14T17:02:17.330879735Z csi.groupname:csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b csi.volname:csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0]
I0314 17:02:45.970558       1 volume_group.go:114] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 GetVolumeGroup(0001-0011-openshift-storage-0000000000000001-82c37309-9e16-4d04-8145-5b2150c8308b) returns {commonVolumeGroup:{id:0001-0011-openshift-storage-0000000000000001-82c37309-9e16-4d04-8145-5b2150c8308b requestName:csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0 name:csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b creationTime:0xc00090d818 clusterID:openshift-storage objectUUID:82c37309-9e16-4d04-8145-5b2150c8308b credentials:0xc000730600 conn:<nil> ioctx:<nil> monitors:172.30.98.44:3300,172.30.108.232:3300,172.30.190.108:3300 pool:ocs-storagecluster-cephblockpool namespace: csiDriver:default journal:0xc000aca510} volumes:[] volumesToFree:[]}
I0314 17:02:45.970588       1 util.go:321] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 connection established for volume group "0001-0011-openshift-storage-0000000000000001-82c37309-9e16-4d04-8145-5b2150c8308b"
I0314 17:02:45.970602       1 util.go:372] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 iocontext created for volume group "0001-0011-openshift-storage-0000000000000001-82c37309-9e16-4d04-8145-5b2150c8308b" in pool "ocs-storagecluster-cephblockpool"
I0314 17:02:45.975176       1 volume_group.go:179] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 ignoring error while creating volume group "ocs-storagecluster-cephblockpool/csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b": rbd: ret=-17, File exists
I0314 17:02:45.975192       1 volume_group.go:182] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 volume group "ocs-storagecluster-cephblockpool/csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b" has been created
I0314 17:02:45.975207       1 group_controllerserver.go:198] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 VolumeGroup "csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0" has been created: ocs-storagecluster-cephblockpool/csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b
E0314 17:02:45.996596       1 utils.go:271] ID: 38 Req-ID: groupsnapshot-69cc2d64-41af-438b-86bc-c44fdcd46721 GRPC error: rpc error: code = Aborted desc = failed to add volume "ocs-storagecluster-cephblockpool/csi-vol-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055" to volume group "ocs-storagecluster-cephblockpool/csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b": image "ocs-storagecluster-cephblockpool/csi-vol-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055" is already part of volume group "csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0"

The last line from the Ceph-CSI logs suggest that the volumes are attempted to be added to a wrong group:

failed to add volume "ocs-storagecluster-cephblockpool/csi-vol-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055" to volume group "ocs-storagecluster-cephblockpool/csi-vol-group-82c37309-9e16-4d04-8145-5b2150c8308b": image "ocs-storagecluster-cephblockpool/csi-vol-6a6f2bb0-803e-4c8a-bdb6-e948f3bac055" is already part of volume group "csi-vol-group-cd0f91ed-9e28-4560-914f-251cb4fe5da0"

@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch 2 times, most recently from 27e9df7 to 6c7e7ed Compare March 21, 2025 09:58
@nixpanic
Copy link
Member Author

The current state seems to work well.

Only the Ceph main branch supports the rbd_group_snap_get_info function, so testing VolumeGroupSnapshot isn't trivial. My quay.io/nixpanic/cephcsi:pr-5221 image contains a hack to use the Ceph main branch (removed the commit from this PR).

@nixpanic nixpanic marked this pull request as ready for review March 21, 2025 10:01
@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from 6c7e7ed to 0f6445e Compare March 21, 2025 10:08
Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

Let's add a tracker to take care of cases where VolumeGroupReplication may modify the group during groupSnapshot create, delete or in between those requests in the future

@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch 2 times, most recently from 1925c37 to ebf62d7 Compare March 21, 2025 15:52
@nixpanic nixpanic requested review from Madhu-1 and a team March 21, 2025 16:07
@nixpanic
Copy link
Member Author

Let's add a tracker to take care of cases where VolumeGroupReplication may modify the group during groupSnapshot create, delete or in between those requests in the future

See #5232.

return librbd.GroupImageRemove(ioctx, id, rv.ioctx, rv.RbdImageName)
}

// GetVolumeGroupID returns the name of the VolumeGroup where this rbdVolume
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// GetVolumeGroupID returns the name of the VolumeGroup where this rbdVolume
// GetVolumeGroupID returns the ID of the VolumeGroup where this rbdVolume

return fmt.Errorf("could not get id for volume group %q: %w", vg, err)
}

return librbd.GroupImageRemove(ioctx, id, rv.ioctx, rv.RbdImageName)
Copy link
Contributor

@Nikhil-Ladha Nikhil-Ladha Mar 24, 2025

Choose a reason for hiding this comment

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

GroupImageRemove accepts the group name and not id, so shouldn't we continue to fetch the name and pass it to the API? Or, am I missing something here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The naming has been a bit confusing to me as well. The GetID() function returns the generated unique name of the rbd-group (something like csi-group-<UUID>), the GetName() function returns the name that was requested by the caller with the CreateVolumeGroup procedure (stored in the journal and pointing to the generated name/id of the real RBD-group).

Throughout Ceph-CSI there are many id fields, and the naming has not always been consistent. This commit corrects an earlier mistake that I found when manually creating a volume-group with a name my-group and trying to use that to create a VolumeGroupSnapshot of. ID/name was incorrect, with this change it looks way cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add a better description in internal/rbd/types.journalledObject for these functions.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems the confusion is on my part. The GetID() function returns the CSI-handle formatted unique ID, it can be parsed and used to obtain the details from the journal, which then point to the actual object in the backend (RBD-image or RBD-group name). Updated the documentation for internal/rbd/types.journalledObject again.

Comment on lines 101 to 108
if vol == nil {
continue
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nixpanic we dont get to this state isnt it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not normally, but we can. The commit that adds this part has the following commit message:

When an incorrect volumeID is passed while creating a VolumeGroup, the
.Destroy() function causes a panic. With this extra check to skip
nil volumes, the panic does not happen anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

This can probably also be solved by creating an empty volumes slice, and appending each volume after it has been resolved. If that is something you prefer, I can take that approach.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that makes sense, we could avoid this check

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, please check again.

return nil, err
// reuse the existing group, it contains the volumes already
// check for pre-existing volume group name
vgHandle, err := volumes[0].GetVolumeGroupID(ctx, mgr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

length of volumes can be 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, yes, I think that might be possible. I'll add a check for that.

@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from ebf62d7 to 24a843e Compare March 25, 2025 09:35
@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from 24a843e to a80af79 Compare March 25, 2025 13:02
@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from a80af79 to 3068c73 Compare March 26, 2025 08:57
@nixpanic nixpanic requested a review from Rakshith-R March 26, 2025 09:15
@Rakshith-R
Copy link
Contributor

LGTM,
I'll wait for conclusion on #5184 (comment) so both prs go in smoothly.

@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from 3068c73 to fb4e754 Compare March 27, 2025 09:11
@nixpanic
Copy link
Member Author

This is now based on #5184, making sure both PRs can be merged together nicely.

@nixpanic
Copy link
Member Author

@Mergifyio rebase

When an incorrect volumeID is passed while creating a VolumeGroup, the
`.Destroy()` function caused a panic. By appending each volume to the
volumes slice, the slice won't contain any `nil` volumes anymore.

Signed-off-by: Niels de Vos <[email protected]>
The `prefix` is passed to several functions, but it can easily be
obtained with a small helper function. This makes calling the functions
a little simpler.

Signed-off-by: Niels de Vos <[email protected]>
The Manager.MakeVolumeGroupID() function can be used to build a CSI
VolumeGroupID from the backend (pool and name of the RBD-group). This
will be used when checking if an RBD-image belongs to a group already.
It is also possible to resolve the VolumeGroup by passing the
VolumeGroupID to the existing Manager.GetVolumeGroupByID() function.

Signed-off-by: Niels de Vos <[email protected]>
CompareVolumesInGroup() verifies that all the volumes are part of the
given VolumeGroup. It does so by obtaining the VolumeGroupID for each
volume with GetVolumeGroupByID().

The helper VolumesInSameGroup() verifies that all volumes belong to the
same (or no) VolumeGroup. It can be called by CSI(-Addons) procedures
before acting on a VolumeGroup.

Signed-off-by: Niels de Vos <[email protected]>
When a VolumeGroup has been created through the CSI-Addons API, the
VolumeGroupSnapshot CSI API will now use the existing VolumeGroup. There
are checks in place to validate that the Volumes in the VolumeGroup
match the Volumes in the VolumeGroupSnapshot request.

Signed-off-by: Niels de Vos <[email protected]>
The `GetID()` and `GetName()` functions can be confusing, as names and
ID's are not always distinctive enough. The name is used to reference an
object that exists in a pool. The ID the CSI-handle formatted and can be
used to locate the entry for the object in the journal.

Signed-off-by: Niels de Vos <[email protected]>
Copy link
Contributor

mergify bot commented Mar 27, 2025

rebase

✅ Branch has been successfully rebased

@nixpanic nixpanic force-pushed the rbd/re-use-existing-volume-group branch from fb4e754 to a771326 Compare March 27, 2025 11:08
@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

/test ci/centos/upgrade-tests

Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@nixpanic
Copy link
Member Author

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

@nixpanic
Copy link
Member Author

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

Failed while deploying minikube cluster logs

@mergify mergify bot merged commit 3f33e87 into ceph:devel Mar 27, 2025
26 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.

4 participants