@@ -59,6 +59,8 @@ type DriverOptions struct {
59
59
EnableDiskOnlineResize bool
60
60
AllowEmptyCloudConfig bool
61
61
EnableAsyncAttach bool
62
+ EnableListVolumes bool
63
+ EnableListSnapshots bool
62
64
}
63
65
64
66
// CSIDriver defines the interface for a CSI driver.
@@ -93,6 +95,8 @@ type DriverCore struct {
93
95
enableDiskOnlineResize bool
94
96
allowEmptyCloudConfig bool
95
97
enableAsyncAttach bool
98
+ enableListVolumes bool
99
+ enableListSnapshots bool
96
100
}
97
101
98
102
// Driver is the v1 implementation of the Azure Disk CSI Driver.
@@ -120,6 +124,8 @@ func newDriverV1(options *DriverOptions) *Driver {
120
124
driver .enableDiskOnlineResize = options .EnableDiskOnlineResize
121
125
driver .allowEmptyCloudConfig = options .AllowEmptyCloudConfig
122
126
driver .enableAsyncAttach = options .EnableAsyncAttach
127
+ driver .enableListVolumes = options .EnableListVolumes
128
+ driver .enableListSnapshots = options .EnableListVolumes
123
129
driver .volumeLocks = volumehelper .NewVolumeLocks ()
124
130
driver .ioHandler = azureutils .NewOSIOHandler ()
125
131
driver .hostUtil = hostutil .NewHostUtil ()
@@ -184,18 +190,22 @@ func (d *Driver) Run(endpoint, kubeconfig string, disableAVSetNodes, testingMock
184
190
klog .Fatalf ("Failed to get safe mounter. Error: %v" , err )
185
191
}
186
192
187
- d .AddControllerServiceCapabilities (
188
- []csi.ControllerServiceCapability_RPC_Type {
189
- csi .ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME ,
190
- csi .ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME ,
191
- csi .ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT ,
192
- csi .ControllerServiceCapability_RPC_LIST_SNAPSHOTS ,
193
- csi .ControllerServiceCapability_RPC_CLONE_VOLUME ,
194
- csi .ControllerServiceCapability_RPC_EXPAND_VOLUME ,
195
- csi .ControllerServiceCapability_RPC_LIST_VOLUMES ,
196
- csi .ControllerServiceCapability_RPC_LIST_VOLUMES_PUBLISHED_NODES ,
197
- csi .ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER ,
198
- })
193
+ controllerCap := []csi.ControllerServiceCapability_RPC_Type {
194
+ csi .ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME ,
195
+ csi .ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME ,
196
+ csi .ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT ,
197
+ csi .ControllerServiceCapability_RPC_CLONE_VOLUME ,
198
+ csi .ControllerServiceCapability_RPC_EXPAND_VOLUME ,
199
+ csi .ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER ,
200
+ }
201
+ if d .enableListVolumes {
202
+ controllerCap = append (controllerCap , csi .ControllerServiceCapability_RPC_LIST_VOLUMES , csi .ControllerServiceCapability_RPC_LIST_VOLUMES_PUBLISHED_NODES )
203
+ }
204
+ if d .enableListSnapshots {
205
+ controllerCap = append (controllerCap , csi .ControllerServiceCapability_RPC_LIST_SNAPSHOTS )
206
+ }
207
+
208
+ d .AddControllerServiceCapabilities (controllerCap )
199
209
d .AddVolumeCapabilityAccessModes (
200
210
[]csi.VolumeCapability_AccessMode_Mode {
201
211
csi .VolumeCapability_AccessMode_SINGLE_NODE_WRITER ,
@@ -256,7 +266,7 @@ func (d *Driver) checkDiskExists(ctx context.Context, diskURI string) (*compute.
256
266
257
267
func (d * Driver ) checkDiskCapacity (ctx context.Context , subsID , resourceGroup , diskName string , requestGiB int ) (bool , error ) {
258
268
if d .isGetDiskThrottled () {
259
- klog .Warningf ("skip checkDiskCapacity(( %s, %s) since it's still in throttling" , resourceGroup , diskName )
269
+ klog .Warningf ("skip checkDiskCapacity(%s, %s) since it's still in throttling" , resourceGroup , diskName )
260
270
return true , nil
261
271
}
262
272
0 commit comments