Skip to content

Commit 131230b

Browse files
gadididimergify[bot]
authored andcommitted
nvmeof: add ControllerExpandVolume() implementation
ControllerExpandVolume() expand the nvmeof ns volume (and the rbd image size ) Signed-off-by: gadi-didi <gadi.didi@ibm.com>
1 parent e276f0d commit 131230b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

internal/nvmeof/controller/controllerserver.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ func (cs *Server) ControllerGetCapabilities(
7676
return cs.backendServer.ControllerGetCapabilities(ctx, req)
7777
}
7878

79+
// ValidateControllerServiceRequest uses the RBD backendServer driver field.
80+
// It checks whether the controller service request is valid.
81+
func (cs *Server) ValidateControllerServiceRequest(capability csi.ControllerServiceCapability_RPC_Type) error {
82+
return cs.backendServer.Driver.ValidateControllerServiceRequest(capability)
83+
}
84+
7985
// ValidateVolumeCapabilities checks whether the volume capabilities requested
8086
// are supported.
8187
func (cs *Server) ValidateVolumeCapabilities(
@@ -330,16 +336,18 @@ func (cs *Server) ControllerModifyVolume(
330336
return &csi.ControllerModifyVolumeResponse{}, nil
331337
}
332338

333-
// ControllerExpandVolume handles volume expansion requests.
334-
// For now it only updates the capacity in the response as NVMe-oF
335-
// this must be added because ControllerModifyVolume requires the sidecar csi-resizer. and
336-
// csi-resizer searches for the capacity ControllerServiceCapability_RPC_EXPAND_VOLUME.
337-
// In the future, if NVMe-oF gateway supports volume expansion, the logic must be added here.
338339
func (cs *Server) ControllerExpandVolume(
339340
ctx context.Context,
340341
req *csi.ControllerExpandVolumeRequest,
341342
) (*csi.ControllerExpandVolumeResponse, error) {
342-
return nil, status.Errorf(codes.Unimplemented, "ControllerExpandVolume is not implemented for NVMe-oF volumes")
343+
err := cs.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_EXPAND_VOLUME)
344+
if err != nil {
345+
log.ErrorLog(ctx, "invalid expand volume req: %v", err)
346+
347+
return nil, err
348+
}
349+
// expand volume is handled by rbd backend server
350+
return cs.backendServer.ControllerExpandVolume(ctx, req)
343351
}
344352

345353
// validateCreateVolumeRequest validates the incoming request for nvmeof.

0 commit comments

Comments
 (0)