hostutils

package
v0.0.0-...-2b29b9b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 28 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamsError = fmt.Errorf("Delay task parse params error")
)

Functions

func DelayKubeTask

func DelayKubeTask(ctx context.Context, task workmanager.DelayTaskFunc, params interface{})

func DelayTask

func DelayTask(ctx context.Context, task workmanager.DelayTaskFunc, params interface{})

func DelayTaskWithWorker

func DelayTaskWithWorker(
	ctx context.Context, task workmanager.DelayTaskFunc,
	params interface{}, worker *appsrv.SWorkerManager,
)

func DelayTaskWithoutReqctx

func DelayTaskWithoutReqctx(ctx context.Context, task workmanager.DelayTaskFunc, params interface{})

func GetComputeSession

func GetComputeSession(ctx context.Context) *mcclient.ClientSession

func GetImageSession

func GetImageSession(ctx context.Context) *mcclient.ClientSession

func GetK8sSession

func GetK8sSession(ctx context.Context) *mcclient.ClientSession

func GetWireInfo

func GetWireInfo(ctx context.Context, wireId string) (jsonutils.JSONObject, error)

func GetWireOfIp

func GetWireOfIp(ctx context.Context, params jsonutils.JSONObject) (jsonutils.JSONObject, error)

func GetWorkManager

func GetWorkManager() *workmanager.SWorkManager

func Init

func Init()

func InitK8sWorkerManager

func InitK8sWorkerManager()

func InitWorkerManager

func InitWorkerManager()

func InitWorkerManagerWithCount

func InitWorkerManagerWithCount(count int)

func IsGuestDir

func IsGuestDir(f os.FileInfo, serversPath string) bool

func K8sTaskComplete

func K8sTaskComplete(ctx context.Context, params jsonutils.JSONObject)

func K8sTaskFailed

func K8sTaskFailed(ctx context.Context, reason string)

func RemoteStoragecacheCacheImage

func RemoteStoragecacheCacheImage(ctx context.Context, storagecacheId, imageId, status, spath string) (jsonutils.JSONObject, error)

func Response

func Response(ctx context.Context, w http.ResponseWriter, res interface{})

func ResponseOk

func ResponseOk(ctx context.Context, w http.ResponseWriter)

func TaskComplete

func TaskComplete(ctx context.Context, params jsonutils.JSONObject)

func TaskFailed

func TaskFailed(ctx context.Context, reason string)

func TaskFailed2

func TaskFailed2(ctx context.Context, reason string, params *jsonutils.JSONDict)

func UpdateContainerStatus

func UpdateContainerStatus(ctx context.Context, cid string, statusInput *computeapi.ContainerPerformStatusInput) (jsonutils.JSONObject, error)

func UpdateServerProgress

func UpdateServerProgress(ctx context.Context, sid string, progress, progressMbps float64) (jsonutils.JSONObject, error)

func UpdateServerStatus

func UpdateServerStatus(ctx context.Context, sid string, statusInput *apis.PerformStatusInput) (jsonutils.JSONObject, error)

Types

type IHost

type IHost interface {
	GetZoneId() string
	GetHostId() string
	GetMasterIp() string
	GetCpuArchitecture() string
	GetKernelVersion() string
	IsAarch64() bool
	IsX8664() bool
	GetHostTopology() *hostapi.HostTopology
	GetReservedCpusInfo() *cpuset.CPUSet
	GetReservedMemMb() int

	IsHugepagesEnabled() bool
	HugepageSizeKb() int
	IsNumaAllocateEnabled() bool
	CpuCmtBound() float32
	MemCmtBound() float32

	IsKvmSupport() bool
	IsNestedVirtualization() bool

	PutHostOnline() error
	StartDHCPServer()

	GetBridgeDev(bridge string) hostbridge.IBridgeDriver
	GetIsolatedDeviceManager() isolated_device.IsolatedDeviceManager

	GetKubeletConfig() kubelet.KubeletConfig

	// containerd related methods
	IsContainerHost() bool
	GetContainerRuntimeEndpoint() string
	GetCRI() pod.CRI
	GetContainerCPUMap() *pod.HostContainerCPUMap
	GetContainerCpufreqSimulateConfig() *jsonutils.JSONDict

	OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3)
}

type SContainerCpufreqSimulateConfig

type SContainerCpufreqSimulateConfig struct {
	CpuinfoMaxFreq            int    `json:"cpuinfo_max_freq"`
	CpuinfoMinFreq            int    `json:"cpuinfo_min_freq"`
	CpuinfoCurFreq            int    `json:"cpuinfo_cur_freq"`
	CpuinfoTransitionLatency  int    `json:"cpuinfo_transition_latency"`
	ScalingDriver             string `json:"scaling_driver"`
	ScalingGovernors          string `json:"scaling_governor"`
	ScalingMaxFreq            int    `json:"scaling_max_freq"`
	ScalingMinFreq            int    `json:"scaling_min_freq"`
	ScalingCurFreq            int    `json:"scaling_cur_freq"`
	ScalingSetspeed           string `json:"scaling_setspeed"`
	ScalingAvailableGovernors string `json:"scaling_available_governors"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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