mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
csi: implement ControllerExpandVolume (#18359)
the first half of volume expansion,
this allows a user to update requested capacity
("capacity_min" and "capacity_max") in a volume
specification file, and re-issue either Register
or Create volume commands (or api calls).
the requested capacity will now be "reconciled"
with the current real capacity of the volume,
issuing a ControllerExpandVolume RPC call
to a running controller plugin, if requested
"capacity_min" is higher than the current
capacity on the volume in state.
csi spec:
https://github.com/container-storage-interface/spec/blob/c918b7f/spec.md#controllerexpandvolume
note: this does not yet cover NodeExpandVolume
This commit is contained in:
@@ -287,6 +287,36 @@ type ClientCSIControllerCreateVolumeResponse struct {
|
||||
Topologies []*structs.CSITopology
|
||||
}
|
||||
|
||||
// ClientCSIControllerExpandVolumeRequest is the RPC made from the server to a
|
||||
// Nomad client to tell a CSI controller plugin on that client to perform
|
||||
// ControllerExpandVolume
|
||||
type ClientCSIControllerExpandVolumeRequest struct {
|
||||
ExternalVolumeID string
|
||||
CapacityRange *csi.CapacityRange
|
||||
Secrets structs.CSISecrets
|
||||
VolumeCapability *csi.VolumeCapability
|
||||
|
||||
CSIControllerQuery
|
||||
}
|
||||
|
||||
func (req *ClientCSIControllerExpandVolumeRequest) ToCSIRequest() *csi.ControllerExpandVolumeRequest {
|
||||
csiReq := &csi.ControllerExpandVolumeRequest{
|
||||
ExternalVolumeID: req.ExternalVolumeID,
|
||||
Capability: req.VolumeCapability,
|
||||
Secrets: req.Secrets,
|
||||
}
|
||||
if req.CapacityRange != nil {
|
||||
csiReq.RequiredBytes = req.CapacityRange.RequiredBytes
|
||||
csiReq.LimitBytes = req.CapacityRange.LimitBytes
|
||||
}
|
||||
return csiReq
|
||||
}
|
||||
|
||||
type ClientCSIControllerExpandVolumeResponse struct {
|
||||
CapacityBytes int64
|
||||
NodeExpansionRequired bool
|
||||
}
|
||||
|
||||
// ClientCSIControllerDeleteVolumeRequest the RPC made from the server to a
|
||||
// Nomad client to tell a CSI controller plugin on that client to perform
|
||||
// DeleteVolume
|
||||
|
||||
Reference in New Issue
Block a user