Documentation ¶
Index ¶
- type CephClient
- type OSDTreeOut
- type Option
- func WithCephClient(val CephClient) Option
- func WithDryRun(val bool) Option
- func WithMaxBackfillPGsAllowed(val int) Option
- func WithMaxRecoveryPGsAllowed(val int) Option
- func WithSleepInterval(val time.Duration) Option
- func WithTargetCrushWeightMap(val map[int]float64) Option
- func WithWeightIncrement(val float64) Option
- type Rebalancer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CephClient ¶
type CephClient interface { // BackfillingPGs surfaces the list of PGs that are either // in 'backfilling' or 'backfill_weight' state. BackfillingPGs() (int, error) // RecoveringPGs surfaces the list of PGs that are either // in 'recovering' or 'recovery_weight' state. RecoveringPGs() (int, error) // OSDTree returns a parsed version of `ceph osd tree`. OSDTree() (*OSDTreeOut, error) // CrushReweight updates the given OSD to the crush reweight // value provided. CrushReweight(osdID int, crushWeight float64) error // Close is used to disconnect Ceph connection once used. Close() }
CephClient provides an abstraction for client calls made into Ceph.
func NewCephClient ¶
func NewCephClient(user, configPath string) (CephClient, error)
NewCephClient takes in Ceph user and path to ceph.conf for establishing a connection to ceph cluster and returning a usable handle.
type OSDTreeOut ¶
type OSDTreeOut struct { Nodes []nodeType `json:"nodes"` Stray []nodeType `json:"stray"` }
OSDTreeOut provides a representation for output of `ceph osd tree -f json`.
type Option ¶
type Option func(*Rebalancer)
Option provides a safe way to update private variables of rebalancer before creating an instance of it.
func WithCephClient ¶
func WithCephClient(val CephClient) Option
WithCephClient holds the ceph client connected to the ceph cluster we want to perform reweighting on.
func WithDryRun ¶
WithDryRun will change the mode of rebalancer. When dry-run is disabled, the reweights will be actually performed on the cluster.
By default, dry-run is enabled to make sure no adverse impact occurs on the cluster until explicitly requested to.
func WithMaxBackfillPGsAllowed ¶
WithMaxBackfillPGsAllowed allows changing the number of backfilling PGs that are acceptable to be ongoing while we issue another reweight operation.
func WithMaxRecoveryPGsAllowed ¶
WithMaxRecoveryPGsAllowed allows changing the number of recovering PGs that are acceptable to be ongoing while we issue another reweight operation.
func WithSleepInterval ¶
WithSleepInterval updates the duration for which the rebalancer will sleep for between each of its reweight runs.
func WithTargetCrushWeightMap ¶
WithTargetCrushWeightMap passes the mapping of each candidate OSD to its target CRUSH weight that it hopes to reach.
This is a required option since we cannot run the reebalancer without any OSDs to reweight.
func WithWeightIncrement ¶
WithWeightIncrement updates the increment value by which each OSD will be upweighted.
type Rebalancer ¶
type Rebalancer struct {
// contains filtered or unexported fields
}
Rebalancer is responsible for performing data rebalancing by control weight changes to OSDs.
func New ¶
func New(opt ...Option) (*Rebalancer, error)
New returns a new instance of Rebalancer. It is expected that non-empty values for map of osd<->crush weights is passed as an input.
func (*Rebalancer) Collect ¶
func (r *Rebalancer) Collect(ch chan<- prometheus.Metric)
Collect is responsible for collecting values for all declared metrics.
func (*Rebalancer) Describe ¶
func (r *Rebalancer) Describe(ch chan<- *prometheus.Desc)
Describe returns the descriptions for registered metrics.
func (*Rebalancer) DoReweight ¶
func (r *Rebalancer) DoReweight()
DoReweight is the main function where the validation and actual crush reweighting occurs.
func (*Rebalancer) Run ¶
func (r *Rebalancer) Run(ctx context.Context)
Run performs continues reweighting by pausing for `sleepInterval` duration between runs. It returns when either the caller context is cancelled or when all entries from osd<->target-crush-weight are processed.