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: Flatten group snapshot #4973

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from

Conversation

Rakshith-R
Copy link
Contributor

@Rakshith-R Rakshith-R commented Nov 22, 2024

Describe what this PR does

  • Adds e2e loop to create and delete additional 5 groupsnapshots.
  • Add PrepareVolumeSnapshot() to check snapLimit and cloneDepth & flatten if necessary.
  • Make use of both ListSnapshots & ListChildren to determine Snap count and which child images can be flattened.
  • Add features deep-flatten and layering to group snapshot clones.

Related issues

related-to: #5000

Fixes: #issue_number

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!)

@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R added WIP This PR still in work-in-progress ci/skip/multi-arch-build skip building on multiple architectures labels Nov 22, 2024
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R
Copy link
Contributor Author

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch 5 times, most recently from d22ce45 to 234ae0c Compare November 22, 2024 12:18
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R
Copy link
Contributor Author

E2E changes in this pr adds creation & deletion of additional volumegroupsnapshots.
helm e2e has low min[max]snapshotlimit 2 & 3.
This causes creation of even 5 additional volumegroupsnapshot since
snapshot name of such a snapshot is not the same as the cloned image.
Therefore, flatten logic fails to find such a cloned image to flatten.

I1122 15:23:40.732723 1 controllerserver.go:607] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad snapshots count 3 on image: replicapool/csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191 reached configured soft limit 2
I1122 15:23:40.798206 1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0c6470c9d_20e0d35cb849"
E1122 15:23:40.805758 1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0c6470c9d_20e0d35cb849 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"

  I1122 15:23:40.399649       1 utils.go:266] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GRPC call: /csi.v1.GroupController/CreateVolumeGroupSnapshot
  I1122 15:23:40.399730       1 utils.go:267] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GRPC request: {"name":"groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad","parameters":{"clusterID":"28e82505-e50e-4f6a-985a-3cbebff30175","csi.storage.k8s.io/volumegroupsnapshot/name":"rbd-440-vgs-2","csi.storage.k8s.io/volumegroupsnapshot/namespace":"rbd-440","csi.storage.k8s.io/volumegroupsnapshotcontent/name":"groupsnapcontent-0161be0f-4e22-415b-86b1-2cc461097dad","pool":"replicapool"},"secrets":"***stripped***","source_volume_ids":["0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-d6750f44-22b1-48fc-95b7-844826ac7786","0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-034070d9-5d3c-40ac-ad88-f05f4cf1533c","0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-47f3b530-f56a-4448-83f5-21fa288d2191"]}
  I1122 15:23:40.416664       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.d6750f44-22b1-48fc-95b7-844826ac7786"): map[csi.imageid:20e05f3dce9c csi.imagename:csi-vol-d6750f44-22b1-48fc-95b7-844826ac7786 csi.volname:pvc-dcfe2c65-7ec8-4521-ac22-fa7b51edcc86 csi.volume.owner:rbd-440]
  I1122 15:23:40.431087       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.034070d9-5d3c-40ac-ad88-f05f4cf1533c"): map[csi.imageid:20e0d6bd720f csi.imagename:csi-vol-034070d9-5d3c-40ac-ad88-f05f4cf1533c csi.volname:pvc-0de4c55a-d93a-43bd-ac7f-0efd811d8ba1 csi.volume.owner:rbd-440]
  I1122 15:23:40.449701       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.47f3b530-f56a-4448-83f5-21fa288d2191"): map[csi.imageid:20e0f8e48bee csi.imagename:csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191 csi.volname:pvc-3d33aaf6-9b85-4fa9-a662-a46910567eb9 csi.volume.owner:rbd-440]
  I1122 15:23:40.466265       1 group_controllerserver.go:113] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad all 3 Volumes for VolumeGroup "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad" have been found
  I1122 15:23:40.467251       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.groups.default"): map[]
  I1122 15:23:40.467268       1 manager.go:145] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad the journal does not contain a reservation for group "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad" yet
  I1122 15:23:40.473385       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.groups.default"): map[csi.volume.group.groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad:3d319d05-5296-435d-b0df-6912a5ac76f6])
  I1122 15:23:40.476352       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[csi.creationtime:2024-11-22T15:23:40.47340155Z csi.groupname:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad])
  I1122 15:23:40.476375       1 manager.go:153] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got UUID "3d319d05-5296-435d-b0df-6912a5ac76f6" for group "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad"
  I1122 15:23:40.476522       1 util.go:102] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad object for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6" has been initialized
  I1122 15:23:40.477167       1 omap.go:221] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[csi.creationtime:2024-11-22T15:23:40.47340155Z csi.groupname:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad]
  I1122 15:23:40.477195       1 group_snapshot.go:108] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GetVolumeGroupSnapshot(0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6) returns {commonVolumeGroup:{id:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6 requestName:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad name:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 creationTime:0xc000a62198 clusterID:28e82505-e50e-4f6a-985a-3cbebff30175 objectUUID:3d319d05-5296-435d-b0df-6912a5ac76f6 credentials:0xc000692a40 conn:<nil> ioctx:<nil> monitors:rook-ceph-mon-a.rook-ceph.svc.cluster.local:6789 pool:replicapool namespace: csiDriver:default journal:0xc000a54520} snapshots:[] snapshotsToFree:[]}
  I1122 15:23:40.477215       1 group_controllerserver.go:129] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad need to create new volume group snapshot, failed to get existing one with name "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad": volume group snapshot "replicapool/csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6" is incomplete, it has no snapshots
  I1122 15:23:40.492155       1 controllerserver.go:607] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad snapshots count 3 on image: replicapool/csi-vol-d6750f44-22b1-48fc-95b7-844826ac7786 reached configured soft limit 2
  I1122 15:23:40.563050       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0c6470c9d_20e0d35cb849"
  E1122 15:23:40.571082       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0c6470c9d_20e0d35cb849 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  E1122 15:23:40.571112       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0c6470c9d_20e0d35cb849; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  I1122 15:23:40.571120       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0f011195a_20e0aac19c38"
  E1122 15:23:40.579420       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0f011195a_20e0aac19c38 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  E1122 15:23:40.579441       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0f011195a_20e0aac19c38; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  I1122 15:23:40.614821       1 controllerserver.go:607] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad snapshots count 3 on image: replicapool/csi-vol-034070d9-5d3c-40ac-ad88-f05f4cf1533c reached configured soft limit 2
  I1122 15:23:40.684930       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0c6470c9d_20e0d35cb849"
  E1122 15:23:40.692883       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0c6470c9d_20e0d35cb849 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  E1122 15:23:40.692911       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0c6470c9d_20e0d35cb849; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  I1122 15:23:40.692931       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0f011195a_20e0aac19c38"
  E1122 15:23:40.700086       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0f011195a_20e0aac19c38 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  E1122 15:23:40.700120       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0f011195a_20e0aac19c38; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  I1122 15:23:40.732723       1 controllerserver.go:607] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad snapshots count 3 on image: replicapool/csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191 reached configured soft limit 2
  I1122 15:23:40.798206       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0c6470c9d_20e0d35cb849"
  E1122 15:23:40.805758       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0c6470c9d_20e0d35cb849 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  E1122 15:23:40.805806       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0c6470c9d_20e0d35cb849; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0c6470c9d_20e0d35cb849 does not exist)"
  I1122 15:23:40.805815       1 rbd_util.go:864] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad rbd: adding task to flatten image "replicapool/.group.4_20e0f011195a_20e0aac19c38"
  E1122 15:23:40.815129       1 rbd_util.go:880] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to add task flatten for replicapool/.group.4_20e0f011195a_20e0aac19c38 : rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  E1122 15:23:40.815158       1 rbd_util.go:828] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad failed to flatten replicapool/.group.4_20e0f011195a_20e0aac19c38; err rados: ret=-2, No such file or directory: "[errno 2] RBD image not found (Image replicapool/.group.4_20e0f011195a_20e0aac19c38 does not exist)"
  I1122 15:23:40.833364       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.groups.default"): map[]
  I1122 15:23:40.833389       1 manager.go:273] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad the journal does not contain a reservation for a volume group with name "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg" yet
  I1122 15:23:40.840848       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.groups.default"): map[csi.volume.group.groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg:48126353-ded5-4290-a9dd-05b49c176d94])
  I1122 15:23:40.843649       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): map[csi.creationtime:2024-11-22T15:23:40.840868746Z csi.groupname:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg])
  I1122 15:23:40.843814       1 util.go:102] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad object for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94" has been initialized
  I1122 15:23:40.845069       1 omap.go:221] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): map[csi.creationtime:2024-11-22T15:23:40.840868746Z csi.groupname:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg]
  I1122 15:23:40.845102       1 volume_group.go:110] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GetVolumeGroup(0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94) returns {commonVolumeGroup:{id:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94 requestName:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg name:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94 creationTime:0xc000c04498 clusterID:28e82505-e50e-4f6a-985a-3cbebff30175 objectUUID:48126353-ded5-4290-a9dd-05b49c176d94 credentials:0xc000692a40 conn:<nil> ioctx:<nil> monitors:rook-ceph-mon-a.rook-ceph.svc.cluster.local:6789 pool:replicapool namespace: csiDriver:default journal:0xc000afee60} volumes:[] volumesToFree:[]}
  I1122 15:23:40.845162       1 util.go:225] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad connection established for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94"
  I1122 15:23:40.845172       1 util.go:276] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad iocontext created for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94" in pool "replicapool"
  I1122 15:23:40.851776       1 volume_group.go:178] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad volume group "replicapool/csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94" has been created
  I1122 15:23:40.851795       1 group_controllerserver.go:155] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad VolumeGroup "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad-vg" has been created: replicapool/csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94
  I1122 15:23:40.879789       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): map[0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-d6750f44-22b1-48fc-95b7-844826ac7786:])
  I1122 15:23:40.909155       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): map[0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-034070d9-5d3c-40ac-ad88-f05f4cf1533c:])
  I1122 15:23:40.945462       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): map[0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-47f3b530-f56a-4448-83f5-21fa288d2191:])
  I1122 15:23:40.946814       1 omap.go:89] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.groups.default"): map[csi.volume.group.groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad:3d319d05-5296-435d-b0df-6912a5ac76f6]
  I1122 15:23:40.947674       1 omap.go:221] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[csi.creationtime:2024-11-22T15:23:40.47340155Z csi.groupname:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad]
  I1122 15:23:40.947699       1 manager.go:153] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got UUID "3d319d05-5296-435d-b0df-6912a5ac76f6" for group "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad"
  I1122 15:23:40.947854       1 util.go:102] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad object for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6" has been initialized
  I1122 15:23:40.949175       1 omap.go:221] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[csi.creationtime:2024-11-22T15:23:40.47340155Z csi.groupname:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad]
  I1122 15:23:40.949201       1 group_snapshot.go:108] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GetVolumeGroupSnapshot(0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6) returns {commonVolumeGroup:{id:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6 requestName:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad name:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 creationTime:0xc000c04648 clusterID:28e82505-e50e-4f6a-985a-3cbebff30175 objectUUID:3d319d05-5296-435d-b0df-6912a5ac76f6 credentials:0xc000692a40 conn:<nil> ioctx:<nil> monitors:rook-ceph-mon-a.rook-ceph.svc.cluster.local:6789 pool:replicapool namespace: csiDriver:default journal:0xc000aff710} snapshots:[] snapshotsToFree:[]}
  I1122 15:23:40.949211       1 manager.go:450] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad found existing volume group snapshot "replicapool/csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6" for id "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6"
  I1122 15:23:41.686404       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snaps.default"): map[csi.snap.csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-0:04bb9240-d641-47a1-af82-311f0530c8e0])
  I1122 15:23:41.689649       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.04bb9240-d641-47a1-af82-311f0530c8e0"): map[csi.imagename:csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0 csi.snapname:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-0 csi.source:csi-vol-d6750f44-22b1-48fc-95b7-844826ac7786 csi.volume.owner:rbd-440])
  I1122 15:23:41.689679       1 rbd_journal.go:441] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad generated Volume ID (0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-04bb9240-d641-47a1-af82-311f0530c8e0) and image name (csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0) for request name (csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-0)
  I1122 15:23:41.689695       1 rbd_util.go:1641] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad setting image options on replicapool/csi-vol-d6750f44-22b1-48fc-95b7-844826ac7786
  I1122 15:23:41.689708       1 snapshot.go:258] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad going to clone snapshot image "replicapool/csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0@csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0" from image "replicapool/csi-vol-d6750f44-22b1-48fc-95b7-844826ac7786" with snapshot ID 127
  I1122 15:23:42.708388       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.04bb9240-d641-47a1-af82-311f0530c8e0"): map[csi.imageid:20e067e511e3])
  I1122 15:23:42.721130       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snaps.default"): map[csi.snap.csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-1:b400bd18-094e-49e7-bc57-c8e0fc329163])
  I1122 15:23:42.723634       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.b400bd18-094e-49e7-bc57-c8e0fc329163"): map[csi.imagename:csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163 csi.snapname:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-1 csi.source:csi-vol-034070d9-5d3c-40ac-ad88-f05f4cf1533c csi.volume.owner:rbd-440])
  I1122 15:23:42.723657       1 rbd_journal.go:441] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad generated Volume ID (0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-b400bd18-094e-49e7-bc57-c8e0fc329163) and image name (csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163) for request name (csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-1)
  I1122 15:23:42.723692       1 rbd_util.go:1641] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad setting image options on replicapool/csi-vol-034070d9-5d3c-40ac-ad88-f05f4cf1533c
  I1122 15:23:42.723705       1 snapshot.go:258] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad going to clone snapshot image "replicapool/csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163@csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163" from image "replicapool/csi-vol-034070d9-5d3c-40ac-ad88-f05f4cf1533c" with snapshot ID 128
  I1122 15:23:43.715960       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.b400bd18-094e-49e7-bc57-c8e0fc329163"): map[csi.imageid:20e0ff79fb0b])
  I1122 15:23:43.727045       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snaps.default"): map[csi.snap.csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-2:9d261f5b-3a30-4194-a120-71d8a6c622cd])
  I1122 15:23:43.730552       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.9d261f5b-3a30-4194-a120-71d8a6c622cd"): map[csi.imagename:csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd csi.snapname:csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-2 csi.source:csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191 csi.volume.owner:rbd-440])
  I1122 15:23:43.730576       1 rbd_journal.go:441] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad generated Volume ID (0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-9d261f5b-3a30-4194-a120-71d8a6c622cd) and image name (csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd) for request name (csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94-snap-2)
  I1122 15:23:43.730605       1 rbd_util.go:1641] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad setting image options on replicapool/csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191
  I1122 15:23:43.730634       1 snapshot.go:258] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad going to clone snapshot image "replicapool/csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd@csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd" from image "replicapool/csi-vol-47f3b530-f56a-4448-83f5-21fa288d2191" with snapshot ID 129
  I1122 15:23:44.742115       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.9d261f5b-3a30-4194-a120-71d8a6c622cd"): map[csi.imageid:20e025a7c4e4])
  I1122 15:23:44.786169       1 manager.go:495] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad volume group snapshot "groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad" contains 3 snapshots: [replicapool/csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0@csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0 replicapool/csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163@csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163 replicapool/csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd@csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd]
  I1122 15:23:44.786316       1 util.go:102] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad object for volume group "0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6" has been initialized
  I1122 15:23:44.787261       1 omap.go:221] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad got omap values: (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[csi.creationtime:2024-11-22T15:23:40.47340155Z csi.groupname:csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6 csi.volname:groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad]
  I1122 15:23:44.790673       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.04bb9240-d641-47a1-af82-311f0530c8e0"): map[csi.groupid:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6])
  I1122 15:23:44.793362       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.b400bd18-094e-49e7-bc57-c8e0fc329163"): map[csi.groupid:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6])
  I1122 15:23:44.796019       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.snap.9d261f5b-3a30-4194-a120-71d8a6c622cd"): map[csi.groupid:0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6])
  I1122 15:23:44.799136       1 omap.go:159] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad set omap keys (pool="replicapool", namespace="", name="csi.volume.group.3d319d05-5296-435d-b0df-6912a5ac76f6"): map[0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-04bb9240-d641-47a1-af82-311f0530c8e0:csi-snap-04bb9240-d641-47a1-af82-311f0530c8e0 0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-9d261f5b-3a30-4194-a120-71d8a6c622cd:csi-snap-9d261f5b-3a30-4194-a120-71d8a6c622cd 0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-b400bd18-094e-49e7-bc57-c8e0fc329163:csi-snap-b400bd18-094e-49e7-bc57-c8e0fc329163])
  I1122 15:23:44.799164       1 manager.go:502] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad volume group snapshot "replicapool/csi-vol-group-3d319d05-5296-435d-b0df-6912a5ac76f6" has been created
  I1122 15:23:44.812476       1 omap.go:126] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad removed omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): [0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-d6750f44-22b1-48fc-95b7-844826ac7786]
  I1122 15:23:44.826209       1 omap.go:126] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad removed omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): [0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-034070d9-5d3c-40ac-ad88-f05f4cf1533c]
  I1122 15:23:44.840641       1 omap.go:126] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad removed omap keys (pool="replicapool", namespace="", name="csi.volume.group.48126353-ded5-4290-a9dd-05b49c176d94"): [0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-47f3b530-f56a-4448-83f5-21fa288d2191]
  I1122 15:23:44.840671       1 group_controllerserver.go:88] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad removing temporary volume group "replicapool/csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94"
  I1122 15:23:44.847434       1 volume_group.go:199] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad volume group "replicapool/csi-vol-group-48126353-ded5-4290-a9dd-05b49c176d94" has been removed
  I1122 15:23:44.854464       1 omap.go:126] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad removed omap keys (pool="replicapool", namespace="", name="csi.groups.default"): [csi.volume.group.0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-48126353-ded5-4290-a9dd-05b49c176d94]
  I1122 15:23:44.854626       1 utils.go:273] ID: 45 Req-ID: groupsnapshot-0161be0f-4e22-415b-86b1-2cc461097dad GRPC response: {"group_snapshot":{"creation_time":{"nanos":473401550,"seconds":1732289020},"group_snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6","ready_to_use":true,"snapshots":[{"creation_time":{"nanos":856372830,"seconds":1732288987},"group_snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6","ready_to_use":true,"size_bytes":1073741824,"snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-04bb9240-d641-47a1-af82-311f0530c8e0","source_volume_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-d6750f44-22b1-48fc-95b7-844826ac7786"},{"creation_time":{"nanos":880861876,"seconds":1732288989},"group_snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6","ready_to_use":true,"size_bytes":1073741824,"snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-b400bd18-094e-49e7-bc57-c8e0fc329163","source_volume_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-034070d9-5d3c-40ac-ad88-f05f4cf1533c"},{"creation_time":{"nanos":897539906,"seconds":1732288991},"group_snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-3d319d05-5296-435d-b0df-6912a5ac76f6","ready_to_use":true,"size_bytes":1073741824,"snapshot_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-9d261f5b-3a30-4194-a120-71d8a6c622cd","source_volume_id":"0001-0024-28e82505-e50e-4f6a-985a-3cbebff30175-0000000000000004-47f3b530-f56a-4448-83f5-21fa288d2191"}]}}

e2e run: https://jenkins-ceph-csi.apps.ocp.cloud.ci.centos.org/blue/organizations/jenkins/mini-e2e-helm_k8s-1.31/detail/mini-e2e-helm_k8s-1.31/193/pipeline/

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch 3 times, most recently from 4c35c58 to 8882254 Compare November 25, 2024 07:54
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from 8882254 to 43cf95f Compare November 25, 2024 09:41
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from 43cf95f to 5edecc9 Compare November 25, 2024 12:16
@Rakshith-R
Copy link
Contributor Author

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

1 similar comment
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from b41a344 to 94b9f0b Compare December 3, 2024 10:00
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from 94b9f0b to 771763a Compare December 3, 2024 10:26
@Rakshith-R Rakshith-R changed the title [WIP][Testing]Flatten group snapshot RBD: Flatten group snapshot & add rbdSnap.Delete Dec 3, 2024
@Rakshith-R Rakshith-R marked this pull request as ready for review December 3, 2024 10:31
@Rakshith-R
Copy link
Contributor Author

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

@Rakshith-R Rakshith-R removed WIP This PR still in work-in-progress ci/skip/multi-arch-build skip building on multiple architectures labels Dec 3, 2024
Copy link
Contributor

@iPraveenParihar iPraveenParihar left a comment

Choose a reason for hiding this comment

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

LGTM!

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from c366113 to 9c17a49 Compare December 12, 2024 07:08
@mergify mergify bot dismissed iPraveenParihar’s stale review December 12, 2024 07:08

Pull request has been modified.

Comment on lines 630 to +636
// If we start flattening all the snapshots at one shot the volume
// creation time will be affected,so we will flatten only the extra
// snapshots.
snaps = snaps[minSnapshotsOnImageToStartFlatten-1:]
// snapshots. Use the min of the extra snapshots and the number of children
// to avoid scenario where number of children are less than the extra snapshots.
// This occurs when the child images are in trash and not yet deleted.
extraSnapshots := min((len(snaps) - int(minSnapshotsOnImageToStartFlatten)), len(children))
children = children[:extraSnapshots]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The recent changes addresses this edge case @iPraveenParihar pointed out.
Added comments to better explain the scenario as well.

Copy link
Collaborator

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

some nits.

@@ -456,6 +456,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap
return fmt.Errorf("failed to create volume group snapshot: %w", err)
}

// Create and delete 5 additional group snapshots to test flattening on minSnapshotLimit
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a generic base for both cephfs and rbd, IMO this either needs a separate case or needs adjusted where cephfs is not impacted because of this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed rbd specific comment.
I think creation & deletion of multiple volgroupsnap serves a good default test case for cephfs too.

creds, err := util.NewUserCredentials(req.GetSecrets())
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

defer cr.DeleteCredentials() is missing here?

@@ -58,6 +58,10 @@ type Volume interface {
// if the parent image is in trash, it returns an error.
// if the parent image exists and is not enabled for mirroring, it returns an error.
HandleParentImageExistence(ctx context.Context, flattenMode FlattenMode) error
// PrepareVolumeForSnapshot prepares the volume for snapshot by
// checking snapshots limit and clone depth limit and flattening it
Copy link
Collaborator

Choose a reason for hiding this comment

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

flattening to flatten

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from 9c17a49 to ff3d339 Compare December 12, 2024 09:28
@mergify mergify bot dismissed iPraveenParihar’s stale review December 12, 2024 09:29

Pull request has been modified.

@@ -456,6 +456,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap
return fmt.Errorf("failed to create volume group snapshot: %w", err)
}

// Create and delete 5 additional group snapshots.
for i := range 5 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should have this as a configurable value in the base structure and set it only for RBD so that we don't run the test when it is not required.

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from ff3d339 to 095ccca Compare December 16, 2024 11:35
@Rakshith-R Rakshith-R requested a review from Madhu-1 December 16, 2024 11:35
@mergify mergify bot dismissed iPraveenParihar’s stale review December 16, 2024 11:35

Pull request has been modified.

Copy link
Collaborator

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

nit.

storageClassName string
blockPVC bool
totalPVCCount int
additionalSnapshotCount int
Copy link
Collaborator

Choose a reason for hiding this comment

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

additionalSnapshotCount to additionalVolumeGroupSnapshotCount or additionalVGSnapshotCount.

@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from 095ccca to aca7c22 Compare December 16, 2024 11:44
@Rakshith-R Rakshith-R requested a review from Madhu-1 December 16, 2024 11:44
Madhu-1
Madhu-1 previously approved these changes Dec 16, 2024
@iPraveenParihar
Copy link
Contributor

LGTM!, @Rakshith-R, can you please address the golangci-lint failure?

This commit consolidates flatten logic checks for cloneDepth
and snapshotLimit in PrepareVolumeForSnapshot. This allows
the function to be called for both CreateSnapshot and
CreateVolumeGroupSnapshot.
Clone Depth check and flattening of grand parent image
now occurs before creation of snapshot starts.
This aligns better with how PVC-PVC clone and
PVC-restore process occurs currently.
Flattening the grandparent image once prevents
flattening of every newly created snapshot.
Snapshot in above para refers to k8s VolumeSnapshot
(which is backed by a rbd image).

Signed-off-by: Rakshith R <[email protected]>
Currently, CephCSI only uses listSnaps to determine
number of snapshots on a RBD image and uses snapshot
names as child image names to flatten them.
But child images may have different name(in case of
group snapshot) or they maybe in trash
(deleted k8s VolSnapshot with alive restored PVC).

The above problems are avoid by making use of both
snap and child image lists.

Signed-off-by: Rakshith R <[email protected]>
This commit modifies code to pass volumeGroupSnapshotterBase
by pointer to address the following linter error.
```
hugeParam: v is heavy (80 bytes); consider passing it by pointer (gocritic)
func (v volumeGroupSnapshotterBase) CreateVolumeGroupSnapshotClass(
```

Signed-off-by: Rakshith R <[email protected]>
@Rakshith-R Rakshith-R force-pushed the flatten-group-snapshot branch from aca7c22 to c420bf5 Compare December 16, 2024 14:53
@mergify mergify bot dismissed Madhu-1’s stale review December 16, 2024 14:54

Pull request has been modified.

@Rakshith-R
Copy link
Contributor Author

its fixed now,
please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants