mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-12 17:30:19 +00:00
util: log repication RequestID
currently we are not logging the RequestID
for the replication RPC calls. This PR
adds the replication case to the getReqID
function.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 4e296bf65e
)
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
8e09311cdf
commit
2a52096ad0
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
|
"github.com/csi-addons/spec/lib/go/replication"
|
||||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||||
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
|
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -133,6 +134,20 @@ func getReqID(req interface{}) string {
|
|||||||
|
|
||||||
case *csi.NodeExpandVolumeRequest:
|
case *csi.NodeExpandVolumeRequest:
|
||||||
reqID = r.VolumeId
|
reqID = r.VolumeId
|
||||||
|
|
||||||
|
// Replication
|
||||||
|
case *replication.EnableVolumeReplicationRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
|
case *replication.DisableVolumeReplicationRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
|
case *replication.PromoteVolumeRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
|
case *replication.DemoteVolumeRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
|
case *replication.ResyncVolumeRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
|
case *replication.GetVolumeReplicationInfoRequest:
|
||||||
|
reqID = r.VolumeId
|
||||||
}
|
}
|
||||||
|
|
||||||
return reqID
|
return reqID
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
|
"github.com/csi-addons/spec/lib/go/replication"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
mount "k8s.io/mount-utils"
|
mount "k8s.io/mount-utils"
|
||||||
@ -65,6 +66,25 @@ func TestGetReqID(t *testing.T) {
|
|||||||
&csi.NodeExpandVolumeRequest{
|
&csi.NodeExpandVolumeRequest{
|
||||||
VolumeId: fakeID,
|
VolumeId: fakeID,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
&replication.EnableVolumeReplicationRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
|
&replication.DisableVolumeReplicationRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
|
&replication.PromoteVolumeRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
|
&replication.DemoteVolumeRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
|
&replication.ResyncVolumeRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
|
&replication.GetVolumeReplicationInfoRequest{
|
||||||
|
VolumeId: fakeID,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, r := range req {
|
for _, r := range req {
|
||||||
if got := getReqID(r); got != fakeID {
|
if got := getReqID(r); got != fakeID {
|
||||||
|
Loading…
Reference in New Issue
Block a user