Documentation ¶
Index ¶
- Constants
- Variables
- func FetchGuestByHostIDsQuery(idsQuery sqlchemy.IQuery) ([]models.SGuest, error)
- func FetchHostsByIds(ids []string) ([]computemodels.SHost, error)
- func FetchModelIds(q *sqlchemy.SQuery) ([]string, error)
- func GetHostIds(hosts []models.SHost) []string
- func HostResidentTenantCount(id string) (map[string]int64, error)
- func HostsResidentTenantStats(hostIDs []string) (map[string]map[string]interface{}, error)
- func IsGuestCreating(g models.SGuest) bool
- func IsGuestPendingDelete(g models.SGuest) bool
- func IsGuestRunning(g models.SGuest) bool
- func IsStorageBackendMediumMatch(s *api.CandidateStorage, backend string, mediumType string) bool
- func NewCandidateManager(stopCh <-chan struct{}) *cache.GroupManager
- func ToDict[O lockman.ILockedObject](objs []O) map[string]*O
- type BaremetalBuilder
- func (bb *BaremetalBuilder) AllIDs() ([]string, error)
- func (bb *BaremetalBuilder) BuildOne(hostObj *computemodels.SHost, netGetter *networkGetter, baseDesc *BaseHostDesc) (interface{}, error)
- func (bb *BaremetalBuilder) Clone() BuildActor
- func (b BaremetalBuilder) Do(ids []string) ([]interface{}, error)
- func (bb *BaremetalBuilder) FetchHosts(ids []string) ([]computemodels.SHost, error)
- func (bb *BaremetalBuilder) InitFuncs() []InitFunc
- func (b BaremetalBuilder) Type() string
- type BaremetalDesc
- func (bd *BaremetalDesc) AllocCpuNumaPin(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
- func (bd *BaremetalDesc) AllocCpuNumaPinWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
- func (bd *BaremetalDesc) FreeCPUCount() int64
- func (bd *BaremetalDesc) FreeMemSize() int64
- func (bd *BaremetalDesc) FreeStorageSize() int64
- func (bd *BaremetalDesc) GetGuestCount() int64
- func (bd *BaremetalDesc) Getter() core.CandidatePropertyGetter
- func (bd *BaremetalDesc) IndexKey() string
- func (bd *BaremetalDesc) String() string
- func (bd *BaremetalDesc) Type() int
- type BaseHostDesc
- func (h *BaseHostDesc) GetEnableStatus() string
- func (b *BaseHostDesc) GetFreePort(netId string) int
- func (h *BaseHostDesc) GetHostType() string
- func (b *BaseHostDesc) GetHypervisorDriver() computemodels.IGuestDriver
- func (h *BaseHostDesc) GetIsolatedDevice(devID string) *core.IsolatedDeviceDesc
- func (h *BaseHostDesc) GetIsolatedDevices() []*core.IsolatedDeviceDesc
- func (b *BaseHostDesc) GetPendingUsage() *schedmodels.SPendingUsage
- func (b BaseHostDesc) GetResourceType() string
- func (b BaseHostDesc) GetSchedDesc() *jsonutils.JSONDict
- func (h *BaseHostDesc) UnusedGpuDevices() []*core.IsolatedDeviceDesc
- func (h *BaseHostDesc) UnusedIsolatedDevices() []*core.IsolatedDeviceDesc
- func (h *BaseHostDesc) UnusedIsolatedDevicesByModel(model string) []*core.IsolatedDeviceDesc
- func (h *BaseHostDesc) UnusedIsolatedDevicesByModelAndWire(model, wire string) []*core.IsolatedDeviceDesc
- func (h *BaseHostDesc) UnusedIsolatedDevicesByType(devType string) []*core.IsolatedDeviceDesc
- func (h *BaseHostDesc) UnusedIsolatedDevicesByVendorModel(vendorModel string) []*core.IsolatedDeviceDesc
- type BuildActor
- type CPUDie
- type CPUFree
- type DBGroupCacher
- type DescBuilder
- type HostBuilder
- func (b *HostBuilder) AllIDs() ([]string, error)
- func (b *HostBuilder) AllIDsQuery() sqlchemy.IQuery
- func (b *HostBuilder) BuildOne(host *computemodels.SHost, getter *networkGetter, baseDesc *BaseHostDesc) (interface{}, error)
- func (b *HostBuilder) Clone() BuildActor
- func (b HostBuilder) Do(ids []string) ([]interface{}, error)
- func (b *HostBuilder) FetchHosts(ids []string) ([]computemodels.SHost, error)
- func (b *HostBuilder) InitFuncs() []InitFunc
- func (b HostBuilder) Type() string
- type HostDesc
- func (h *HostDesc) AllocCpuNumaPin(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
- func (h *HostDesc) AllocCpuNumaPinWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
- func (h *HostDesc) GetFreeCPUCount(useRsvd bool) int64
- func (h *HostDesc) GetFreeCpuNuma() scheduler.SortedFreeNumaCpuMam
- func (h *HostDesc) GetFreeLocalStorageSize(useRsvd bool) int64
- func (h *HostDesc) GetFreeMemSize(useRsvd bool) int64
- func (h *HostDesc) GetFreePort(netId string) int
- func (h *HostDesc) GetFreeStorageSizeOfType(sType string, mediumType string, useRsvd bool, reqMaxSize int64) (int64, int64, error)
- func (h *HostDesc) GetGuestCount() int64
- func (h *HostDesc) GetReservedCPUCount() int64
- func (h *HostDesc) GetReservedMemSize() int64
- func (h *HostDesc) GetReservedStorageSize() int64
- func (h *HostDesc) GetTotalCPUCount(useRsvd bool) int64
- func (h *HostDesc) GetTotalLocalStorageSize(useRsvd bool) int64
- func (h *HostDesc) GetTotalMemSize(useRsvd bool) int64
- func (h *HostDesc) Getter() core.CandidatePropertyGetter
- func (h *HostDesc) GuestReservedCPUCountFree() int64
- func (h *HostDesc) GuestReservedMemSizeFree() int64
- func (h *HostDesc) GuestReservedStorageSizeFree() int64
- func (h *HostDesc) IndexKey() string
- func (h *HostDesc) String() string
- func (h *HostDesc) Type() int
- type IResourceBuilder
- type InitFunc
- type NumaNode
- type ReservedResource
- func NewGuestReservedResourceByBuilder(b *HostBuilder, host *computemodels.SHost) (ret *ReservedResource)
- func NewGuestReservedResourceUsedByBuilder(b *HostBuilder, host *computemodels.SHost, free *ReservedResource) (ret *ReservedResource, err error)
- func NewReservedResource(cpu, mem, storage int64) *ReservedResource
- type ResidentTenant
- type SHostTopo
- func (h *SHostTopo) AllocCpuNumaNodes(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
- func (h *SHostTopo) AllocCpuNumaNodesWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
- func (pq SHostTopo) Len() int
- func (pq SHostTopo) Less(i, j int) bool
- func (h *SHostTopo) LoadCpuNumaPin(guestsCpuNumaPin []scheduler.SCpuNumaPin)
- func (pq *SHostTopo) Push(item interface{})
- func (pq SHostTopo) Swap(i, j int)
- type SorttedCPUDie
- type SorttedCPUFree
- type SyncGroupCacher
- type UpdateStatus
- type WaitGroupWrapper
Constants ¶
View Source
const ( CacheKind = "CandidateCache" HostCandidateCache = "Hosts" BaremetalCandidateCache = "Baremetals" HostDescBuilder = HostCandidateCache BaremetalDescBuilder = BaremetalCandidateCache )
Variables ¶
View Source
var ( VMRunningStatus = sets.NewString( computeapi.VM_START_START, computeapi.VM_STARTING, computeapi.VM_RUNNING, computeapi.VM_STOP_FAILED, computeapi.VM_BLOCK_STREAM, computeapi.VM_UNKNOWN, computeapi.VM_BACKUP_STARTING, ) VMCreatingStatus = sets.NewString( computeapi.VM_SCHEDULE, computeapi.VM_CREATE_NETWORK, computeapi.VM_CREATE_DISK, computeapi.VM_START_DEPLOY, computeapi.VM_DEPLOYING, computeapi.VM_BACKUP_CREATING, computeapi.VM_DEPLOYING_BACKUP, ) )
Functions ¶
func FetchHostsByIds ¶
func FetchHostsByIds(ids []string) ([]computemodels.SHost, error)
func GetHostIds ¶
func IsGuestCreating ¶
func IsGuestPendingDelete ¶
func IsGuestRunning ¶
func IsStorageBackendMediumMatch ¶
func IsStorageBackendMediumMatch(s *api.CandidateStorage, backend string, mediumType string) bool
func NewCandidateManager ¶
func NewCandidateManager(stopCh <-chan struct{}) *cache.GroupManager
func ToDict ¶
func ToDict[O lockman.ILockedObject](objs []O) map[string]*O
Types ¶
type BaremetalBuilder ¶
type BaremetalBuilder struct {
// contains filtered or unexported fields
}
func (*BaremetalBuilder) AllIDs ¶
func (bb *BaremetalBuilder) AllIDs() ([]string, error)
func (*BaremetalBuilder) BuildOne ¶
func (bb *BaremetalBuilder) BuildOne(hostObj *computemodels.SHost, netGetter *networkGetter, baseDesc *BaseHostDesc) (interface{}, error)
func (*BaremetalBuilder) Clone ¶
func (bb *BaremetalBuilder) Clone() BuildActor
func (*BaremetalBuilder) FetchHosts ¶
func (bb *BaremetalBuilder) FetchHosts(ids []string) ([]computemodels.SHost, error)
func (*BaremetalBuilder) InitFuncs ¶
func (bb *BaremetalBuilder) InitFuncs() []InitFunc
type BaremetalDesc ¶
type BaremetalDesc struct { *BaseHostDesc StorageInfo []*baremetal.BaremetalStorage `json:"storage_info"` StorageType string `json:"storage_type"` StorageSize int64 `json:"storage_size"` ServerID string `json:"server_id"` }
func (*BaremetalDesc) AllocCpuNumaPin ¶
func (bd *BaremetalDesc) AllocCpuNumaPin(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
func (*BaremetalDesc) AllocCpuNumaPinWithNodeCount ¶
func (bd *BaremetalDesc) AllocCpuNumaPinWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
func (*BaremetalDesc) FreeCPUCount ¶
func (bd *BaremetalDesc) FreeCPUCount() int64
func (*BaremetalDesc) FreeMemSize ¶
func (bd *BaremetalDesc) FreeMemSize() int64
func (*BaremetalDesc) FreeStorageSize ¶
func (bd *BaremetalDesc) FreeStorageSize() int64
func (*BaremetalDesc) GetGuestCount ¶
func (bd *BaremetalDesc) GetGuestCount() int64
func (*BaremetalDesc) Getter ¶
func (bd *BaremetalDesc) Getter() core.CandidatePropertyGetter
func (*BaremetalDesc) IndexKey ¶
func (bd *BaremetalDesc) IndexKey() string
func (*BaremetalDesc) String ¶
func (bd *BaremetalDesc) String() string
func (*BaremetalDesc) Type ¶
func (bd *BaremetalDesc) Type() int
type BaseHostDesc ¶
type BaseHostDesc struct { *computemodels.SHost Region *computemodels.SCloudregion `json:"region"` Zone *computemodels.SZone `json:"zone"` Cloudprovider *computemodels.SCloudprovider `json:"cloudprovider"` Cloudaccount *computemodels.SCloudaccount `json:"cloudaccount"` Networks []*api.CandidateNetwork `json:"networks"` NetInterfaces map[string][]computemodels.SNetInterface `json:"net_interfaces"` Storages []*api.CandidateStorage `json:"storages"` IsolatedDevices []*core.IsolatedDeviceDesc `json:"isolated_devices"` Tenants map[string]int64 `json:"tenants"` InstanceGroups map[string]*api.CandidateGroup `json:"instance_groups"` IpmiInfo types.SIPMIInfo `json:"ipmi_info"` Nics []*types.SNic `json:"nics"` PendingUsage map[string]interface{} `json:"pending_usage"` ClassMetadata map[string]string `json:"class_metadata"` }
func (*BaseHostDesc) GetEnableStatus ¶
func (h *BaseHostDesc) GetEnableStatus() string
func (*BaseHostDesc) GetFreePort ¶
func (b *BaseHostDesc) GetFreePort(netId string) int
func (*BaseHostDesc) GetHostType ¶
func (h *BaseHostDesc) GetHostType() string
func (*BaseHostDesc) GetHypervisorDriver ¶
func (b *BaseHostDesc) GetHypervisorDriver() computemodels.IGuestDriver
func (*BaseHostDesc) GetIsolatedDevice ¶
func (h *BaseHostDesc) GetIsolatedDevice(devID string) *core.IsolatedDeviceDesc
func (*BaseHostDesc) GetIsolatedDevices ¶
func (h *BaseHostDesc) GetIsolatedDevices() []*core.IsolatedDeviceDesc
func (*BaseHostDesc) GetPendingUsage ¶
func (b *BaseHostDesc) GetPendingUsage() *schedmodels.SPendingUsage
func (BaseHostDesc) GetResourceType ¶
func (b BaseHostDesc) GetResourceType() string
func (BaseHostDesc) GetSchedDesc ¶
func (b BaseHostDesc) GetSchedDesc() *jsonutils.JSONDict
func (*BaseHostDesc) UnusedGpuDevices ¶
func (h *BaseHostDesc) UnusedGpuDevices() []*core.IsolatedDeviceDesc
func (*BaseHostDesc) UnusedIsolatedDevices ¶
func (h *BaseHostDesc) UnusedIsolatedDevices() []*core.IsolatedDeviceDesc
func (*BaseHostDesc) UnusedIsolatedDevicesByModel ¶
func (h *BaseHostDesc) UnusedIsolatedDevicesByModel(model string) []*core.IsolatedDeviceDesc
func (*BaseHostDesc) UnusedIsolatedDevicesByModelAndWire ¶
func (h *BaseHostDesc) UnusedIsolatedDevicesByModelAndWire(model, wire string) []*core.IsolatedDeviceDesc
func (*BaseHostDesc) UnusedIsolatedDevicesByType ¶
func (h *BaseHostDesc) UnusedIsolatedDevicesByType(devType string) []*core.IsolatedDeviceDesc
func (*BaseHostDesc) UnusedIsolatedDevicesByVendorModel ¶
func (h *BaseHostDesc) UnusedIsolatedDevicesByVendorModel(vendorModel string) []*core.IsolatedDeviceDesc
type BuildActor ¶
type DBGroupCacher ¶
type DBGroupCacher interface {
// contains filtered or unexported methods
}
type DescBuilder ¶
type DescBuilder struct {
// contains filtered or unexported fields
}
func NewDescBuilder ¶
func NewDescBuilder(act BuildActor) *DescBuilder
func (*DescBuilder) Build ¶
func (d *DescBuilder) Build(ids []string) ([]interface{}, error)
type HostBuilder ¶
type HostBuilder struct {
// contains filtered or unexported fields
}
func (*HostBuilder) AllIDs ¶
func (b *HostBuilder) AllIDs() ([]string, error)
func (*HostBuilder) AllIDsQuery ¶
func (b *HostBuilder) AllIDsQuery() sqlchemy.IQuery
func (*HostBuilder) BuildOne ¶
func (b *HostBuilder) BuildOne(host *computemodels.SHost, getter *networkGetter, baseDesc *BaseHostDesc) (interface{}, error)
build host desc
func (*HostBuilder) Clone ¶
func (b *HostBuilder) Clone() BuildActor
func (*HostBuilder) FetchHosts ¶
func (b *HostBuilder) FetchHosts(ids []string) ([]computemodels.SHost, error)
func (*HostBuilder) InitFuncs ¶
func (b *HostBuilder) InitFuncs() []InitFunc
type HostDesc ¶
type HostDesc struct { *BaseHostDesc // cpu CPUCmtbound float32 `json:"cpu_cmtbound"` CPUBoundCount int64 `json:"cpu_bound_count"` CPULoad *float64 `json:"cpu_load"` TotalCPUCount int64 `json:"total_cpu_count"` RunningCPUCount int64 `json:"running_cpu_count"` CreatingCPUCount int64 `json:"creating_cpu_count"` RequiredCPUCount int64 `json:"required_cpu_count"` FakeDeletedCPUCount int64 `json:"fake_deleted_cpu_count"` FreeCPUCount int64 `json:"free_cpu_count"` // memory MemCmtbound float32 `json:"mem_cmtbound"` TotalMemSize int64 `json:"total_mem_size"` FreeMemSize int64 `json:"free_mem_size"` RunningMemSize int64 `json:"running_mem_size"` CreatingMemSize int64 `json:"creating_mem_size"` RequiredMemSize int64 `json:"required_mem_size"` FakeDeletedMemSize int64 `json:"fake_deleted_mem_size"` EnableCpuNumaAllocate bool `json:"enable_cpu_numa_allocate"` HostTopo *SHostTopo `json:"host_topo"` // storage StorageTypes []string `json:"storage_types"` // IO IOBoundCount int64 `json:"io_bound_count"` IOLoad *float64 `json:"io_load"` // server GuestCount int64 `json:"guest_count"` CreatingGuestCount int64 `json:"creating_guest_count"` RunningGuestCount int64 `json:"running_guest_count"` //Groups *GroupCounts `json:"groups"` Metadata map[string]string `json:"metadata"` IsMaintenance bool `json:"is_maintenance"` GuestReservedResource *ReservedResource `json:"guest_reserved_resource"` GuestReservedResourceUsed *ReservedResource `json:"guest_reserved_used"` }
func (*HostDesc) AllocCpuNumaPin ¶
func (h *HostDesc) AllocCpuNumaPin(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
func (*HostDesc) AllocCpuNumaPinWithNodeCount ¶
func (h *HostDesc) AllocCpuNumaPinWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
func (*HostDesc) GetFreeCPUCount ¶
func (*HostDesc) GetFreeCpuNuma ¶
func (h *HostDesc) GetFreeCpuNuma() scheduler.SortedFreeNumaCpuMam
func (*HostDesc) GetFreeLocalStorageSize ¶
func (*HostDesc) GetFreeMemSize ¶
func (*HostDesc) GetFreePort ¶
func (*HostDesc) GetFreeStorageSizeOfType ¶
func (*HostDesc) GetGuestCount ¶
func (*HostDesc) GetReservedCPUCount ¶
func (*HostDesc) GetReservedMemSize ¶
func (*HostDesc) GetReservedStorageSize ¶
func (*HostDesc) GetTotalCPUCount ¶
func (*HostDesc) GetTotalLocalStorageSize ¶
func (*HostDesc) GetTotalMemSize ¶
func (*HostDesc) Getter ¶
func (h *HostDesc) Getter() core.CandidatePropertyGetter
func (*HostDesc) GuestReservedCPUCountFree ¶
func (*HostDesc) GuestReservedMemSizeFree ¶
func (*HostDesc) GuestReservedStorageSizeFree ¶
type IResourceBuilder ¶
type IResourceBuilder interface { FetchHosts(ids []string) ([]computemodels.SHost, error) InitFuncs() []InitFunc BuildOne(host *computemodels.SHost, getter *networkGetter, desc *BaseHostDesc) (interface{}, error) }
type InitFunc ¶
type InitFunc func(ids []computemodels.SHost, errChan chan error)
type NumaNode ¶
type NumaNode struct { CpuDies SorttedCPUDie LogicalProcessors cpuset.CPUSet VcpuCount int CpuCount int NodeId int NumaHugeMemSizeKB int NumaHugeFreeMemSizeKB int }
func NewNumaNode ¶
func NewNumaNode(nodeId, hugepageSizeKb int, nodeHugepages []hostapi.HostNodeHugepageNr) *NumaNode
func (*NumaNode) AllocCpuset ¶
type ReservedResource ¶
type ReservedResource struct { CPUCount int64 `json:"cpu_count"` MemorySize int64 `json:"memory_size"` StorageSize int64 `json:"storage_size"` }
func NewGuestReservedResourceByBuilder ¶
func NewGuestReservedResourceByBuilder(b *HostBuilder, host *computemodels.SHost) (ret *ReservedResource)
func NewGuestReservedResourceUsedByBuilder ¶
func NewGuestReservedResourceUsedByBuilder(b *HostBuilder, host *computemodels.SHost, free *ReservedResource) (ret *ReservedResource, err error)
func NewReservedResource ¶
func NewReservedResource(cpu, mem, storage int64) *ReservedResource
type ResidentTenant ¶
type ResidentTenant struct { HostId string `json:"host_id"` TenantId string `json:"tenant_id"` TenantCount int64 `json:"tenant_count"` }
func FetchHostsResidentTenants ¶
func FetchHostsResidentTenants(hostIds []string) ([]ResidentTenant, error)
func (ResidentTenant) First ¶
func (t ResidentTenant) First() string
func (ResidentTenant) Second ¶
func (t ResidentTenant) Second() string
func (ResidentTenant) Third ¶
func (t ResidentTenant) Third() interface{}
type SHostTopo ¶
func HostTopoSubPendingUsage ¶
func (*SHostTopo) AllocCpuNumaNodes ¶
func (h *SHostTopo) AllocCpuNumaNodes(vcpuCount, memSizeKB int) []scheduler.SCpuNumaPin
func (*SHostTopo) AllocCpuNumaNodesWithNodeCount ¶
func (h *SHostTopo) AllocCpuNumaNodesWithNodeCount(vcpuCount, memSizeKB, nodeCount int) []scheduler.SCpuNumaPin
func (*SHostTopo) LoadCpuNumaPin ¶
func (h *SHostTopo) LoadCpuNumaPin(guestsCpuNumaPin []scheduler.SCpuNumaPin)
type SorttedCPUDie ¶
type SorttedCPUDie []*CPUDie
func (SorttedCPUDie) Len ¶
func (pq SorttedCPUDie) Len() int
func (SorttedCPUDie) Less ¶
func (pq SorttedCPUDie) Less(i, j int) bool
func (*SorttedCPUDie) LoadCpus ¶
func (pq *SorttedCPUDie) LoadCpus(cpus []int, vcpuCount int)
func (*SorttedCPUDie) Pop ¶
func (pq *SorttedCPUDie) Pop() interface{}
func (*SorttedCPUDie) Push ¶
func (pq *SorttedCPUDie) Push(item interface{})
func (SorttedCPUDie) Swap ¶
func (pq SorttedCPUDie) Swap(i, j int)
type SorttedCPUFree ¶
type SorttedCPUFree []*CPUFree
func (SorttedCPUFree) Len ¶
func (pq SorttedCPUFree) Len() int
func (SorttedCPUFree) Less ¶
func (pq SorttedCPUFree) Less(i, j int) bool
func (*SorttedCPUFree) LoadCpu ¶
func (pq *SorttedCPUFree) LoadCpu(cpuId int)
func (*SorttedCPUFree) Pop ¶
func (pq *SorttedCPUFree) Pop() interface{}
func (*SorttedCPUFree) Push ¶
func (pq *SorttedCPUFree) Push(item interface{})
func (SorttedCPUFree) Swap ¶
func (pq SorttedCPUFree) Swap(i, j int)
type SyncGroupCacher ¶
type SyncGroupCacher interface {
// contains filtered or unexported methods
}
type UpdateStatus ¶
func FetchHostsUpdateStatus ¶
func FetchHostsUpdateStatus(isBaremetal bool) ([]UpdateStatus, error)
func FetchModelUpdateStatus ¶
func FetchModelUpdateStatus(man db.IStandaloneModelManager, cond sqlchemy.ICondition) ([]UpdateStatus, error)
type WaitGroupWrapper ¶
func (*WaitGroupWrapper) Wrap ¶
func (w *WaitGroupWrapper) Wrap(cb func())
Click to show internal directories.
Click to hide internal directories.