node

package
v0.0.0-...-72af66c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package node is the basic unit of a host

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSchedulingDisabled

func DecodeSchedulingDisabled(labels map[string]string) bool

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) Clone

func (n *Node) Clone() *Node

func (*Node) HostIP

func (n *Node) HostIP() string

func (*Node) ID

func (n *Node) ID() string

func (*Node) InvalidateLabelsCache

func (n *Node) InvalidateLabelsCache()

func (*Node) Labels

func (n *Node) Labels() map[string]string

func (*Node) LocalCreateNumIncrBy

func (n *Node) LocalCreateNumIncrBy(i int64) int64

func (*Node) MarshalJSON

func (n *Node) MarshalJSON() ([]byte, error)

MarshalJSON emits SchedulingDisabled from the atomic cordon flag.

func (*Node) SchedulingAllowed

func (n *Node) SchedulingAllowed() bool

SchedulingAllowed reports whether this node may receive new sandboxes based solely on cordon state (health / metrics are orthogonal).

func (*Node) SchedulingDisabled

func (n *Node) SchedulingDisabled() bool

SchedulingDisabled reports whether this node is cordoned.

func (*Node) SetSchedulingDisabled

func (n *Node) SetSchedulingDisabled(disabled bool)

SetSchedulingDisabled stores the concurrent-safe cordon flag.

func (*Node) UnmarshalJSON

func (n *Node) UnmarshalJSON(data []byte) error

UnmarshalJSON loads SchedulingDisabled into the atomic cordon flag.

type NodeList

type NodeList []*Node

func (*NodeList) Add

func (l *NodeList) Add(elems ...*Node) NodeList

func (NodeList) AllSortByIndex

func (l NodeList) AllSortByIndex() NodeList

func (*NodeList) Append

func (l *NodeList) Append(value ...*Node) NodeList

func (NodeList) IndexByPage

func (l NodeList) IndexByPage(index, pageSize int) ([]*Node, int)

func (NodeList) Len

func (l NodeList) Len() int

func (*NodeList) Remove

func (l *NodeList) Remove(elems ...*Node)

func (NodeList) String

func (l NodeList) String() string

type NodeScore

type NodeScore struct {
	InsID string

	OrigNode *Node

	Score float64

	MvmNum int64
}

func (*NodeScore) ID

func (n *NodeScore) ID() string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL