From 5ecfa0660f8c547ec8e769bed0e02cc8827efe9f Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 5 Feb 2024 09:44:58 +0100 Subject: [PATCH] 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 --- internal/csi-common/utils.go | 7 +++++++ internal/csi-common/utils_test.go | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/internal/csi-common/utils.go b/internal/csi-common/utils.go index aead6d64e..daf6170ee 100644 --- a/internal/csi-common/utils.go +++ b/internal/csi-common/utils.go @@ -145,6 +145,13 @@ func getReqID(req interface{}) string { case *csi.NodeExpandVolumeRequest: reqID = r.VolumeId + + case *csi.CreateVolumeGroupSnapshotRequest: + reqID = r.Name + case *csi.DeleteVolumeGroupSnapshotRequest: + reqID = r.GroupSnapshotId + case *csi.GetVolumeGroupSnapshotRequest: + reqID = r.GroupSnapshotId } return reqID diff --git a/internal/csi-common/utils_test.go b/internal/csi-common/utils_test.go index e5687986a..ddb16648a 100644 --- a/internal/csi-common/utils_test.go +++ b/internal/csi-common/utils_test.go @@ -65,6 +65,16 @@ func TestGetReqID(t *testing.T) { &csi.NodeExpandVolumeRequest{ VolumeId: fakeID, }, + + &csi.CreateVolumeGroupSnapshotRequest{ + Name: fakeID, + }, + &csi.DeleteVolumeGroupSnapshotRequest{ + GroupSnapshotId: fakeID, + }, + &csi.GetVolumeGroupSnapshotRequest{ + GroupSnapshotId: fakeID, + }, } for _, r := range req { if got := getReqID(r); got != fakeID {