util: add groupSnapshot details to getReqID

added CreateVolumeGroupSnapshotRequest and
DeleteVolumeGroupSnapshotRequest to the
getReqID so that we can get the ReqID for
the logging.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2024-02-05 09:44:58 +01:00 committed by mergify[bot]
parent 12bd269d5b
commit 5ecfa0660f
2 changed files with 17 additions and 0 deletions

View File

@ -145,6 +145,13 @@ func getReqID(req interface{}) string {
case *csi.NodeExpandVolumeRequest: case *csi.NodeExpandVolumeRequest:
reqID = r.VolumeId reqID = r.VolumeId
case *csi.CreateVolumeGroupSnapshotRequest:
reqID = r.Name
case *csi.DeleteVolumeGroupSnapshotRequest:
reqID = r.GroupSnapshotId
case *csi.GetVolumeGroupSnapshotRequest:
reqID = r.GroupSnapshotId
} }
return reqID return reqID

View File

@ -65,6 +65,16 @@ func TestGetReqID(t *testing.T) {
&csi.NodeExpandVolumeRequest{ &csi.NodeExpandVolumeRequest{
VolumeId: fakeID, VolumeId: fakeID,
}, },
&csi.CreateVolumeGroupSnapshotRequest{
Name: fakeID,
},
&csi.DeleteVolumeGroupSnapshotRequest{
GroupSnapshotId: fakeID,
},
&csi.GetVolumeGroupSnapshotRequest{
GroupSnapshotId: fakeID,
},
} }
for _, r := range req { for _, r := range req {
if got := getReqID(r); got != fakeID { if got := getReqID(r); got != fakeID {