@@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"errors"
22
22
"fmt"
23
+ "google.golang.org/protobuf/encoding/prototext"
23
24
"net/http"
24
25
"os"
25
26
"path/filepath"
@@ -79,6 +80,7 @@ type controller struct {
79
80
authMgr common.AuthorizationService
80
81
authMgrs map [string ]* common.AuthManager
81
82
topologyMgr commoncotypes.ControllerTopologyService
83
+ csi.UnimplementedControllerServer
82
84
}
83
85
84
86
var (
@@ -1958,7 +1960,7 @@ func (c *controller) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequ
1958
1960
volumeType := prometheus .PrometheusUnknownVolumeType
1959
1961
createVolumeInternal := func () (
1960
1962
* csi.CreateVolumeResponse , string , error ) {
1961
- log .Infof ("CreateVolume: called with args %+v" , * req )
1963
+ log .Infof ("CreateVolume: called with args %+v" , prototext . Format ( req ) )
1962
1964
// TODO: If the err is returned by invoking CNS API, then faultType should be
1963
1965
// populated by the underlying layer.
1964
1966
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
@@ -2051,7 +2053,7 @@ func (c *controller) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequ
2051
2053
2052
2054
deleteVolumeInternal := func () (
2053
2055
* csi.DeleteVolumeResponse , string , error ) {
2054
- log .Infof ("DeleteVolume: called with args: %+v" , * req )
2056
+ log .Infof ("DeleteVolume: called with args: %+v" , prototext . Format ( req ) )
2055
2057
// TODO: If the err is returned by invoking CNS API, then faultType should be
2056
2058
// populated by the underlying layer.
2057
2059
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
@@ -2194,7 +2196,7 @@ func (c *controller) ControllerPublishVolume(ctx context.Context, req *csi.Contr
2194
2196
2195
2197
controllerPublishVolumeInternal := func () (
2196
2198
* csi.ControllerPublishVolumeResponse , string , error ) {
2197
- log .Infof ("ControllerPublishVolume: called with args %+v" , * req )
2199
+ log .Infof ("ControllerPublishVolume: called with args %+v" , prototext . Format ( req ) )
2198
2200
// TODO: If the err is returned by invoking CNS API, then faultType should be
2199
2201
// populated by the underlying layer.
2200
2202
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
@@ -2205,7 +2207,7 @@ func (c *controller) ControllerPublishVolume(ctx context.Context, req *csi.Contr
2205
2207
if err != nil {
2206
2208
2207
2209
return nil , csifault .CSIInvalidArgumentFault , logger .LogNewErrorCodef (log , codes .Internal ,
2208
- "validation for PublishVolume Request: %+v has failed. Error: %v" , * req , err )
2210
+ "validation for PublishVolume Request: %+v has failed. Error: %v" , prototext . Format ( req ) , err )
2209
2211
}
2210
2212
publishInfo := make (map [string ]string )
2211
2213
_ , volumeManager , err := getVCenterAndVolumeManagerForVolumeID (ctx , c , req .VolumeId , volumeInfoService )
@@ -2342,7 +2344,7 @@ func (c *controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con
2342
2344
controllerUnpublishVolumeInternal := func () (
2343
2345
* csi.ControllerUnpublishVolumeResponse , string , error ) {
2344
2346
var faultType string
2345
- log .Infof ("ControllerUnpublishVolume: called with args %+v" , * req )
2347
+ log .Infof ("ControllerUnpublishVolume: called with args %+v" , prototext . Format ( req ) )
2346
2348
// TODO: If the err is returned by invoking CNS API, then faultType should be
2347
2349
// populated by the underlying layer.
2348
2350
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
@@ -2352,7 +2354,7 @@ func (c *controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con
2352
2354
err := validateVanillaControllerUnpublishVolumeRequest (ctx , req )
2353
2355
if err != nil {
2354
2356
return nil , csifault .CSIInvalidArgumentFault , logger .LogNewErrorCodef (log , codes .Internal ,
2355
- "validation for UnpublishVolume Request: %+v has failed. Error: %v" , * req , err )
2357
+ "validation for UnpublishVolume Request: %+v has failed. Error: %v" , prototext . Format ( req ) , err )
2356
2358
}
2357
2359
2358
2360
_ , volumeManager , err := getVCenterAndVolumeManagerForVolumeID (ctx , c , req .VolumeId , volumeInfoService )
@@ -2485,7 +2487,7 @@ func (c *controller) ControllerExpandVolume(ctx context.Context, req *csi.Contro
2485
2487
faultType string
2486
2488
)
2487
2489
2488
- log .Infof ("ControllerExpandVolume: called with args %+v" , * req )
2490
+ log .Infof ("ControllerExpandVolume: called with args %+v" , prototext . Format ( req ) )
2489
2491
// TODO: If the err is returned by invoking CNS API, then faultType should be
2490
2492
// populated by the underlying layer.
2491
2493
// If the request failed due to validate the request, "csi.fault.InvalidArgument" will be return.
@@ -2522,7 +2524,8 @@ func (c *controller) ControllerExpandVolume(ctx context.Context, req *csi.Contro
2522
2524
isOnlineExpansionEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .OnlineVolumeExtend )
2523
2525
err = validateVanillaControllerExpandVolumeRequest (ctx , req , isOnlineExpansionEnabled , isOnlineExpansionSupported )
2524
2526
if err != nil {
2525
- msg := fmt .Sprintf ("validation for ExpandVolume Request: %+v has failed. Error: %v" , * req , err )
2527
+ msg := fmt .Sprintf ("validation for ExpandVolume Request: %+v has failed. Error: %v" ,
2528
+ prototext .Format (req ), err )
2526
2529
log .Error (msg )
2527
2530
return nil , csifault .CSIInternalFault , err
2528
2531
}
@@ -2607,7 +2610,7 @@ func (c *controller) ValidateVolumeCapabilities(ctx context.Context, req *csi.Va
2607
2610
* csi.ValidateVolumeCapabilitiesResponse , error ) {
2608
2611
ctx = logger .NewContextWithLogger (ctx )
2609
2612
log := logger .GetLogger (ctx )
2610
- log .Infof ("ControllerGetCapabilities: called with args %+v" , * req )
2613
+ log .Infof ("ControllerGetCapabilities: called with args %+v" , prototext . Format ( req ) )
2611
2614
volCaps := req .GetVolumeCapabilities ()
2612
2615
var confirmed * csi.ValidateVolumeCapabilitiesResponse_Confirmed
2613
2616
if err := common .IsValidVolumeCapabilities (ctx , volCaps ); err == nil {
@@ -2639,7 +2642,7 @@ func (c *controller) ListVolumes(ctx context.Context, req *csi.ListVolumesReques
2639
2642
}
2640
2643
2641
2644
listVolumesInternal := func () (* csi.ListVolumesResponse , string , error ) {
2642
- log .Debugf ("ListVolumes: called with args %+v" , * req )
2645
+ log .Debugf ("ListVolumes: called with args %+v" , prototext . Format ( req ) )
2643
2646
2644
2647
startingToken := 0
2645
2648
if req .StartingToken != "" {
@@ -2871,7 +2874,7 @@ func (c *controller) GetCapacity(ctx context.Context, req *csi.GetCapacityReques
2871
2874
* csi.GetCapacityResponse , error ) {
2872
2875
ctx = logger .NewContextWithLogger (ctx )
2873
2876
log := logger .GetLogger (ctx )
2874
- log .Infof ("GetCapacity: called with args %+v" , * req )
2877
+ log .Infof ("GetCapacity: called with args %+v" , prototext . Format ( req ) )
2875
2878
return nil , logger .LogNewErrorCode (log , codes .Unimplemented , "getCapacity" )
2876
2879
}
2877
2880
@@ -2915,7 +2918,7 @@ func (c *controller) ControllerGetCapabilities(ctx context.Context, req *csi.Con
2915
2918
* csi.ControllerGetCapabilitiesResponse , error ) {
2916
2919
ctx = logger .NewContextWithLogger (ctx )
2917
2920
log := logger .GetLogger (ctx )
2918
- log .Infof ("ControllerGetCapabilities: called with args %+v" , * req )
2921
+ log .Infof ("ControllerGetCapabilities: called with args %+v" , prototext . Format ( req ) )
2919
2922
2920
2923
controllerCaps := []csi.ControllerServiceCapability_RPC_Type {
2921
2924
csi .ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME ,
@@ -2956,7 +2959,7 @@ func (c *controller) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshot
2956
2959
granularMaxSnapshotsPerBlockVolumeInVSAN int
2957
2960
granularMaxSnapshotsPerBlockVolumeInVVOL int
2958
2961
)
2959
- log .Infof ("CreateSnapshot: called with args %+v" , * req )
2962
+ log .Infof ("CreateSnapshot: called with args %+v" , prototext . Format ( req ) )
2960
2963
2961
2964
isBlockVolumeSnapshotEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .BlockVolumeSnapshot )
2962
2965
if ! isBlockVolumeSnapshotEnabled {
@@ -2986,7 +2989,7 @@ func (c *controller) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshot
2986
2989
// Validate CreateSnapshotRequest
2987
2990
if err := validateVanillaCreateSnapshotRequestRequest (ctx , req ); err != nil {
2988
2991
return nil , logger .LogNewErrorCodef (log , codes .Internal ,
2989
- "validation for CreateSnapshot Request: %+v has failed. Error: %v" , * req , err )
2992
+ "validation for CreateSnapshot Request: %+v has failed. Error: %v" , prototext . Format ( req ) , err )
2990
2993
}
2991
2994
2992
2995
// Check if the source volume is migrated vSphere volume
@@ -3117,7 +3120,7 @@ func (c *controller) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshot
3117
3120
volumeManager cnsvolume.Manager
3118
3121
err error
3119
3122
)
3120
- log .Infof ("DeleteSnapshot: called with args %+v" , * req )
3123
+ log .Infof ("DeleteSnapshot: called with args %+v" , prototext . Format ( req ) )
3121
3124
3122
3125
isBlockVolumeSnapshotEnabled :=
3123
3126
commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .BlockVolumeSnapshot )
@@ -3193,7 +3196,7 @@ func (c *controller) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRe
3193
3196
nextToken string
3194
3197
err error
3195
3198
)
3196
- log .Infof ("ListSnapshots: called with args %+v" , * req )
3199
+ log .Infof ("ListSnapshots: called with args %+v" , prototext . Format ( req ) )
3197
3200
err = validateVanillaListSnapshotRequest (ctx , req )
3198
3201
if err != nil {
3199
3202
return nil , err
@@ -3468,14 +3471,14 @@ func (c *controller) ControllerGetVolume(ctx context.Context, req *csi.Controlle
3468
3471
* csi.ControllerGetVolumeResponse , error ) {
3469
3472
ctx = logger .NewContextWithLogger (ctx )
3470
3473
log := logger .GetLogger (ctx )
3471
- log .Infof ("ControllerGetVolume: called with args %+v" , * req )
3474
+ log .Infof ("ControllerGetVolume: called with args %+v" , prototext . Format ( req ) )
3472
3475
return nil , logger .LogNewErrorCode (log , codes .Unimplemented , "controllerGetVolume" )
3473
3476
}
3474
3477
3475
3478
func (c * controller ) ControllerModifyVolume (ctx context.Context , req * csi.ControllerModifyVolumeRequest ) (
3476
3479
* csi.ControllerModifyVolumeResponse , error ) {
3477
3480
ctx = logger .NewContextWithLogger (ctx )
3478
3481
log := logger .GetLogger (ctx )
3479
- log .Infof ("ControllerModifyVolume: called with args %+v" , * req )
3482
+ log .Infof ("ControllerModifyVolume: called with args %+v" , prototext . Format ( req ) )
3480
3483
return nil , logger .LogNewErrorCode (log , codes .Unimplemented , "ControllerModifyVolume" )
3481
3484
}
0 commit comments