candidate

package
v2.0.25+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheKind = "CandidateCache"

	HostCandidateCache      = "Hosts"
	BaremetalCandidateCache = "Baremetals"

	HostDescBuilder      = HostCandidateCache
	BaremetalDescBuilder = BaremetalCandidateCache
)

Variables

This section is empty.

Functions

func CpuIsolatedDevReservedCount

func CpuIsolatedDevReservedCount() int64

func HostResidentTenantCount

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

func HostsResidentTenantStats

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

func MemIsolatedDevReservedSize

func MemIsolatedDevReservedSize() int64

func NewCandidateManager

func NewCandidateManager(db DBGroupCacher, sync SyncGroupCacher, stopCh <-chan struct{}) *cache.GroupManager

func StorageIsolatedDevReservedSize

func StorageIsolatedDevReservedSize() int64

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, dbCache DBGroupCacher, syncCache SyncGroupCacher) ([]interface{}, error)

func (*BaremetalBuilder) Type

func (bb *BaremetalBuilder) Type() string

type BaremetalDesc

type BaremetalDesc struct {
	Storages      []*api.BaremetalStorage `json:"storages"`
	StorageType   string                  `json:"storage_type"`
	StorageSize   int64                   `json:"storage_size"`
	StorageInfo   string                  `json:"storage_info"`
	StorageDriver string                  `json:"storage_driver"`
	ServerID      string                  `json:"server_id"`
	// contains filtered or unexported fields
}

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

func (bd *BaremetalDesc) Get(key string) interface{}

func (*BaremetalDesc) GetAggregates

func (b *BaremetalDesc) GetAggregates() []*models.Aggregate

func (*BaremetalDesc) GetEnableStatus

func (h *BaremetalDesc) GetEnableStatus() string

func (*BaremetalDesc) GetHostAggregates

func (b *BaremetalDesc) GetHostAggregates() []*models.Aggregate

func (*BaremetalDesc) GetHostType

func (h *BaremetalDesc) GetHostType() string

func (*BaremetalDesc) IndexKey

func (bd *BaremetalDesc) IndexKey() string

func (*BaremetalDesc) String

func (bd *BaremetalDesc) String() string

func (*BaremetalDesc) Type

func (bd *BaremetalDesc) Type() int

func (*BaremetalDesc) XGet

func (bd *BaremetalDesc) XGet(key string, kind core.Kind) interface{}

type BuildActor

type BuildActor interface {
	Clone() BuildActor
	Type() string
	AllIDs() ([]string, error)
	Do(ids []string, db DBGroupCacher, sync SyncGroupCacher) ([]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(db DBGroupCacher, sync SyncGroupCacher, act BuildActor) *DescBuilder

func (*DescBuilder) Build

func (d *DescBuilder) Build(ids []string) ([]interface{}, error)

type GroupCount

type GroupCount struct {
	ID    string `json:"id"`    // group id
	Name  string `json:"name"`  // group name
	Count int64  `json:"count"` // guest count
}

type GroupCounts

type GroupCounts struct {
	Data map[string]*GroupCount `json:"data"` // group_id: group_count
}

func NewGroupCounts

func NewGroupCounts() *GroupCounts

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, dbCache DBGroupCacher, syncCache SyncGroupCacher) ([]interface{}, error)

func (*HostBuilder) Type

func (b *HostBuilder) Type() string

type HostDesc

type HostDesc struct {

	// cpu
	CPUMHZ              int64    `json:"cpu_mhz"`
	CPUCmtbound         float64  `json:"cpu_cmtbound"`
	CPUDesc             string   `json:"cpu_desc"`
	CPUCache            int64    `json:"cpu_cache"`
	CPUReserved         int64    `json:"cpu_reserved"`
	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        float64 `json:"mem_cmtbound"`
	MemReserved        int64   `json:"mem_reserved"`
	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
	Storages []*Storage `json:"storages"`

	// 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"`
	IsolatedDevices           []*IsolatedDeviceDesc `json:"isolated_devices"`
	ManagerID                 *string               `json:"manager_id"`
	IsMaintenance             bool                  `json:"is_maintenance"`
	GuestReservedResource     *ReservedResource     `json:"guest_reserved_resource"`
	GuestReservedResourceUsed *ReservedResource     `json:"guest_reserved_used"`
	// contains filtered or unexported fields
}

func (*HostDesc) Get

func (h *HostDesc) Get(key string) interface{}

func (*HostDesc) GetAggregates

func (b *HostDesc) GetAggregates() []*models.Aggregate

func (*HostDesc) GetEnableStatus

func (h *HostDesc) GetEnableStatus() string

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

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

func (*HostDesc) GetHostAggregates

func (b *HostDesc) GetHostAggregates() []*models.Aggregate

func (*HostDesc) GetHostType

func (h *HostDesc) GetHostType() string

func (*HostDesc) GetIsolatedDevice

func (h *HostDesc) GetIsolatedDevice(devID string) *IsolatedDeviceDesc

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

func (*HostDesc) UnusedGpuDevices

func (h *HostDesc) UnusedGpuDevices() []*IsolatedDeviceDesc

func (*HostDesc) UnusedIsolatedDevices

func (h *HostDesc) UnusedIsolatedDevices() []*IsolatedDeviceDesc

func (*HostDesc) UnusedIsolatedDevicesByModel

func (h *HostDesc) UnusedIsolatedDevicesByModel(model string) []*IsolatedDeviceDesc

func (*HostDesc) UnusedIsolatedDevicesByType

func (h *HostDesc) UnusedIsolatedDevicesByType(devType string) []*IsolatedDeviceDesc

func (*HostDesc) UnusedIsolatedDevicesByVendorModel

func (h *HostDesc) UnusedIsolatedDevicesByVendorModel(vendorModel string) []*IsolatedDeviceDesc

func (*HostDesc) XGet

func (h *HostDesc) XGet(key string, kind core.Kind) interface{}

type HostGroupCountDict

type HostGroupCountDict map[string]*GroupCounts

type IsolatedDeviceDesc

type IsolatedDeviceDesc struct {
	ID             string
	GuestID        string
	HostID         string
	DevType        string
	Model          string
	Addr           string
	VendorDeviceID string
}

func (*IsolatedDeviceDesc) VendorID

func (i *IsolatedDeviceDesc) VendorID() string

func (*IsolatedDeviceDesc) VendorModel

func (i *IsolatedDeviceDesc) VendorModel() string

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 *models.Host) (ret *ReservedResource)

func NewGuestReservedResourceUsedByBuilder

func NewGuestReservedResourceUsedByBuilder(b *HostBuilder, host *models.Host) (ret *ReservedResource, err error)

func NewReservedResource

func NewReservedResource(cpu, mem, storage int64) *ReservedResource

type Storage

type Storage struct {
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	Capacity      int64    `json:"capacity"`
	StorageType   string   `json:"type"`
	UsedCapacity  int64    `json:"used"`
	WasteCapacity int64    `json:"waste"`
	FreeCapacity  int64    `json:"free"`
	VCapacity     int64    `json:"vcapacity"`
	Cmtbound      float64  `json:"cmtbound"`
	StorageDriver string   `json:"driver"`
	Adapter       string   `json:"adapter"`
	Splits        []string `json:"splits"`
	Range         string   `json:"range"`
	Conf          string   `json:"conf"`
	MinStripSize  int      `json:"min_strip_size"`
	MaxStripSize  int      `json:"max_strip_size"`
	Size          int      `json:"size"`
}

func (*Storage) GetFreeSize

func (storage *Storage) GetFreeSize() int64

func (*Storage) GetTotalSize

func (storage *Storage) GetTotalSize() int64

func (*Storage) IsLocal

func (storage *Storage) IsLocal() bool

type SyncGroupCacher

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

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