candidate

package
v0.3.10-0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 25 Imported by: 9

Documentation

Index

Constants

View Source
const (
	CacheKind = "CandidateCache"

	HostCandidateCache      = "Hosts"
	BaremetalCandidateCache = "Baremetals"

	HostDescBuilder      = HostCandidateCache
	BaremetalDescBuilder = BaremetalCandidateCache
)

Variables

Functions

func FetchGuestByHostIDs

func FetchGuestByHostIDs(ids []string) ([]models.SGuest, error)

func FetchHostsByIds

func FetchHostsByIds(ids []string) ([]computemodels.SHost, error)

func FetchModelIds

func FetchModelIds(q *sqlchemy.SQuery) ([]string, error)

func HostResidentTenantCount

func HostResidentTenantCount(id string) (map[string]int64, error)

func HostsResidentTenantStats

func HostsResidentTenantStats(hostIDs []string) (map[string]map[string]interface{}, error)

func IsGuestCreating

func IsGuestCreating(g models.SGuest) bool

func IsGuestPendingDelete

func IsGuestPendingDelete(g models.SGuest) bool

func IsGuestRunning

func IsGuestRunning(g models.SGuest) bool

func IsStorageBackendMediumMatch

func IsStorageBackendMediumMatch(s *api.CandidateStorage, backend string, mediumType string) bool

func NewCandidateManager

func NewCandidateManager(stopCh <-chan struct{}) *cache.GroupManager

Types

type BaremetalBuilder

type BaremetalBuilder struct {
	// contains filtered or unexported fields
}

func (*BaremetalBuilder) AllIDs

func (bb *BaremetalBuilder) AllIDs() ([]string, error)

func (*BaremetalBuilder) Clone

func (bb *BaremetalBuilder) Clone() BuildActor

func (*BaremetalBuilder) Do

func (bb *BaremetalBuilder) Do(ids []string) ([]interface{}, error)

func (BaremetalBuilder) Type

func (b BaremetalBuilder) Type() string

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) 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 (*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"`
	HostSchedtags []computemodels.SSchedtag `json:"schedtags"`

	InstanceGroups map[string]*api.CandidateGroup `json:"instance_groups"`
	IpmiInfo       types.SIPMIInfo                `json:"ipmi_info"`

	Nics []*types.SNic `json:"nics"`

	SharedDomains []string               `json:"shared_domains"`
	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) 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 BuildActor interface {
	Clone() BuildActor
	Type() string
	AllIDs() ([]string, error)
	//Do(ids []string, db DBGroupCacher, sync SyncGroupCacher) ([]interface{}, error)
	Do(ids []string) ([]interface{}, error)
}

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

func (b *HostBuilder) Clone() BuildActor

func (*HostBuilder) Do

func (b *HostBuilder) Do(ids []string) ([]interface{}, error)

func (HostBuilder) Type

func (b HostBuilder) Type() string

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"`

	// 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) GetFreeCPUCount

func (h *HostDesc) GetFreeCPUCount(useRsvd bool) int64

func (*HostDesc) GetFreeLocalStorageSize

func (h *HostDesc) GetFreeLocalStorageSize(useRsvd bool) int64

func (*HostDesc) GetFreeMemSize

func (h *HostDesc) GetFreeMemSize(useRsvd bool) int64

func (*HostDesc) GetFreePort

func (h *HostDesc) GetFreePort(netId string) int

func (*HostDesc) GetFreeStorageSizeOfType

func (h *HostDesc) GetFreeStorageSizeOfType(sType string, mediumType string, useRsvd bool, reqMaxSize int64) (int64, int64, error)

func (*HostDesc) GetGuestCount

func (h *HostDesc) GetGuestCount() int64

func (*HostDesc) GetReservedCPUCount

func (h *HostDesc) GetReservedCPUCount() int64

func (*HostDesc) GetReservedMemSize

func (h *HostDesc) GetReservedMemSize() int64

func (*HostDesc) GetReservedStorageSize

func (h *HostDesc) GetReservedStorageSize() int64

func (*HostDesc) GetTotalCPUCount

func (h *HostDesc) GetTotalCPUCount(useRsvd bool) int64

func (*HostDesc) GetTotalLocalStorageSize

func (h *HostDesc) GetTotalLocalStorageSize(useRsvd bool) int64

func (*HostDesc) GetTotalMemSize

func (h *HostDesc) GetTotalMemSize(useRsvd bool) int64

func (*HostDesc) Getter

func (*HostDesc) GuestReservedCPUCountFree

func (h *HostDesc) GuestReservedCPUCountFree() int64

func (*HostDesc) GuestReservedMemSizeFree

func (h *HostDesc) GuestReservedMemSizeFree() int64

func (*HostDesc) GuestReservedStorageSizeFree

func (h *HostDesc) GuestReservedStorageSizeFree() int64

func (*HostDesc) IndexKey

func (h *HostDesc) IndexKey() string

func (*HostDesc) String

func (h *HostDesc) String() string

func (*HostDesc) Type

func (h *HostDesc) Type() int

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 SyncGroupCacher

type SyncGroupCacher interface {
	// contains filtered or unexported methods
}

type UpdateStatus

type UpdateStatus struct {
	Id        string    `json:"id"`
	UpdatedAt time.Time `json:"updated_at"`
}

func FetchHostsUpdateStatus

func FetchHostsUpdateStatus(isBaremetal bool) ([]UpdateStatus, error)

func FetchModelUpdateStatus

func FetchModelUpdateStatus(man db.IStandaloneModelManager, cond sqlchemy.ICondition) ([]UpdateStatus, error)

type WaitGroupWrapper

type WaitGroupWrapper struct {
	gosync.WaitGroup
}

func (*WaitGroupWrapper) Wrap

func (w *WaitGroupWrapper) Wrap(cb func())

Jump to

Keyboard shortcuts

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