api

package
v2.2.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: Apache-2.0 Imports: 10 Imported by: 17

Documentation

Index

Constants

View Source
const (
	HostTypeHost         = "host"
	HostTypeBaremetal    = "baremetal"
	SchedTypeGuest       = "guest"
	SchedTypeBaremetal   = "baremetal"
	SchedTypeContainer   = "container"
	SchedTypeEsxi        = "esxi"
	SchedTypeHyperV      = "hyperv"
	SchedTypeKvm         = "kvm"
	HostHypervisorForKvm = "hypervisor"
	HostTypeAliyun       = "aliyun"
	HostTypeAzure        = "azure"
	HostTypeKubelet      = "kubelet"

	AggregateStrategyRequire = "require"
	AggregateStrategyExclude = "exclude"
	AggregateStrategyPrefer  = "prefer"
	AggregateStrategyAvoid   = "avoid"

	// passthrough device type
	DIRECT_PCI_TYPE = "PCI"
	GPU_HPC_TYPE    = "GPU-HPC"
	GPU_VGA_TYPE    = "GPU-VGA"
	USB_TYPE        = "USB"
	NIC_TYPE        = "NIC"

	// Hard code vendor const
	NVIDIA           = "NVIDIA"
	AMD              = "AMD"
	NVIDIA_VENDOR_ID = "10de"
	AMD_VENDOR_ID    = "1002"
)
View Source
const (
	DefaultCandidateListArgsLimit = 20
)

Variables

View Source
var (
	AggregateStrategySets = sets.NewString(
		AggregateStrategyRequire,
		AggregateStrategyExclude,
		AggregateStrategyPrefer,
		AggregateStrategyAvoid,
	)

	PublicCloudProviders = sets.NewString(
		HostTypeAliyun,
		HostTypeAzure,
	)

	ValidGpuTypes = sets.NewString(
		GPU_HPC_TYPE,
		GPU_VGA_TYPE,
	)

	ValidPassthroughTypes = sets.NewString(
		DIRECT_PCI_TYPE,
		USB_TYPE,
		NIC_TYPE,
	).Union(ValidGpuTypes)

	IsolatedVendorIDMap = map[string]string{
		NVIDIA: NVIDIA_VENDOR_ID,
		AMD:    AMD_VENDOR_ID,
	}

	IsolatedIDVendorMap = map[string]string{}
)

Functions

func AggregateStrategyCheck

func AggregateStrategyCheck(strategy string) (err error)

Types

type Aggregate

type Aggregate struct {
	Idx      string `json:"idx"`
	Strategy string `json:"strategy"`
}

func NewSchedTagFromCmdline

func NewSchedTagFromCmdline(str string) (agg Aggregate, err error)

type CandidateDetailArgs

type CandidateDetailArgs struct {
	ID   string
	Type string
}

CandidateDetailArgs is a struct just for parsing candidate resource parameters.

func NewCandidateDetailArgs

func NewCandidateDetailArgs(sjson *simplejson.Json, id string) (*CandidateDetailArgs, error)

NewCandidateDetailArgs provides a function that will parse candidate's args from a json data.

type CandidateDetailResult

type CandidateDetailResult struct {
	Candidate interface{} `json:"candidate"`
}

type CandidateListArgs

type CandidateListArgs struct {
	Type      string
	Zone      string
	Pool      string
	Limit     int64
	Offset    int64
	Avaliable bool
}

CandidateListArgs is a struct just for parsing candidate resource list parameters.

func NewCandidateListArgs

func NewCandidateListArgs(sjson *simplejson.Json) (*CandidateListArgs, error)

NewCandidateListArgs provides a function that will parse candidate's list args from a json data.

type CandidateListResult

type CandidateListResult struct {
	Data   []CandidateListResultItem `json:"data"`
	Total  int64                     `json:"total"`
	Limit  int64                     `json:"limit"`
	Offset int64                     `json:"offset"`
}

type CandidateListResultItem

type CandidateListResultItem struct {
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Cpu          ResultResource `json:"cpu"`
	Mem          ResultResource `json:"mem"`
	Storage      ResultResource `json:"storage"`
	Status       string         `json:"status"`
	HostStatus   string         `json:"host_status"`
	EnableStatus string         `json:"enable_status"`
	HostType     string         `json:"host_type"`
}

type CleanupArgs

type CleanupArgs struct {
	ResType string
}

func NewCleanupArgs

func NewCleanupArgs(sjson *simplejson.Json) (*CleanupArgs, error)

type CleanupResult

type CleanupResult struct {
}

type CompletedNotifyArgs

type CompletedNotifyArgs struct {
	SessionID string
}

func NewCompletedNotifyArgs

func NewCompletedNotifyArgs(sjson *simplejson.Json, sessionId string) (*CompletedNotifyArgs, error)

type CompletedNotifyResult

type CompletedNotifyResult struct {
}

type Disk

type Disk struct {
	Backend         string  `json:"backend"`
	ImageID         string  `json:"image_id"`
	Fs              *string `json:"fs"`
	Os              string  `json:"os"`
	OSDistribution  string  `json:"os_distribution"`
	OsVersion       string  `json:"os_version"`
	Format          string  `json:"format"`
	MountPoint      *string `json:"mountpoint"`
	Driver          *string `json:"driver"`
	Cache           *string `json:"cache"`
	ImageDiskFormat string  `json:"image_disk_format"`
	Size            int64   `json:"size"`
	Storage         *string `json:"storage"`
}

type ExpireArgs

type ExpireArgs struct {
	DirtyHosts      []string
	DirtyBaremetals []string
}

type ExpireResult

type ExpireResult struct {
}

type ForGuest

type ForGuest struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type GroupRelation

type GroupRelation struct {
	GroupID  string `json:"group_id"`
	Strategy string `json:"strategy"`
	Scope    string `json:"scope"`
}

type HistoryArgs

type HistoryArgs struct {
	Offset int64
	Limit  int64
	All    bool
}

func NewHistoryArgs

func NewHistoryArgs(sjson *simplejson.Json) (*HistoryArgs, error)

type HistoryDetail

type HistoryDetail struct {
	Time      string        `json:"time"`
	Consuming string        `json:"consuming"`
	SessionID string        `json:"session_id"`
	Tasks     []HistoryTask `json:"tasks"`
	Input     string        `json:"input"`
	Output    string        `json:"output"`
	Error     string        `json:"error"`
}

type HistoryDetailArgs

type HistoryDetailArgs struct {
	ID  string
	Raw bool
	Log bool
}

func NewHistoryDetailArgs

func NewHistoryDetailArgs(sjson *simplejson.Json, id string) (*HistoryDetailArgs, error)

type HistoryDetailResult

type HistoryDetailResult struct {
	Detail *HistoryDetail `json:"history"`
}

type HistoryItem

type HistoryItem struct {
	Time         string   `json:"time"`
	Consuming    string   `json:"consuming"`
	SessionID    string   `json:"session_id"`
	Count        string   `json:"count"`
	Tenants      []string `json:"tenants"`
	Status       string   `json:"status"`
	Guests       []string `json:"guests"`
	IsSuggestion bool     `json:"is_suggestion"`
}

type HistoryResult

type HistoryResult struct {
	Items  []*HistoryItem `json:"data"`
	Total  int64          `json:"total"`
	Offset int64          `json:"offset"`
	Limit  int64          `json:"limit"`
}

type HistoryTask

type HistoryTask struct {
	Type      string     `json:"type"`
	Status    string     `json:"status"`
	Data      *SchedData `json:"data"`
	Time      string     `json:"time"`
	Consuming string     `json:"consuming"`
	//Result    []SchedResultItem `json:"result"`
	Result interface{} `json:"result"`
	Error  string      `json:"error"`
	Logs   []string    `json:"logs"`
}

type IsolatedDevice

type IsolatedDevice struct {
	ID     string `json:"id"`
	Type   string `json:"dev_type"`
	Model  string `json:"model"`
	Vendor string `json:"vendor"`
}

type Meta

type Meta map[string]string

type Network

type Network struct {
	Idx      string `json:"idx"`
	TenantId string `json:"tenant_id"`
	Private  bool   `json:"private"`
	Ports    int64  `json:"ports"`
	Exit     bool   `json:"exit"`
	Wire     string `json:"wire"`
	Mac      string `json:"mac"`
	Address  string `json:"address"`
	Address6 string `json:"address6"`
	Driver   string `json:"driver"`
	BwLimit  int64  `json:"bw_limit"`
	Vip      bool   `json:"vip"`
	Reserved bool   `json:"reserved"`
}

type ReservedResourcesArgs

type ReservedResourcesArgs struct {
	Name   string
	Remove string
}

type ReservedResourcesResult

type ReservedResourcesResult struct {
	Resources interface{} `json:"resources"`
}

type ResultResource

type ResultResource struct {
	Free     float64 `json:"free"`
	Reserved float64 `json:"reserverd"`
	Total    float64 `json:"total"`
}

func NewResultResource

func NewResultResource(f, r, t float64) *ResultResource

func NewResultResourceInt64

func NewResultResourceInt64(f, r, t int64) *ResultResource

func NewResultResourceString

func NewResultResourceString(free, reserverd, total string) (*ResultResource, error)

type SchedData

type SchedData struct {
	Tag             string            `json:"tag"`
	Type            string            `json:"type"`
	IsContainer     bool              `json:"is_container"`
	Count           int64             `json:"count"`
	ZoneID          string            `json:"zone_id"`
	PoolID          string            `json:"pool_id"`
	HostID          string            `json:"host_id"`
	Candidates      []string          `json:"candidates"`
	OwnerTenantID   string            `json:"owner_tenant_id"`
	OwnerUserID     string            `json:"owner_user_id"`
	VMEMSize        int64             `json:"vmem_size"`
	VCPUCount       int64             `json:"vcpu_count"`
	Disks           []*Disk           `json:"disks"`
	Name            string            `json:"name"`
	Networks        []*Network        `json:"networks"`
	IsolatedDevices []*IsolatedDevice `json:"isolated_devices"`
	Aggregates      []Aggregate       `json:"aggregate_stategy"`
	Meta            Meta              `json:"__meta__"`
	ForGuests       []*ForGuest       `json:"for_guests"`
	GuestStatus     string            `json:"guest_status"`
	Hypervisor      string            `json:"hypervisor"`

	// VM
	Groups         []string        `json:"group"`
	GroupRelations []GroupRelation `json:"group_relations"`

	// baremental
	BaremetalDiskConfigs []*baremetal.BaremetalDiskConfig `json:"baremetal_disk_config"`
}

func NewSchedData

func NewSchedData(sjson *simplejson.Json, count int64, byTest bool) (*SchedData, error)

func (*SchedData) AllDiskBackendSize

func (d *SchedData) AllDiskBackendSize() map[string]int64

func (*SchedData) IsPublicCloudProvider

func (d *SchedData) IsPublicCloudProvider() bool

func (*SchedData) SkipDirtyMarkHost

func (d *SchedData) SkipDirtyMarkHost() bool

type SchedErrItem

type SchedErrItem struct {
	Error string `json:"error"`
}

type SchedInfo

type SchedInfo struct {
	Data                  *SchedData      `json:"scheduler"`
	IgnoreFilters         map[string]bool `json:"ignore_filters"`
	SessionID             string          `json:"session_id"`
	IsSuggestion          bool            `json:"suggestion"`
	ShowSuggestionDetails bool            `json:"suggestion_details"`
	SuggestionLimit       int64           `json:"suggestion_limit"`
	SuggestionAll         bool            `json:"suggestion_all"`
	Raw                   string          `json:"raw"`
	BestEffort            bool            `json:"best_effort"`
}

func NewSchedInfo

func NewSchedInfo(sjson *simplejson.Json, byTest bool) (*SchedInfo, error)

func (*SchedInfo) String

func (i *SchedInfo) String() (string, error)

type SchedNormalResultItem

type SchedNormalResultItem struct {
	ID   string                 `json:"id"`
	Name string                 `json:"name"`
	Data map[string]interface{} `json:"data"`
}

type SchedResult

type SchedResult struct {
	Items []SchedResultItem `json:"scheduler"`
}

type SchedResultItem

type SchedResultItem interface{}

type SchedSuccItem

type SchedSuccItem struct {
	Candidate SchedNormalResultItem `json:"candidate"`
}

type SchedTestResult

type SchedTestResult struct {
	Data   interface{} `json:"data"`
	Total  int64       `json:"total"`
	Limit  int64       `json:"limit"`
	Offset int64       `json:"offset"`
}

Jump to

Keyboard shortcuts

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