mcis

package
v0.0.0-...-3d28840 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AutoStatusReady is const for "Ready" status.
	AutoStatusReady string = "Ready"
	// AutoStatusChecking is const for "Checking" status.
	AutoStatusChecking string = "Checking"
	// AutoStatusDetected is const for "Detected" status.
	AutoStatusDetected string = "Detected"
	// AutoStatusOperating is const for "Operating" status.
	AutoStatusOperating string = "Operating"
	// AutoStatusStabilizing is const for "Stabilizing" status.
	AutoStatusStabilizing string = "Stabilizing"
	// AutoStatusTimeout is const for "Timeout" status.
	AutoStatusTimeout string = "Timeout"
	// AutoStatusError is const for "Failed" status.
	AutoStatusError string = "Failed"
	// AutoStatusSuspended is const for "Suspended" status.
	AutoStatusSuspended string = "Suspended"
)

Status for mcis automation

View Source
const (
	// AutoActionScaleOut is const for "ScaleOut" action.
	AutoActionScaleOut string = "ScaleOut"
	// AutoActionScaleIn is const for "ScaleIn" action.
	AutoActionScaleIn string = "ScaleIn"
)

Action for mcis automation

View Source
const ActionComplete string = "None"

const ActionComplete

View Source
const ActionCreate string = "Create"

const ActionCreate

View Source
const ActionReboot string = "Reboot"

const ActionReboot

View Source
const ActionResume string = "Resume"

const ActionResume

View Source
const ActionSuspend string = "Suspend"

const ActionSuspend

View Source
const ActionTerminate string = "Terminate"

const ActionTerminate

View Source
const StatusComplete string = "None"

const StatusComplete

View Source
const StatusCreating string = "Creating"

const StatusCreating

View Source
const StatusFailed string = "Failed"

const StatusFailed

View Source
const StatusRebooting string = "Rebooting"

const StatusRebooting

View Source
const StatusResuming string = "Resuming"

const StatusResuming

View Source
const StatusRunning string = "Running"

const StatusRunning

View Source
const StatusSuspended string = "Suspended"

const StatusSuspended

View Source
const StatusSuspending string = "Suspending"

const StatusSuspending

View Source
const StatusTerminated string = "Terminated"

const StatusTerminated

View Source
const StatusTerminating string = "Terminating"

const StatusTerminating

View Source
const StatusUndefined string = "Undefined"

const StatusUndefined

Variables

This section is empty.

Functions

func AddVmToMcis

func AddVmToMcis(wg *sync.WaitGroup, nsId string, mcisId string, vmInfoData *TbVmInfo) error

func CallGetMonitoringAsync

func CallGetMonitoringAsync(wg *sync.WaitGroup, nsID string, mcisID string, vmID string, vmIP string, method string, metric string, cmd string, returnResult *[]MonResultSimple)

func CallMilkyway

func CallMilkyway(wg *sync.WaitGroup, vmList []string, nsId string, mcisId string, vmId string, vmIp string, action string, option string, results *BenchmarkInfoArray)

func CallMonitoringAsync

func CallMonitoringAsync(wg *sync.WaitGroup, nsID string, mcisID string, vmID string, givenUserName string, method string, cmd string, returnResult *[]SshCmdResult)

func CheckAllowedTransition

func CheckAllowedTransition(nsId string, mcisId string, action string) error

func CheckConnectivity

func CheckConnectivity(host string, port string) error

CheckConnectivity func checks if given port is open and ready. For instance, ready for ssh port can be checkek.

func CheckDragonflyEndpoint

func CheckDragonflyEndpoint() error

Module for checking CB-Dragonfly endpoint (call get config)

func CheckMcis

func CheckMcis(nsId string, mcisId string) (bool, error)

func CheckMcisPolicy

func CheckMcisPolicy(nsId string, mcisId string) (bool, error)

func CheckVm

func CheckVm(nsId string, mcisId string, vmId string) (bool, error)

func Close

func Close(client scp.Client)

func Connect

func Connect(sshInfo SSHInfo) (scp.Client, error)

func ConnectKeyPath

func ConnectKeyPath(sshKeyPathInfo SSHKeyPathInfo) (scp.Client, error)

func ControlMcis

func ControlMcis(nsId string, mcisId string, action string) error

func ControlMcisAsync

func ControlMcisAsync(nsId string, mcisId string, action string) error

func ControlVm

func ControlVm(nsId string, mcisId string, vmId string, action string) error

func ControlVmAsync

func ControlVmAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, action string, results *ControlVmResultWrapper) error

func Copy

func Copy(client scp.Client, sourcePath string, remotePath string) error

func CoreDelAllMcis

func CoreDelAllMcis(nsId string, option string) (string, error)

func CoreGetMcisVmAction

func CoreGetMcisVmAction(nsId string, mcisId string, vmId string, action string) (string, error)

func CorePostCmdMcisVm

func CorePostCmdMcisVm(nsId string, mcisId string, vmId string, req *McisCmdReq) (string, error)

func CreateVm

func CreateVm(nsId string, mcisId string, vmInfoData *TbVmInfo) error

func DelAllMcisPolicy

func DelAllMcisPolicy(nsId string) (string, error)

DelAllMcisPolicy deletes all McisPolicyInfo objects.

func DelMcis

func DelMcis(nsId string, mcisId string, option string) error

func DelMcisPolicy

func DelMcisPolicy(nsId string, mcisId string) error

DelMcisPolicy deletes McisPolicyInfo object by mcisId.

func DelMcisVm

func DelMcisVm(nsId string, mcisId string, vmId string, option string) error

func GetVmIp

func GetVmIp(nsId string, mcisId string, vmId string) (string, string)

func GetVmListByLabel

func GetVmListByLabel(nsId string, mcisId string, label string) ([]string, error)

func GetVmSpecId

func GetVmSpecId(nsId string, mcisId string, vmId string) string

func GetVmSshKey

func GetVmSshKey(nsId string, mcisId string, vmId string) (string, string, string)

func GetVmStatusAsync

func GetVmStatusAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, results *McisStatusInfo) error

func HandleMcisAction

func HandleMcisAction(nsId string, mcisId string, action string) (string, error)

func InspectVMs

func InspectVMs(connConfig string) (interface{}, error)

InspectVMs returns the state list of TB VM objects of given connConfig

func ListMcisId

func ListMcisId(nsId string) ([]string, error)

func ListMcisPolicyId

func ListMcisPolicyId(nsId string) []string

ListMcisPolicyId returns a list of Ids for all McisPolicyInfo objects .

func ListVmGroupId

func ListVmGroupId(nsId string, mcisId string) ([]string, error)

func ListVmGroupId returns list of VmGroups in a given MCIS.

func ListVmId

func ListVmId(nsId string, mcisId string) ([]string, error)

func OrchestrationController

func OrchestrationController()

OrchestrationController is responsible for executing MCIS automation policy. OrchestrationController will be periodically involked by a time.NewTicker in main.go.

func RecommendVm

func RecommendVm(nsId string, plan DeploymentPlan) ([]mcir.TbSpecInfo, error)

// Info manage for MCIS recommendation

func RecommendVmLocation

func RecommendVmLocation(nsId string, specList *[]mcir.TbSpecInfo, param *[]ParameterKeyVal) ([]mcir.TbSpecInfo, error)

RecommendVmLocation func prioritize specs based on given location

func RunCommand

func RunCommand(client scp.Client, cmd string) (string, error)

func RunSSH

func RunSSH(vmIP string, sshPort string, userName string, privateKey string, cmd string) (*string, error)

func RunSSHAsync

func RunSSHAsync(wg *sync.WaitGroup, vmID string, vmIP string, sshPort string, userName string, privateKey string, cmd string, returnResult *[]SshCmdResult)

func SSHCopy

func SSHCopy(sshInfo SSHInfo, sourcePath string, remotePath string) error

func SSHCopyByKeyPath

func SSHCopyByKeyPath(sshInfo SSHKeyPathInfo, sourcePath string, remotePath string) error

func SSHRun

func SSHRun(sshInfo SSHInfo, cmd string) (string, error)

=============== for One Call Service

func SSHRunByKeyPath

func SSHRunByKeyPath(sshInfo SSHKeyPathInfo, cmd string) (string, error)

func TrimIP

func TrimIP(sshAccessPoint string) (string, error)

func UpdateMcisInfo

func UpdateMcisInfo(nsId string, mcisInfoData TbMcisInfo)

UpdateMcisInfo func Update MCIS Info (without VM info in MCIS)

func UpdateMcisPolicyInfo

func UpdateMcisPolicyInfo(nsId string, mcisPolicyInfoData McisPolicyInfo)

UpdateMcisPolicyInfo updates McisPolicyInfo object in DB.

func UpdateVmInfo

func UpdateVmInfo(nsId string, mcisId string, vmInfoData TbVmInfo)

func UpdateVmPublicIp

func UpdateVmPublicIp(nsId string, mcisId string, vmInfoData TbVmInfo) error

func UpdateVmSshKey

func UpdateVmSshKey(nsId string, mcisId string, vmId string, verifiedUserName string) error

func UpdateVmInfo(nsId string, mcisId string, vmInfoData TbVmInfo)

func VerifySshUserName

func VerifySshUserName(nsId string, mcisId string, vmId string, vmIp string, sshPort string, givenUserName string) (string, string, error)

Types

type AgentInstallContent

type AgentInstallContent struct {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
}

AgentInstallContent ...

type AgentInstallContentWrapper

type AgentInstallContentWrapper struct {
	Result_array []AgentInstallContent `json:"result_array"`
}

AgentInstallContentWrapper ...

func InstallAgentToMcis

func InstallAgentToMcis(nsId string, mcisId string, req *McisCmdReq) (AgentInstallContentWrapper, error)

func InstallMonitorAgentToMcis

func InstallMonitorAgentToMcis(nsId string, mcisId string, req *McisCmdReq) (AgentInstallContentWrapper, error)

type AutoAction

type AutoAction struct {
	ActionType    string     `json:"actionType"`
	Vm            TbVmInfo   `json:"vm"`
	PostCommand   McisCmdReq `json:"postCommand"`
	PlacementAlgo string     `json:"placementAlgo"`
}

AutoAction is struct for MCIS auto-control action.

type AutoCondition

type AutoCondition struct {
	Metric           string   `json:"metric"`
	Operator         string   `json:"operator"`         // <, <=, >, >=, ...
	Operand          string   `json:"operand"`          // 10, 70, 80, 98, ...
	EvaluationPeriod string   `json:"evaluationPeriod"` // evaluationPeriod
	EvaluationValue  []string `json:"evaluationValue"`
}

AutoCondition is struct for MCIS auto-control condition.

type BenchmarkInfo

type BenchmarkInfo struct {
	Result      string          `json:"result"`
	Unit        string          `json:"unit"`
	Desc        string          `json:"desc"`
	Elapsed     string          `json:"elapsed"`
	SpecId      string          `json:"specid"`
	ResultArray []BenchmarkInfo `json:"resultarray"` // struct-element cycle ?
}

type BenchmarkInfoArray

type BenchmarkInfoArray struct {
	ResultArray []BenchmarkInfo `json:"resultarray"`
}

func BenchmarkAction

func BenchmarkAction(nsId string, mcisId string, action string, option string) (BenchmarkInfoArray, error)

func CoreGetAllBenchmark

func CoreGetAllBenchmark(nsId string, mcisId string, host string) (*BenchmarkInfoArray, error)

func CoreGetBenchmark

func CoreGetBenchmark(nsId string, mcisId string, action string, host string) (*BenchmarkInfoArray, error)

type BenchmarkReq

type BenchmarkReq struct {
	Host string `json:"host"`
	Spec string `json:"spec"`
}

type ControlVmResult

type ControlVmResult struct {
	VmId   string `json:"vmId"`
	Status string `json:"Status"`
	Error  error  `json:"Error"`
}

type ControlVmResultWrapper

type ControlVmResultWrapper struct {
	ResultArray []ControlVmResult `json:"resultarray"`
}

type DeploymentPlan

type DeploymentPlan struct {
	Filter   FilterInfo   `json:"filter"`
	Priority PriorityInfo `json:"priority"`
	Limit    string       `json:"limit" example:"5" enums:"1,2,...,30,..."`
}

DeploymentPlan is struct for .

type FilterCondition

type FilterCondition struct {
	Metric    string      `json:"metric" example:"num_vCPU" enums:"num_vCPU,mem_GiB,Cost_per_hour"`
	Condition []Operation `json:"condition"`
}

FilterCondition is struct for .

type FilterInfo

type FilterInfo struct {
	Policy []FilterCondition `json:"policy"`
}

FilterInfo is struct for .

type GeoLocation

type GeoLocation struct {
	Latitude     string `json:"latitude"`
	Longitude    string `json:"longitude"`
	BriefAddr    string `json:"briefAddr"`
	CloudType    string `json:"cloudType"`
	NativeRegion string `json:"nativeRegion"`
}

func GetCloudLocation

func GetCloudLocation(cloudType string, nativeRegion string) GeoLocation

GetCloudLocation. (need error handling)

type McisCmdReq

type McisCmdReq struct {
	UserName string `json:"userName" example:"cb-user" default:""`
	Command  string `json:"command" example:"sudo apt-get install ..." default:""`
}

McisCmdReq is remote command struct

type McisPolicyInfo

type McisPolicyInfo struct {
	Name   string   `json:"Name"` //MCIS Name (for request)
	Id     string   `json:"Id"`   //MCIS Id (generated ID by the Name)
	Policy []Policy `json:"policy"`

	ActionLog   string `json:"actionLog"`
	Description string `json:"description"`
}

McisPolicyInfo is struct for MCIS auto-control Policy object.

func CreateMcisPolicy

func CreateMcisPolicy(nsId string, mcisId string, u *McisPolicyInfo) (McisPolicyInfo, error)

CreateMcisPolicy create McisPolicyInfo object in DB according to user's requirements.

func GetAllMcisPolicyObject

func GetAllMcisPolicyObject(nsId string) ([]McisPolicyInfo, error)

GetAllMcisPolicyObject returns all McisPolicyInfo objects.

func GetMcisPolicyObject

func GetMcisPolicyObject(nsId string, mcisId string) (McisPolicyInfo, error)

GetMcisPolicyObject returns McisPolicyInfo object.

type McisRecommendReq

type McisRecommendReq struct {
	VmReq          []TbVmRecommendReq `json:"vmReq"`
	PlacementAlgo  string             `json:"placementAlgo"`
	PlacementParam []common.KeyValue  `json:"placementParam"`
	MaxResultNum   string             `json:"maxResultNum"`
}

type McisStatusInfo

type McisStatusInfo struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	//Vm_num string         `json:"vm_num"`
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"[yes, no]"` // yes or no

	MasterVmId    string `json:"masterVmId" example:"vm-asiaeast1-cb-01"`
	MasterIp      string `json:"masterIp" example:"32.201.134.113"`
	MasterSSHPort string `json:"masterSSHPort"`

	Vm []TbVmStatusInfo `json:"vm"`
}

struct McisStatusInfo is to define simple information of MCIS with updated status of all VMs

func GetMcisStatus

func GetMcisStatus(nsId string, mcisId string) (*McisStatusInfo, error)

func GetMcisStatusAll

func GetMcisStatusAll(nsId string) ([]McisStatusInfo, error)

type MonAgentInstallReq

type MonAgentInstallReq struct {
	NsId     string `json:"nsId,omitempty"`
	McisId   string `json:"mcisId,omitempty"`
	VmId     string `json:"vmId,omitempty"`
	PublicIp string `json:"publicIp,omitempty"`
	Port     string `json:"port,omitempty"`
	UserName string `json:"userName,omitempty"`
	SshKey   string `json:"sshKey,omitempty"`
	Csp_type string `json:"cspType,omitempty"`
}

MonAgentInstallReq struct

type MonResultSimple

type MonResultSimple struct {
	Metric string `json:"metric"`
	VmId   string `json:"vmId"`
	Value  string `json:"value"`
	Err    string `json:"err"`
}

MonResultSimple struct is for containing vm monitoring results

type MonResultSimpleResponse

type MonResultSimpleResponse struct {
	NsId           string            `json:"nsId"`
	McisId         string            `json:"mcisId"`
	McisMonitoring []MonResultSimple `json:"mcisMonitoring"`
}

MonResultSimpleResponse struct is for containing Mcis monitoring results

func GetMonitoringData

func GetMonitoringData(nsId string, mcisId string, metric string) (MonResultSimpleResponse, error)

GetMonitoringData func retrieves monitoring data from cb-dragonfly

type MultihostBenchmarkReq

type MultihostBenchmarkReq struct {
	Multihost []BenchmarkReq `json:"multihost"`
}

type Operation

type Operation struct {
	Operator string `json:"operator" example:">=" enums:">=,<=,=="` // >=, <=, ==
	Operand  string `json:"operand" example:"4" enums:"4,8,.."`     // 10, 70, 80, 98, ...
}

Operation is struct for .

type ParameterKeyVal

type ParameterKeyVal struct {
	Key string   `json:"key" example:"coordinateClose" enums:"coordinateClose,coordinateWithin,coordinateFair"` // coordinate
	Val []string `json:"val" example:"46.3772/2.3730"`                                                          // ["Latitude,Longitude","12,543",..,"31,433"]
}

Operation is struct for .

type Policy

type Policy struct {
	AutoCondition AutoCondition `json:"autoCondition"`
	AutoAction    AutoAction    `json:"autoAction"`
	Status        string        `json:"status"`
}

Policy is struct for MCIS auto-control Policy request that includes AutoCondition, AutoAction, Status.

type PriorityCondition

type PriorityCondition struct {
	Metric    string            `json:"metric" example:"location" enums:"location,latency,cost"` // location,latency,cost
	Weight    string            `json:"weight" example:"0.3" enums:"0.1,0.2,..."`                // 0.3
	Parameter []ParameterKeyVal `json:"parameter"`
}

FilterCondition is struct for .

type PriorityInfo

type PriorityInfo struct {
	Policy []PriorityCondition `json:"policy"`
}

PriorityInfo is struct for .

type RegionInfo

type RegionInfo struct {
	Region string
	Zone   string
}

type SSHInfo

type SSHInfo struct {
	UserName   string // ex) "root"
	PrivateKey []byte // ex)   []byte(`-----BEGIN RSA PRIVATE KEY-----
	//              MIIEoQIBAAKCAQEArVNOLwMIp5VmZ4VPZotcoCHdEzimKalAsz+ccLfvAA1Y2ELH
	//              ...`)
	ServerPort string // ex) "node12:22"
}

====================================================================

type SSHKeyPathInfo

type SSHKeyPathInfo struct {
	UserName   string // ex) "root"
	KeyPath    string // ex) "/root/.ssh/id_rsa // You should use the full path.
	ServerPort string // ex) "node12:22"
}

====================================================================

type SpecBenchmarkInfo

type SpecBenchmarkInfo struct {
	SpecId     string `json:"specid"`
	Cpus       string `json:"cpus"`
	Cpum       string `json:"cpum"`
	MemR       string `json:"memR"`
	MemW       string `json:"memW"`
	FioR       string `json:"fioR"`
	FioW       string `json:"fioW"`
	DbR        string `json:"dbR"`
	DbW        string `json:"dbW"`
	Rtt        string `json:"rtt"`
	EvaledTime string `json:"evaledTime"`
}

type SpiderAllList

type SpiderAllList struct {
	MappedList     []SpiderNameIdSystemId
	OnlySpiderList []SpiderNameIdSystemId
	OnlyCSPList    []SpiderNameIdSystemId
}

type SpiderAllListWrapper

type SpiderAllListWrapper struct {
	AllList SpiderAllList
}

type SpiderNameIdSystemId

type SpiderNameIdSystemId struct {
	NameId   string
	SystemId string
}

type SpiderVMInfo

type SpiderVMInfo struct {
	// Fields for request
	Name               string
	ImageName          string
	VPCName            string
	SubnetName         string
	SecurityGroupNames []string
	KeyPairName        string

	// Fields for both request and response
	VMSpecName   string //  instance type or flavour, etc... ex) t2.micro or f1.micro
	VMUserId     string // ex) user1
	VMUserPasswd string

	// Fields for response
	IId               common.IID // {NameId, SystemId}
	ImageIId          common.IID
	VpcIID            common.IID
	SubnetIID         common.IID   // AWS, ex) subnet-8c4a53e4
	SecurityGroupIIds []common.IID // AWS, ex) sg-0b7452563e1121bb6
	KeyPairIId        common.IID
	StartTime         time.Time  // Timezone: based on cloud-barista server location.
	Region            RegionInfo //  ex) {us-east1, us-east1-c} or {ap-northeast-2}
	NetworkInterface  string     // ex) eth0
	PublicIP          string
	PublicDNS         string
	PrivateIP         string
	PrivateDNS        string
	VMBootDisk        string // ex) /dev/sda1
	VMBlockDisk       string // ex)
	SSHAccessPoint    string
	KeyValueList      []common.KeyValue
}

type SshCmdResult

type SshCmdResult struct {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
	Err    error  `json:"err"`
}

func CorePostCmdMcis

func CorePostCmdMcis(nsId string, mcisId string, req *McisCmdReq) ([]SshCmdResult, error)

type TbInspectResourcesResponse

type TbInspectResourcesResponse struct {
	// ResourcesOnCsp       interface{} `json:"resourcesOnCsp"`
	// ResourcesOnSpider    interface{} `json:"resourcesOnSpider"`
	// ResourcesOnTumblebug interface{} `json:"resourcesOnTumblebug"`
	ResourcesOnCsp       []resourceOnCspOrSpider `json:"resourcesOnCsp"`
	ResourcesOnSpider    []resourceOnCspOrSpider `json:"resourcesOnSpider"`
	ResourcesOnTumblebug []resourceOnTumblebug   `json:"resourcesOnTumblebug"`
}

Response struct for InspectResources

type TbMcisInfo

type TbMcisInfo struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	Label string `json:"label"`

	PlacementAlgo string     `json:"placementAlgo"`
	Description   string     `json:"description"`
	Vm            []TbVmInfo `json:"vm"`
}

func CoreGetAllMcis

func CoreGetAllMcis(nsId string, option string) ([]TbMcisInfo, error)

func CorePostMcisGroupVm

func CorePostMcisGroupVm(nsId string, mcisId string, vmReq *TbVmReq) (*TbMcisInfo, error)

CorePostMcisGroupVm function is a wrapper for CreateMcisGroupVm

func CreateMcis

func CreateMcis(nsId string, req *TbMcisReq) (*TbMcisInfo, error)

CreateMcis function create MCIS obeject and deploy requested VMs.

func CreateMcisGroupVm

func CreateMcisGroupVm(nsId string, mcisId string, vmRequest *TbVmReq) (*TbMcisInfo, error)

func GetMcisInfo

func GetMcisInfo(nsId string, mcisId string) (*TbMcisInfo, error)

GetMcisInfo func returns MCIS information with the current status update

func GetMcisObject

func GetMcisObject(nsId string, mcisId string) (TbMcisInfo, error)

GetMcisObject func retrieve MCIS object from database (no current status update)

type TbMcisReq

type TbMcisReq struct {
	Name string `json:"name"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	Label string `json:"label"`

	PlacementAlgo string `json:"placementAlgo"`
	Description   string `json:"description"`

	Vm []TbVmReq `json:"vm"`
}

type TbVmGroupInfo

type TbVmGroupInfo struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	VmId        []string `json:"vmId"`
	VmGroupSize string   `json:"vmGroupSize"`
}

struct TbVmGroupInfo is to define an object that includes homogeneous VMs.

type TbVmInfo

type TbVmInfo struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	// defined if the VM is in a group
	VmGroupId string `json:"vmGroupId"`

	Location GeoLocation `json:"location"`

	// Required by CB-Tumblebug
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	Label       string `json:"label"`
	Description string `json:"description"`

	Region      RegionInfo `json:"region"` // AWS, ex) {us-east1, us-east1-c} or {ap-northeast-2}
	PublicIP    string     `json:"publicIP"`
	SSHPort     string     `json:"sshPort"`
	PublicDNS   string     `json:"publicDNS"`
	PrivateIP   string     `json:"privateIP"`
	PrivateDNS  string     `json:"privateDNS"`
	VMBootDisk  string     `json:"vmBootDisk"` // ex) /dev/sda1
	VMBlockDisk string     `json:"vmBlockDisk"`

	ConnectionName   string   `json:"connectionName"`
	SpecId           string   `json:"specId"`
	ImageId          string   `json:"imageId"`
	VNetId           string   `json:"vNetId"`
	SubnetId         string   `json:"subnetId"`
	SecurityGroupIds []string `json:"securityGroupIds"`
	SshKeyId         string   `json:"sshKeyId"`
	VmUserAccount    string   `json:"vmUserAccount"`
	VmUserPassword   string   `json:"vmUserPassword"`

	CspViewVmDetail SpiderVMInfo `json:"cspViewVmDetail"`
}

struct TbVmGroupInfo is to define a server instance object

func CoreGetMcisVmInfo

func CoreGetMcisVmInfo(nsId string, mcisId string, vmId string) (*TbVmInfo, error)

func CorePostMcisVm

func CorePostMcisVm(nsId string, mcisId string, vmInfoData *TbVmInfo) (*TbVmInfo, error)

func GetVmObject

func GetVmObject(nsId string, mcisId string, vmId string) (TbVmInfo, error)

func GetVmTemplate

func GetVmTemplate(nsId string, mcisId string, algo string) (TbVmInfo, error)

type TbVmPriority

type TbVmPriority struct {
	Priority string          `json:"priority"`
	VmSpec   mcir.TbSpecInfo `json:"vmSpec"`
}

func GetRecommendList

func GetRecommendList(nsId string, cpuSize string, memSize string, diskSize string) ([]TbVmPriority, error)

// Info manage for MCIS recommendation

type TbVmRecommendInfo

type TbVmRecommendInfo struct {
	VmReq          TbVmRecommendReq  `json:"vmReq"`
	VmPriority     []TbVmPriority    `json:"vmPriority"`
	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

func CorePostMcisRecommend

func CorePostMcisRecommend(nsId string, req *McisRecommendReq) ([]TbVmRecommendInfo, error)

type TbVmRecommendReq

type TbVmRecommendReq struct {
	RequestName  string `json:"requestName"`
	MaxResultNum string `json:"maxResultNum"`

	VcpuSize   string `json:"vcpuSize"`
	MemorySize string `json:"memorySize"`
	DiskSize   string `json:"diskSize"`

	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

type TbVmReq

type TbVmReq struct {
	// VM name or VM group name if is (not empty) && (> 0). If it is a group, actual VM name will be generated with -N postfix.
	Name string `json:"name"`

	// if vmGroupSize is (not empty) && (> 0), VM group will be gernetad. VMs will be created accordingly.
	VmGroupSize string `json:"vmGroupSize" example:"3" default:""`

	Label string `json:"label"`

	Description string `json:"description"`

	ConnectionName   string   `json:"connectionName"`
	SpecId           string   `json:"specId"`
	ImageId          string   `json:"imageId"`
	VNetId           string   `json:"vNetId"`
	SubnetId         string   `json:"subnetId"`
	SecurityGroupIds []string `json:"securityGroupIds"`
	SshKeyId         string   `json:"sshKeyId"`
	VmUserAccount    string   `json:"vmUserAccount"`
	VmUserPassword   string   `json:"vmUserPassword"`
}

struct TbVmReq is to get requirements to create a new server instance.

type TbVmStatusInfo

type TbVmStatusInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	CspVmId string `json:"cspVmId"`

	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`
	NativeStatus string `json:"nativeStatus"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	PublicIp  string `json:"publicIp"`
	PrivateIp string `json:"privateIp"`
	SSHPort   string `json:"sshPort"`

	Location GeoLocation `json:"location"`
}

TbVmStatusInfo is to define simple information of VM with updated status

func CoreGetMcisVmStatus

func CoreGetMcisVmStatus(nsId string, mcisId string, vmId string) (*TbVmStatusInfo, error)

func GetVmCurrentPublicIp

func GetVmCurrentPublicIp(nsId string, mcisId string, vmId string) (TbVmStatusInfo, error)

func GetVmStatus

func GetVmStatus(nsId string, mcisId string, vmId string) (TbVmStatusInfo, error)

Jump to

Keyboard shortcuts

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