File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,33 @@ func GetControllerCapabilities(ctx context.Context, conn *grpc.ClientConn) (Cont
104
104
return caps , nil
105
105
}
106
106
107
+ // GroupControllerCapabilitySet is set of CSI groupcontroller capabilities. Only supported capabilities are in the map.
108
+ type GroupControllerCapabilitySet map [csi.GroupControllerServiceCapability_RPC_Type ]bool
109
+
110
+ // GetGroupControllerCapabilities returns set of supported group controller capabilities of CSI driver.
111
+ func GetGroupControllerCapabilities (ctx context.Context , conn * grpc.ClientConn ) (GroupControllerCapabilitySet , error ) {
112
+ client := csi .NewGroupControllerClient (conn )
113
+ req := csi.GroupControllerGetCapabilitiesRequest {}
114
+ rsp , err := client .GroupControllerGetCapabilities (ctx , & req )
115
+ if err != nil {
116
+ return nil , err
117
+ }
118
+
119
+ caps := GroupControllerCapabilitySet {}
120
+ for _ , cap := range rsp .GetCapabilities () {
121
+ if cap == nil {
122
+ continue
123
+ }
124
+ rpc := cap .GetRpc ()
125
+ if rpc == nil {
126
+ continue
127
+ }
128
+ t := rpc .GetType ()
129
+ caps [t ] = true
130
+ }
131
+ return caps , nil
132
+ }
133
+
107
134
// ProbeForever calls Probe() of a CSI driver and waits until the driver becomes ready.
108
135
// Any error other than timeout is returned.
109
136
func ProbeForever (conn * grpc.ClientConn , singleProbeTimeout time.Duration ) error {
You can’t perform that action at this time.
0 commit comments