Documentation
¶
Index ¶
- Variables
- type Disk
- type Disks
- type EngineParams
- type NodeResource
- type NodeResourceInfo
- type NodeResourceRequest
- type VolumeBinding
- func (vb VolumeBinding) DeepCopy() *VolumeBinding
- func (vb VolumeBinding) GetMapKey() [3]string
- func (vb VolumeBinding) RequireIOPS() bool
- func (vb VolumeBinding) RequireSchedule() bool
- func (vb VolumeBinding) RequireScheduleMonopoly() bool
- func (vb VolumeBinding) RequireScheduleUnlimitedQuota() bool
- func (vb VolumeBinding) ToString(normalize bool) (volume string)
- func (vb VolumeBinding) ValidIOParameters() bool
- func (vb VolumeBinding) Validate() error
- type VolumeBindings
- func (vbs VolumeBindings) ApplyPlan(plan VolumePlan) (res VolumeBindings)
- func (vbs VolumeBindings) MarshalJSON() ([]byte, error)
- func (vbs VolumeBindings) String() string
- func (vbs VolumeBindings) TotalSize() (total int64)
- func (vbs *VolumeBindings) UnmarshalJSON(b []byte) (err error)
- func (vbs VolumeBindings) Validate() error
- type VolumePlan
- type Volumes
- type WorkloadResource
- type WorkloadResourceRequest
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct { Device string `json:"device" mapstructure:"device"` Mounts []string `json:"mounts" mapstructure:"mounts"` ReadIOPS int64 `json:"read_IOPS" mapstructure:"read_IOPS"` WriteIOPS int64 `json:"write_IOPS" mapstructure:"write_IOPS"` ReadBPS int64 `json:"read_bps" mapstructure:"read_bps"` WriteBPS int64 `json:"write_bps" mapstructure:"write_bps"` }
Disk .
type Disks ¶
type Disks []*Disk
Disks .
func (Disks) GetDiskByDevice ¶
GetDiskByDevice .
func (*Disks) RemoveMounts ¶
RemoveMounts remove mounts so Add / Sub won't affect the origin mounts
type EngineParams ¶
type EngineParams struct { Volumes []string `json:"volumes" mapstructure:"volumes"` VolumeChanged bool `json:"volume_changed" mapstructure:"volume_changed"` // indicates whether the realloc request includes new volumes Storage int64 `json:"storage" mapstructure:"storage"` IOPSOptions map[string]string `json:"iops_options" mapstructure:"iops_options"` }
EngineParams .
type NodeResource ¶
type NodeResource struct { Volumes Volumes `json:"volumes" mapstructure:"volumes"` Disks Disks `json:"disks" mapstructure:"disks"` Storage int64 `json:"storage" mapstructure:"storage"` }
NodeResource .
func (*NodeResource) Parse ¶
func (n *NodeResource) Parse(rawParams resourcetypes.RawParams) error
ParseFromRawParams .
type NodeResourceInfo ¶
type NodeResourceInfo struct { Capacity *NodeResource `json:"capacity"` Usage *NodeResource `json:"usage"` }
NodeResourceInfo .
func (*NodeResourceInfo) GetAvailableResource ¶
func (n *NodeResourceInfo) GetAvailableResource() *NodeResource
GetAvailableResource .
type NodeResourceRequest ¶
type NodeResourceRequest struct { Volumes Volumes `json:"volumes"` Storage int64 `json:"storage"` Disks Disks `json:"disks"` RMDisks []string `json:"rm_disks"` RawParams resourcetypes.RawParams `json:"-"` }
NodeResourceRequest includes all possible fields passed by eru-core for editing node, it not parsed!
func (*NodeResourceRequest) Parse ¶
func (n *NodeResourceRequest) Parse(rawParams resourcetypes.RawParams) (err error)
Parse .
func (*NodeResourceRequest) SkipEmpty ¶
func (n *NodeResourceRequest) SkipEmpty(nodeResource *NodeResource)
SkipEmpty used for setting node resource capacity in absolute mode
type VolumeBinding ¶
type VolumeBinding struct { Source string `json:"source" mapstructure:"source"` Destination string `json:"destination" mapstructure:"destination"` Flags string `json:"flags" mapstructure:"flags"` SizeInBytes int64 `json:"size_in_bytes" mapstructure:"size_in_bytes"` ReadIOPS int64 `json:"read_iops" mapstructure:"read_iops"` WriteIOPS int64 `json:"write_iops" mapstructure:"write_iops"` ReadBPS int64 `json:"read_bps" mapstructure:"read_bps"` WriteBPS int64 `json:"write_bps" mapstructure:"write_bps"` }
VolumeBinding src:dst[:flags][:size][:read_IOPS:write_IOPS:read_bytes:write_bytes]
func NewVolumeBinding ¶
func NewVolumeBinding(volume string) (_ *VolumeBinding, err error)
NewVolumeBinding returns pointer of VolumeBinding
func (VolumeBinding) RequireIOPS ¶
func (vb VolumeBinding) RequireIOPS() bool
RequireIOPS returns true if volume binding requires IOPS / BPS
func (VolumeBinding) RequireSchedule ¶
func (vb VolumeBinding) RequireSchedule() bool
RequireSchedule returns true if volume binding requires schedule
func (VolumeBinding) RequireScheduleMonopoly ¶
func (vb VolumeBinding) RequireScheduleMonopoly() bool
RequireScheduleMonopoly returns true if volume binding requires monopoly schedule
func (VolumeBinding) RequireScheduleUnlimitedQuota ¶
func (vb VolumeBinding) RequireScheduleUnlimitedQuota() bool
RequireScheduleUnlimitedQuota .
func (VolumeBinding) ToString ¶
func (vb VolumeBinding) ToString(normalize bool) (volume string)
ToString returns volume string
func (VolumeBinding) ValidIOParameters ¶
func (vb VolumeBinding) ValidIOParameters() bool
ValidIOParameters returns true if all io related parameters are valid
func (VolumeBinding) Validate ¶
func (vb VolumeBinding) Validate() error
Validate return error if invalid
type VolumeBindings ¶
type VolumeBindings []*VolumeBinding
VolumeBindings is a collection of VolumeBinding
func MergeVolumeBindings ¶
func MergeVolumeBindings(vbs1 VolumeBindings, vbs2 ...VolumeBindings) (vbs VolumeBindings)
MergeVolumeBindings combines two VolumeBindings
func NewVolumeBindings ¶
func NewVolumeBindings(volumes []string) (volumeBindings VolumeBindings, err error)
NewVolumeBindings return VolumeBindings of reference type
func (VolumeBindings) ApplyPlan ¶
func (vbs VolumeBindings) ApplyPlan(plan VolumePlan) (res VolumeBindings)
ApplyPlan creates new VolumeBindings according to volume plan
func (VolumeBindings) MarshalJSON ¶
func (vbs VolumeBindings) MarshalJSON() ([]byte, error)
MarshalJSON is used for encoding/json.Marshal
func (VolumeBindings) String ¶
func (vbs VolumeBindings) String() string
func (*VolumeBindings) UnmarshalJSON ¶
func (vbs *VolumeBindings) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON is used for encoding/json.Unmarshal
type VolumePlan ¶
type VolumePlan map[*VolumeBinding]Volumes
VolumePlan is map from volume string to volumeMap: {"AUTO:/data:rw:100": Volumes{"/sda1": 100}}
func (VolumePlan) GetVolumes ¶
func (p VolumePlan) GetVolumes(vb *VolumeBinding) (volMap Volumes, volume *VolumeBinding)
GetVolumes looks up Volumes according to volume destination directory
func (*VolumePlan) UnmarshalJSON ¶
func (p *VolumePlan) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON .
type WorkloadResource ¶
type WorkloadResource struct { VolumesRequest VolumeBindings `json:"volumes_request" mapstructure:"volumes_request"` VolumesLimit VolumeBindings `json:"volumes_limit" mapstructure:"volumes_limit"` VolumePlanRequest VolumePlan `json:"volume_plan_request" mapstructure:"volume_plan_request"` VolumePlanLimit VolumePlan `json:"volume_plan_limit" mapstructure:"volume_plan_limit"` StorageRequest int64 `json:"storage_request" mapstructure:"storage_request"` StorageLimit int64 `json:"storage_limit" mapstructure:"storage_limit"` DisksRequest Disks `json:"disks_request" mapstructure:"disks_request"` DisksLimit Disks `json:"disks_limit" mapstructure:"disks_limit"` }
WorkloadResource .
func (*WorkloadResource) Parse ¶
func (w *WorkloadResource) Parse(rawParams resourcetypes.RawParams) error
ParseFromRawParams .
type WorkloadResourceRequest ¶
type WorkloadResourceRequest struct { VolumesRequest VolumeBindings `json:"volumes_request"` VolumesLimit VolumeBindings `json:"volumes_limit"` StorageRequest int64 `json:"storage_request"` StorageLimit int64 `json:"storage_limit"` // contains filtered or unexported fields }
WorkloadResourceRequest .
func (*WorkloadResourceRequest) Parse ¶
func (w *WorkloadResourceRequest) Parse(rawParams resourcetypes.RawParams) (err error)
ParseFromRawParams .
func (*WorkloadResourceRequest) SkipAddStorage ¶
func (w *WorkloadResourceRequest) SkipAddStorage()
SkipAddStorage will skip adding volume size to storage request / limit (used in realloc)
func (*WorkloadResourceRequest) Validate ¶
func (w *WorkloadResourceRequest) Validate() error
Validate .