Documentation ¶
Index ¶
- type Scheduler
- func (s *Scheduler) AccessibleTopologies(ctx context.Context, volId string, ...) ([]*csi.Topology, error)
- func (s *Scheduler) Create(ctx context.Context, volId string, params *volume.Parameters, ...) error
- func (s *Scheduler) GetCurrentDiskfulNodes(ctx context.Context, volId string) ([]string, error)
- func (s *Scheduler) PlaceOneAccessibleToSegment(ctx context.Context, volId string, segments map[string]string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type Scheduler struct { *lc.HighLevelClient // contains filtered or unexported fields }
Scheduler places volumes according to both CSI Topology and user-provided autoplace parameters.
This scheduler works like autoplace.Scheduler with a few key differences: * If a `Requisite` topology is requested, all placement will be restricted onto those nodes. * If a `Preferred` topology is requested, this scheduler will try to place at least one volume on those nodes. This scheduler complies with the CSI spec for topology:
https://github.com/container-storage-interface/spec/blob/v1.4.0/csi.proto#L523
func NewScheduler ¶
func NewScheduler(c *lc.HighLevelClient, l *logrus.Entry) *Scheduler
func (*Scheduler) AccessibleTopologies ¶
func (*Scheduler) Create ¶
func (s *Scheduler) Create(ctx context.Context, volId string, params *volume.Parameters, topologies *csi.TopologyRequirement) error
Create places volumes according to the constraints given by the LINSTOR SelectFilter and topology requirements by CSI
The CSI spec mandates: * If `Requisite` exists, we _have_ to use those up first. * If `Requisite` and `Preferred` exists, we have `Preferred` ⊆ `Requisite`, and `Preferred` SHOULD be used first. * If `Requisite` does not exist and `Preferred` exists, we SHOULD use `Preferred`. * If both `Requisite` and `Preferred` do not exist, we can do what ever.
Making this compatible with LINSTOR autoplace parameters can be quite tricky. For example, a "DoNotPlaceWith" constraint could mean we are not able to place the volume on the first preferred node.
To fulfil all these requirements, this scheduler executes the following steps:
- It collects the list of requisite nodes. Note that only one replica on any requisite nodes is enough to fulfil the CSI spec. 1a. Bail out early if we already have the required replica count _and_ any requisite node has a replica.
- Iterate over the preferred segments until we successfully placed a replica 2a. Bail out early if we now have the required replica count _and_ any requisite node has a replica.
- Try to place remaining replicas on requisite nodes.
- Try to place remaining replicas on any nodes.
func (*Scheduler) GetCurrentDiskfulNodes ¶ added in v0.18.0
func (*Scheduler) PlaceOneAccessibleToSegment ¶ added in v0.18.0
func (s *Scheduler) PlaceOneAccessibleToSegment(ctx context.Context, volId string, segments map[string]string, remoteAccessPolicy volume.RemoteAccessPolicy, existingNodes []string) error
PlaceOneAccessibleToSegment tries to place a replica accessible to the given segment.
Initially, placement on an exactly matching node is tried. If that is not possible, the remoteAccessPolicy is used to determine other nodes that would grant the given segment access.