consts

package
v0.0.0-...-5746ace Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdCreateImage = `qemu-img create -f qcow2 -F qcow2 \
-o cluster_size=2M,backing_file=%s \
%s %dG
`

	CmdCreateVm = `` /* 252-byte string literal not displayed */

	CmdStartVm = `virsh --connect qemu:///system start %s`

	CmdExportVm = `qemu-img convert -f qcow2 -O qcow2 -c %s %s`
)
View Source
const (
	AppName          = "zagent"
	AppNameAgent     = "agent"
	AppNameAgentHost = "host"
	AppNameAgentVm   = "vm"

	UploadMaxSize = 100000

	AgentCheckExecutionInterval = 15          // sec
	AgentCheckDownloadInterval  = 15          // sec
	WebCheckInterval            = 60          // sec
	DownloadImageTimeout        = 4 * 60 * 60 // sec
	ExportVmTimeout             = 1 * 60 * 60 // sec
	CreateSnapTimeout           = 30 * 60     // sec
	DownloadRetry               = 3

	DeviceRegisterExpireTime = 5 * 60 // sec

	// Must > WaitResPendingTimeout
	WaitResPendingTimeout   = 60 * 60 // sec
	WaitResReadyTimeout     = 60 * 60 // sec
	WaitRunCompletedTimeout = 60 * 60 // sec
	WaitVmLifecycleTimeout  = 60 * 60 // sec
	WaitAgentRunTaskTimeout = 30 * 60 // sec

	QueueRetryTime = 3

	DiskSizeWindows = 40 // G
	DiskSizeLinux   = 30
	DiskSizeDefault = 30

	DriverDownloadUrl = "https://dl.cnezsoft.com/driver/"
	ResDownDir        = "down"
	ResDriverDir      = "driver"
	ResDriverName     = "driver"

	KvmHostIpInNatNetwork = "192.168.122.1"

	SshServicePost       = 22
	AgentHostServicePort = 55001
	WebsockifyPort       = 55002
	NatPortStart         = 55100
	NatPortEnd           = 55199

	AgentVmServicePort = 55201
	ZtfServicePort     = 56202
	ZdServicePort      = 56203

	FolderKvm      = "kvm"
	FolderIso      = "iso"
	FolderDownload = "download"
	FolderBacking  = "backing"
	FolderImage    = "image"
	FolderSnap     = "snap"
	FolderToken    = "token"

	FolderNovnc      = "novnc"
	FolderWebsockify = "websockify"

	FolderZtf = "ztf"
	FolderZd  = "zd"

	Localhost = "127.0.0.1"

	QiNiuUrl           = "https://dl.cnezsoft.com/"
	VersionDownloadUrl = QiNiuUrl + "%s/version.txt"
	PackageDownloadUrl = QiNiuUrl + "%s/%s/%s/%s.zip"

	ALIYUN_ECS_URL     = "ecs-%s.aliyuncs.com"
	ALIYUN_ECS_URL_VNC = "https://g.alicdn.com/aliyun/ecs-console-vnc2/0.0.8/index.html" +
		"?vncUrl=%s&instanceId=%s&isWindows=%t&password=%s"
	ALIYUN_ECI_URL = "eci.aliyuncs.com"
	ALIYUN_VPC_URL = "vpc.aliyuncs.com"

	HuaweiCloudUrlJobCreate  = "https://cci.%s.myhuaweicloud.cn/apis/batch/v1/namespaces/%s/jobs"
	HuaweiCloudUrlJobDestroy = "https://cci.%s.myhuaweicloud.cn/apis/batch/v1/namespaces/%s/jobs/%s"
)

Variables

View Source
var (
	ConfigFile     = filepath.Join("conf", AppNameAgent+".yaml")
	LogDir         = fmt.Sprintf("log%s", _const.PthSep)
	ControlActions = []string{"start", "stop", "restart", "install", "uninstall"}

	DownloadDir   = ""
	NovncDir      = ""
	WebsockifyDir = ""
	WorkDir       = ""

	AuthSecret  = ""
	AuthToken   = ""
	ExpiredDate = time.Now()

	Verbose          = false
	ExistVncPortMap  = sync.Map{}
	ExistHttpPortMap = sync.Map{}
	ExistSshPortMap  = sync.Map{}

	PrintLog = true

	ZtfUuid = "net-zentao-b08c691053ba49daaffcedde352406ae-ztf"
	ZdUuid  = "net-zentao-b08c691053ba49daaffcedde352406ae-zd"
)

Functions

This section is empty.

Types

type BrowserType

type BrowserType string
const (
	Chrome  BrowserType = "chrome"
	Firefox BrowserType = "firefox"
	Edge    BrowserType = "edge"
	IE      BrowserType = "ie"
)

func (BrowserType) ToString

func (e BrowserType) ToString() string

type BuildProgress

type BuildProgress string
const (
	// start group
	ProgressCreated BuildProgress = "created"

	// res group
	ProgressResPending     BuildProgress = "res_pending"
	ProgressResLaunched    BuildProgress = "res_launched"
	ProgressResReady       BuildProgress = "res_ready"
	ProgressResFailed      BuildProgress = "res_failed"
	ProgressResDestroy     BuildProgress = "res_destroy"
	ProgressResFailDestroy BuildProgress = "res_fail_destroy"

	// exec group
	ProgressRunning BuildProgress = "running"
	ProgressRunFail BuildProgress = "run_fail"

	// end group
	ProgressCompleted BuildProgress = "completed"
	ProgressTimeout   BuildProgress = "timeout"
	ProgressTerminal  BuildProgress = "terminal"
	ProgressCancel    BuildProgress = "cancel"
)

func (BuildProgress) ToString

func (e BuildProgress) ToString() string

type BuildStatus

type BuildStatus string
const (
	StatusCreated BuildStatus = "created"
	StatusPass    BuildStatus = "pass"
	StatusFail    BuildStatus = "fail"
)

func (BuildStatus) ToString

func (e BuildStatus) ToString() string

type BuildType

type BuildType string
const (
	ZtfTest       BuildType = "ztf"
	SeleniumTest  BuildType = "selenium"
	AppiumTest    BuildType = "appium"
	UnitTest      BuildType = "unittest"
	InterfaceTest BuildType = "interface"
)

func (BuildType) ToString

func (e BuildType) ToString() string

type DeviceStatus

type DeviceStatus string
const (
	DeviceOff     DeviceStatus = "off"
	DeviceOn      DeviceStatus = "on"
	DeviceActive  DeviceStatus = "active"
	DeviceBusy    DeviceStatus = "busy"
	DeviceUnknown DeviceStatus = "unknown"
)

func (DeviceStatus) ToString

func (e DeviceStatus) ToString() string

type EntityType

type EntityType string
const (
	Task  EntityType = "task"
	Queue EntityType = "queue"
	Build EntityType = "build"
	Vm    EntityType = "vm"
)

func (EntityType) ToString

func (e EntityType) ToString() string

type HostCapability

type HostCapability string
const (
	PlatformVm     HostCapability = "vm"
	PlatformDocker HostCapability = "docker"

	PlatformNative HostCapability = "native"
	PlatformCloud  HostCapability = "cloud"
)

func (HostCapability) ToString

func (e HostCapability) ToString() string

type HostService

type HostService string
const (
	ServiceKvm        HostService = "kvm"
	ServiceNginx      HostService = "nginx"
	ServiceNovnc      HostService = "novnc"
	ServiceWebsockify HostService = "websockify"

	ServiceZtf HostService = "ztf"
	ServiceZd  HostService = "zd"

	ServiceAll HostService = "all"
)

func (HostService) ToString

func (e HostService) ToString() string

type HostServiceStatus

type HostServiceStatus string
const (
	HostServiceReady        HostServiceStatus = "ready"
	HostServiceNotAvailable HostServiceStatus = "not_available"
	HostServiceNotInstall   HostServiceStatus = "not_install"
	HostServiceUnknown      HostServiceStatus = "unknown"
)

func (HostServiceStatus) ToString

func (e HostServiceStatus) ToString() string

type HostStatus

type HostStatus string
const (
	HostOnline  HostStatus = "online"
	HostOffline HostStatus = "offline"
	HostBusy    HostStatus = "busy" // report by agent on host
)

func (HostStatus) ToString

func (e HostStatus) ToString() string

type HostVendor

type HostVendor string
const (
	HostVendorVirtualBox  HostVendor = "virtualbox"
	HostVendorVmWare      HostVendor = "vmware"
	HostVendorHuaweiCloud HostVendor = "huaweicloud"
	HostVendorAliyun      HostVendor = "aliyun"

	HostVendorPve       HostVendor = "pve"
	HostVendorPortainer HostVendor = "portainer"
)

func (HostVendor) ToString

func (e HostVendor) ToString() string

type NatForwardType

type NatForwardType string
const (
	Http   NatForwardType = "http"
	Stream NatForwardType = "stream"
	All    NatForwardType = "*"
)

func (NatForwardType) ToString

func (e NatForwardType) ToString() string

type OsCategory

type OsCategory string
const (
	Windows OsCategory = "windows"
	Linux   OsCategory = "linux"
	Mac     OsCategory = "mac"
)

func (OsCategory) ToString

func (e OsCategory) ToString() string

type OsDevice

type OsDevice string
const (
	Android OsDevice = "android"
	Ios     OsDevice = "ios"
	Harmony OsDevice = "harmony"
)

func (OsDevice) ToString

func (e OsDevice) ToString() string

type OsLang

type OsLang string
const (
	EN_US OsLang = "en_us"
	ZH_CN OsLang = "zh_cn"
	ZH_TW OsLang = "zh_tw"
)

func (OsLang) ToString

func (e OsLang) ToString() string

type OsType

type OsType string
const (
	Win10 OsType = "win10"
	Win7  OsType = "win7"
	WinXP OsType = "winxp"

	Ubuntu OsType = "ubuntu"
	CentOS OsType = "centos"
	Debian OsType = "debian"
)

func (OsType) ToString

func (e OsType) ToString() string

type ResultCode

type ResultCode string
const (
	ResultPass ResultCode = "success"
	ResultFail ResultCode = "fail"

	ResultUnauthorized ResultCode = "unauthorized"

	BizVmNotExist    ResultCode = "biz_vm_not_exist"
	BizImageNotExist ResultCode = "biz_image_not_exist"

	BizReady               ResultCode = "biz_ready"
	BizNotInstall          ResultCode = "biz_not_install"
	BizServiceNotAvailable ResultCode = "biz_service_not_available"
)

func (ResultCode) String

func (c ResultCode) String() string

type RunMode

type RunMode string
const (
	RunModeHost RunMode = "host"
	RunModeVm   RunMode = "vm"

	RunModeMachine RunMode = "machine"
	RunModeAndroid RunMode = "android"
	RunModeIos     RunMode = "ios"
)

func (RunMode) ToString

func (e RunMode) ToString() string

type ServiceStatus

type ServiceStatus string
const (
	ServiceOffline ServiceStatus = "offline"
	ServiceOnline  ServiceStatus = "online"
	ServiceReady   ServiceStatus = "ready"
	ServiceBusy    ServiceStatus = "busy"
)

func (ServiceStatus) ToString

func (e ServiceStatus) ToString() string

type TaskStatus

type TaskStatus string
const (
	Created    TaskStatus = "created"
	Inprogress TaskStatus = "inprogress"

	// temp status
	Timeout TaskStatus = "timeout"
	Error   TaskStatus = "error"

	// final status
	Canceled  TaskStatus = "canceled"
	Completed TaskStatus = "completed"
	Failed    TaskStatus = "failed"
)

func (TaskStatus) ToString

func (e TaskStatus) ToString() string

type TaskType

type TaskType string
const (
	DownloadImage TaskType = "downloadImage"
	ExportVm      TaskType = "exportVm"
	CreateSnap    TaskType = "createSnap"
	RevertSnap    TaskType = "revertSnap"
)

func (TaskType) ToString

func (e TaskType) ToString() string

type VmStatus

type VmStatus string
const (
	VmCreated    VmStatus = "created"        // set first time created
	VmLaunch     VmStatus = "launch"         // set after success to call vm creating remotely
	VmFailCreate VmStatus = "vm_fail_create" // set after fail to call vm creating remotely

	VmRunning VmStatus = "running" // report by agent on host
	VmShutOff VmStatus = "shutoff" // report by agent on host
	VmPaused  VmStatus = "suspend" // report by agent on host

	VmBusy  VmStatus = "busy"  // report by agent in vm
	VmReady VmStatus = "ready" // report by agent in vm

	VmUnknown     VmStatus = "unknown"      // report by agent on host, not running, destroy and shutoff
	VmDestroy     VmStatus = "destroy"      // final status
	VmDestroyFail VmStatus = "destroy_fail" // set after fail to call vm destroy remotely
)

func (VmStatus) ToString

func (e VmStatus) ToString() string

Jump to

Keyboard shortcuts

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