api

package
v2.0.18+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

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"
	HostTypeKubelet      = "kubelet"

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

	// Baremetal related const
	DISK_CONF_RAID0  = "raid0"
	DISK_CONF_RAID1  = "raid1"
	DISK_CONF_RAID5  = "raid5"
	DISK_CONF_RAID10 = "raid10"
	DISK_CONF_NONE   = "none"

	DEFAULT_DISK_CONF = DISK_CONF_NONE

	DISK_TYPE_ROTATE = "rotate"
	DISK_TYPE_SSD    = "ssd"
	DISK_TYPE_HYBRID = "hybrid"

	DEFAULT_DISK_TYPE = DISK_TYPE_ROTATE

	DISK_DRIVER_MEGARAID   = "MegaRaid"
	DISK_DRIVER_LINUX      = "Linux"
	DISK_DRIVER_HPSARAID   = "HPSARaid"
	DISK_DRIVER_MPT2SAS    = "Mpt2SAS"
	DISK_DRIVER_MARVELRAID = "MarvelRaid"
	DISK_DRIVER_PCIE       = "PCIE"

	HDD_DISK_SPEC_TYPE = "HDD"
	SSD_DISK_SPEC_TYPE = "SSD"

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

	BaremetalDefaultDiskConfig = BaremetalDiskConfig{
		Type:  DISK_TYPE_HYBRID,
		Conf:  DISK_CONF_NONE,
		Count: 0,
	}

	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 BaremetalDiskConfig

type BaremetalDiskConfig struct {
	// disk type
	Type string `json:"type"`
	// raid config
	Conf         string  `json:"conf"`
	Count        int64   `json:"count"`
	Range        []int64 `json:"range"`
	Splits       string  `json:"splits"`
	Adapter      *int    `json:"adapter"`
	Driver       string  `json:"driver"`
	Cachedbadbbu bool    `json:"cachedbadbbu"`
	Strip        int64   `json:"strip"`
	RA           bool    `json:"ra"`
	WT           bool    `json:"wt"`
	Direct       bool    `json:"direct"`
}

type BaremetalStorage

type BaremetalStorage struct {
	Slot         int    `json:"slot"`
	Status       string `json:"status"`
	Rotate       bool   `json:"rotate"`
	Adapter      int    `json:"adapter"`
	Driver       string `json:"driver"`
	Model        string `json:"model"`
	Enclosure    int    `json:"enclousure"`
	Size         int64  `json:"size"`
	MinStripSize int64  `json:"min_strip_size,omitempty"`
	MaxStripSize int64  `json:"max_strip_size,omitempty"`
	Index        int64  `json:"index"`
}

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 []*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