Documentation
¶
Overview ¶
Package node is the basic unit of a host
Index ¶
- func DecodeSchedulingDisabled(labels map[string]string) bool
- type HostFacts
- type Node
- func (n *Node) Clone() *Node
- func (n *Node) HostIP() string
- func (n *Node) ID() string
- func (n *Node) InvalidateLabelsCache()
- func (n *Node) Labels() map[string]string
- func (n *Node) LocalCreateNumIncrBy(i int64) int64
- func (n *Node) MarshalJSON() ([]byte, error)
- func (n *Node) SchedulingAllowed() bool
- func (n *Node) SchedulingDisabled() bool
- func (n *Node) SetSchedulingDisabled(disabled bool)
- func (n *Node) UnmarshalJSON(data []byte) error
- type NodeList
- func (l *NodeList) Add(elems ...*Node) NodeList
- func (l NodeList) AllSortByIndex() NodeList
- func (l *NodeList) Append(value ...*Node) NodeList
- func (l NodeList) IndexByPage(index, pageSize int) ([]*Node, int)
- func (l NodeList) Len() int
- func (l *NodeList) Remove(elems ...*Node)
- func (l NodeList) String() string
- type NodeScore
- type NodeScoreList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeSchedulingDisabled ¶
DecodeSchedulingDisabled reports whether labels cordon the node. Key absent → false; key present (canonical "true" or any other value) → true so corrupt/non-canonical values fail closed.
Types ¶
type HostFacts ¶
type HostFacts struct {
CPUVendor string `json:"cpu_vendor,omitempty"`
CPUModel string `json:"cpu_model,omitempty"`
CPUIDHash string `json:"cpuid_hash,omitempty"`
HostKernelRelease string `json:"host_kernel_release,omitempty"`
HostKernelFingerprint string `json:"host_kernel_fingerprint,omitempty"`
KVMAPIVersion int `json:"kvm_api_version,omitempty"`
KVMModuleFingerprint string `json:"kvm_module_fingerprint,omitempty"`
KVMModuleTaint string `json:"kvm_module_taint,omitempty"`
}
HostFacts is the scheduler-side view of a node's static host identity. It duplicates nodemeta.HostFacts to keep base/node free of a nodemeta import.
type Node ¶
type Node struct {
Index int `json:"Index,omitempty"`
InsID string `json:"InstanceID,omitempty"`
UUID string `json:"uuid,omitempty"`
IP string `json:"IP,omitempty"`
CpuTotal int `json:"CpuTotal,omitempty"`
MemMBTotal int64 `json:"MemMBTotal,omitempty"`
Zone string `json:"Zone,omitempty"`
Region string `json:"Region,omitempty"`
SystemDiskSize int64 `json:"SystemDiskSize,omitempty"`
DataDiskSize int64 `json:"DataDiskSize,omitempty"`
CPUType string `json:"CpuType,omitempty"`
ClusterLabel string `json:"ClusterLabel,omitempty"`
InstanceType string `json:"InstanceType,omitempty"`
OssClusterLabel string `json:"OssClusterLabel,omitempty"`
DeviceClass string `json:"DeviceClass,omitempty"`
DeviceID int64 `json:"DeviceId,omitempty"`
MachineHostIP string `json:"MachineHostIP,omitempty"`
InstanceFamily string `json:"InstanceFamily,omitempty"`
DedicatedClusterId string `json:"DedicatedClusterId,omitempty"`
VirtualNodeQuotaArray []int64 `json:"VirtualNodeQuotaArray,omitempty" `
HostStatus string `json:"HostStatus,omitempty"`
CreateConcurrentNum int64 `json:"CreateConcurrentNum,omitempty"`
MaxMvmLimit int64 `json:"MaxMvmLimit,omitempty"`
QuotaCpu int64 `json:"QuotaCpu,omitempty"`
QuotaMem int64 `json:"QuotaMem,omitempty"`
MetaDataUpdateAt time.Time `json:"MetaDataUpdateAt,omitempty"`
ReportedReady bool `json:"-"`
Healthy bool `json:"Healthy"`
UnhealthyReason string `json:"UnhealthyReason,omitempty"`
Score float64 `json:"Score,omitempty"`
QuotaCpuUsage int64 `json:"QuotaCpuUsage,omitempty"`
QuotaMemUsage int64 `json:"QuotaMemUsage,omitempty"`
CpuUtil float64 `json:"CpuUtil,omitempty"`
CpuLoadUsage float64 `json:"CpuLoadUsage,omitempty"`
MemUsage int64 `json:"MemUsage,omitempty"`
DataDiskUsagePer float64 `json:"DataDiskUsagePer,omitempty"`
StorageDiskUsagePer float64 `json:"StorageDiskUsagePer,omitempty"`
SysDiskUsagePer float64 `json:"SysDiskUsagePer,omitempty"`
MvmNum int64 `json:"mvm_num,omitempty"`
MetricUpdate time.Time `json:"MetricUpdateAt,omitempty"`
MetricLocalUpdateAt time.Time `json:"MetricLocalUpdateAt,omitempty"`
RealTimeCreateNum int64 `json:"RealTimeCreateNum,omitempty"`
LocalCreateNum int64 `json:"LocalCreateNum,omitempty"`
NicQueues int64 `json:"nic_queues,omitempty"`
NodeLabels map[string]string `json:"NodeLabels,omitempty"`
// HostFacts carries the host-level identity (CPU feature set, host kernel,
// KVM ABI) used for cross-node snapshot restore compatibility. A local copy
// of nodemeta.HostFacts kept here to avoid the nodemeta → base/node import
// cycle, mirroring how masterclient.HostFacts duplicates the same shape.
HostFacts *HostFacts `json:"HostFacts,omitempty"`
// contains filtered or unexported fields
}
func (*Node) InvalidateLabelsCache ¶
func (n *Node) InvalidateLabelsCache()
func (*Node) LocalCreateNumIncrBy ¶
func (*Node) MarshalJSON ¶
MarshalJSON emits SchedulingDisabled from the atomic cordon flag.
func (*Node) SchedulingAllowed ¶
SchedulingAllowed reports whether this node may receive new sandboxes based solely on cordon state (health / metrics are orthogonal).
func (*Node) SchedulingDisabled ¶
SchedulingDisabled reports whether this node is cordoned.
func (*Node) SetSchedulingDisabled ¶
SetSchedulingDisabled stores the concurrent-safe cordon flag.
func (*Node) UnmarshalJSON ¶
UnmarshalJSON loads SchedulingDisabled into the atomic cordon flag.
type NodeScoreList ¶
type NodeScoreList []*NodeScore
func (NodeScoreList) AllSortByScore ¶
func (l NodeScoreList) AllSortByScore() NodeScoreList
func (*NodeScoreList) Append ¶
func (l *NodeScoreList) Append(value ...*NodeScore) NodeScoreList
func (NodeScoreList) Len ¶
func (l NodeScoreList) Len() int
func (*NodeScoreList) Remove ¶
func (l *NodeScoreList) Remove(elems ...*NodeScore)
func (NodeScoreList) String ¶
func (l NodeScoreList) String() string