vm

package
v0.0.0-...-884d9dc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryRecord

type HistoryRecord struct {
	OID       int    `xml:"OID"`
	SEQ       int    `xml:"SEQ"`
	Hostname  string `xml:"HOSTNAME"`
	HID       int    `xml:"HID"`
	CID       int    `xml:"CID"`
	STime     int    `xml:"STIME"`
	ETime     int    `xml:"ETIME"`
	VMMad     string `xml:"VM_MAD"`
	TMMad     string `xml:"TM_MAD"`
	DSID      int    `xml:"DS_ID"`
	PSTime    int    `xml:"PSTIME"`
	PETime    int    `xml:"PETIME"`
	RSTime    int    `xml:"RSTIME"`
	RETime    int    `xml:"RETIME"`
	ESTime    int    `xml:"ESTIME"`
	EETime    int    `xml:"EETIME"`
	Action    int    `xml:"ACTION"`
	UID       int    `xml:"UID"`
	GID       int    `xml:"GID"`
	RequestID string `xml:"REQUEST_ID"`
}

History records

type LCMState

type LCMState int

LCMState is the life-cycle manager state of the virtual machine. It is used only when the VM's state is active, otherwise it's LcmInit

const (
	// LcmInit lcm state
	LcmInit LCMState = 0

	// Prolog lcm state
	Prolog LCMState = 1

	// Boot lcm state
	Boot LCMState = 2

	// Running lcm state
	Running LCMState = 3

	// Migrate lcm state
	Migrate LCMState = 4

	// SaveStop lcm state
	SaveStop LCMState = 5

	// SaveSuspend lcm state
	SaveSuspend LCMState = 6

	// SaveMigrate lcm state
	SaveMigrate LCMState = 7

	// PrologMigrate lcm state
	PrologMigrate LCMState = 8

	// PrologResume lcm state
	PrologResume LCMState = 9

	// EpilogStop lcm state
	EpilogStop LCMState = 10

	// Epilog lcm state
	Epilog LCMState = 11

	// Shutdown lcm state
	Shutdown LCMState = 12

	// CleanupResubmit lcm state
	CleanupResubmit LCMState = 15

	// Unknown lcm state
	Unknown LCMState = 16

	// Hotplug lcm state
	Hotplug LCMState = 17

	// ShutdownPoweroff lcm state
	ShutdownPoweroff LCMState = 18

	// BootUnknown lcm state
	BootUnknown LCMState = 19

	// BootPoweroff lcm state
	BootPoweroff LCMState = 20

	// BootSuspended lcm state
	BootSuspended LCMState = 21

	// BootStopped lcm state
	BootStopped LCMState = 22

	// CleanupDelete lcm state
	CleanupDelete LCMState = 23

	// HotplugSnapshot lcm state
	HotplugSnapshot LCMState = 24

	// HotplugNic lcm state
	HotplugNic LCMState = 25

	// HotplugSaveas lcm state
	HotplugSaveas LCMState = 26

	// HotplugSaveasPoweroff lcm state
	HotplugSaveasPoweroff LCMState = 27

	// HotplugSaveasSuspended lcm state
	HotplugSaveasSuspended LCMState = 28

	// ShutdownUndeploy lcm state
	ShutdownUndeploy LCMState = 29

	// EpilogUndeploy lcm state
	EpilogUndeploy LCMState = 30

	// PrologUndeploy lcm state
	PrologUndeploy LCMState = 31

	// BootUndeploy lcm state
	BootUndeploy LCMState = 32

	// HotplugPrologPoweroff lcm state
	HotplugPrologPoweroff LCMState = 33

	// HotplugEpilogPoweroff lcm state
	HotplugEpilogPoweroff LCMState = 34

	// BootMigrate lcm state
	BootMigrate LCMState = 35

	// BootFailure lcm state
	BootFailure LCMState = 36

	// BootMigrateFailure lcm state
	BootMigrateFailure LCMState = 37

	// PrologMigrateFailure lcm state
	PrologMigrateFailure LCMState = 38

	// PrologFailure lcm state
	PrologFailure LCMState = 39

	// EpilogFailure lcm state
	EpilogFailure LCMState = 40

	// EpilogStopFailure lcm state
	EpilogStopFailure LCMState = 41

	// EpilogUndeployFailure lcm state
	EpilogUndeployFailure LCMState = 42

	// PrologMigratePoweroff lcm state
	PrologMigratePoweroff LCMState = 43

	// PrologMigratePoweroffFailure lcm state
	PrologMigratePoweroffFailure LCMState = 44

	// PrologMigrateSuspend lcm state
	PrologMigrateSuspend LCMState = 45

	// PrologMigrateSuspendFailure lcm state
	PrologMigrateSuspendFailure LCMState = 46

	// BootUndeployFailure lcm state
	BootUndeployFailure LCMState = 47

	// BootStoppedFailure lcm state
	BootStoppedFailure LCMState = 48

	// PrologResumeFailure lcm state
	PrologResumeFailure LCMState = 49

	// PrologUndeployFailure lcm state
	PrologUndeployFailure LCMState = 50

	// DiskSnapshotPoweroff lcm state
	DiskSnapshotPoweroff LCMState = 51

	// DiskSnapshotRevertPoweroff lcm state
	DiskSnapshotRevertPoweroff LCMState = 52

	// DiskSnapshotDeletePoweroff lcm state
	DiskSnapshotDeletePoweroff LCMState = 53

	// DiskSnapshotSuspended lcm state
	DiskSnapshotSuspended LCMState = 54

	// DiskSnapshotRevertSuspended lcm state
	DiskSnapshotRevertSuspended LCMState = 55

	// DiskSnapshotDeleteSuspended lcm state
	DiskSnapshotDeleteSuspended LCMState = 56

	// DiskSnapshot lcm state
	DiskSnapshot LCMState = 57

	// DiskSnapshotDelete lcm state
	DiskSnapshotDelete LCMState = 59

	// PrologMigrateUnknown lcm state
	PrologMigrateUnknown LCMState = 60

	// PrologMigrateUnknownFailure lcm state
	PrologMigrateUnknownFailure LCMState = 61

	// DiskResize lcm state
	DiskResize LCMState = 62

	// DiskResizePoweroff lcm state
	DiskResizePoweroff LCMState = 63

	// DiskResizeUndeployed lcm state
	DiskResizeUndeployed LCMState = 64

	// HotplugNicPoweroff lcm state
	HotplugNicPoweroff = 65

	// HotplugResize lcm state
	HotplugResize = 66

	// HotplugSaveasUndeployed lcm state
	HotplugSaveasUndeployed = 67

	// HotplugSaveasStopped lcm state
	HotplugSaveasStopped = 68
)

func (LCMState) String

func (s LCMState) String() string

type Monitoring

type Monitoring struct {
	XMLName xml.Name       `xml:"MONITORING_DATA"`
	Records []dyn.Template `xml:"MONITORING"`
}

Monitoring contains the monitoring records of a VM

type Pool

type Pool struct {
	XMLName xml.Name `xml:"VM_POOL"`
	VMs     []VM     `xml:"VM"`
}

Pool represents an OpenNebula Virtual Machine pool

type PoolMonitoring

type PoolMonitoring struct {
	XMLName xml.Name       `xml:"MONITORING_DATA"`
	VMs     []dyn.Template `xml:"MONITORING"`
}

PoolMonitoring contains the monitoring records of the VMs

type SchedAction

type SchedAction struct {
	dyn.Vector
}

SchedAction is a scheduled action on VM

func (*SchedAction) Add

func (t *SchedAction) Add(key keys.SchedAction, value interface{})

Add adds a SchedAction key, value pair

func (*SchedAction) Get

func (t *SchedAction) Get(key keys.SchedAction) (string, error)

Get retrieve a SchedAction key

type State

type State int

State is the state of the Virtual Machine

const (
	// Init state
	Init State = 0

	// Pending state
	Pending State = 1

	// Hold state
	Hold State = 2

	// Active state
	Active State = 3

	// Stopped state
	Stopped State = 4

	// Suspended state
	Suspended State = 5

	// Done state
	Done State = 6

	// Poweroff state
	Poweroff State = 8

	// Undeployed state
	Undeployed State = 9

	// Cloning state
	Cloning State = 10

	// CloningFailure state
	CloningFailure State = 11
)

func (State) String

func (s State) String() string

type Template

type Template struct {
	dyn.Template
}

Template is a structure allowing to parse VM templates. It's defined in a semi-static way to guide the user among the bunch of values

func NewTemplate

func NewTemplate() *Template

NewTemplate returns a vm Template structure

func (*Template) Add

func (t *Template) Add(key keys.Template, value interface{})

Add adds a vm template key, value pair

func (*Template) AddB64Ctx

func (t *Template) AddB64Ctx(key keys.ContextB64, value interface{}) error

Add adds a context key, value pair. It will convert value to base64

func (*Template) AddCtx

func (t *Template) AddCtx(key keys.Context, value interface{}) error

Add adds a context key, value pair

func (*Template) AddDisk

func (t *Template) AddDisk() *shared.Disk

AddDisk allow to add a disk to the template

func (*Template) AddFeature

func (t *Template) AddFeature(key keys.Feature, value string) error

func (*Template) AddIOGraphic

func (t *Template) AddIOGraphic(key keys.IOGraphics, value interface{}) error

func (*Template) AddIOInput

func (t *Template) AddIOInput(key keys.IOInput, value string) error

func (*Template) AddNIC

func (t *Template) AddNIC() *shared.NIC

AddNIC allow to add a NIC to the template

func (*Template) AddOS

func (t *Template) AddOS(key keys.OS, value string) error

func (*Template) AddSchedAction

func (t *Template) AddSchedAction() *SchedAction

AddSchedAction returns a structure disk entity to build

func (*Template) CPU

func (t *Template) CPU(cpu float64) *Template

CPU set the CPU amount to the template

func (*Template) CPUModel

func (t *Template) CPUModel(value string) *Template

CPUModel set the model of the CPU

func (*Template) Get

func (t *Template) Get(key keys.Template) (string, error)

Get returns the string value for a vm template

func (*Template) GetCPU

func (t *Template) GetCPU() (float64, error)

GetCPU return the CPU amount from a VM Template

func (*Template) GetCPUModel

func (t *Template) GetCPUModel(key keys.CPUModel) (string, error)

GetCPUModel get the model of the CPU

func (*Template) GetCtx

func (t *Template) GetCtx(key keys.Context) (string, error)

GetCtx retrieve a context key

func (*Template) GetDisks

func (t *Template) GetDisks() []shared.Disk

GetDisk allow to get disks from Template

func (*Template) GetFeature

func (t *Template) GetFeature(key keys.Feature) (string, error)

func (*Template) GetI

func (n *Template) GetI(key keys.Template) (int, error)

GetI returns the integer value for an vm key

func (*Template) GetIOGraphic

func (t *Template) GetIOGraphic(key keys.IOGraphics) (string, error)

func (*Template) GetIOInput

func (t *Template) GetIOInput(key keys.IOInput) (string, error)

func (*Template) GetMemory

func (t *Template) GetMemory() (int, error)

GetMemory return the memory amount from a VM Template

func (*Template) GetNICs

func (t *Template) GetNICs() []shared.NIC

GetNICs allow to get NICs from Template

func (*Template) GetOS

func (t *Template) GetOS(key keys.OS) (string, error)

func (*Template) GetPlacement

func (t *Template) GetPlacement(key keys.Placement) (string, error)

func (*Template) GetShowback

func (t *Template) GetShowback(key keys.Showback) (string, error)

func (*Template) GetVCPU

func (t *Template) GetVCPU() (int, error)

GetVCPU return the VCPU count from a VM Template

func (*Template) Memory

func (t *Template) Memory(memory int) *Template

Memory set the memory amount to the template

func (*Template) Placement

func (t *Template) Placement(key keys.Placement, value interface{}) *Template

Placement set once a placement attribute

func (*Template) Showback

func (t *Template) Showback(key keys.Showback, value interface{}) *Template

func (*Template) VCPU

func (t *Template) VCPU(vcpu int) *Template

VCPU set the VCPU count to the template

type UserTemplate

type UserTemplate struct {
	dyn.Template
}

UserTemplate contains common and custom attributes

func (*UserTemplate) Get

func (d *UserTemplate) Get(key keys.UserTemplate) (string, error)

Get allows to get a pair by key

type VM

type VM struct {
	XMLName         xml.Name              `xml:"VM"`
	ID              int                   `xml:"ID,omitempty"`
	UID             int                   `xml:"UID,omitempty"`
	GID             int                   `xml:"GID,omitempty"`
	UName           string                `xml:"UNAME,omitempty"`
	GName           string                `xml:"GNAME,omitempty"`
	Name            string                `xml:"NAME,omitempty"`
	Permissions     *shared.Permissions   `xml:"PERMISSIONS,omitempty"`
	LastPoll        int                   `xml:"LAST_POLL,omitempty"`
	StateRaw        int                   `xml:"STATE,omitempty"`
	LCMStateRaw     int                   `xml:"LCM_STATE,omitempty"`
	PrevStateRaw    int                   `xml:"PREV_STATE,omitempty"`
	PrevLCMStateRaw int                   `xml:"PREV_LCM_STATE,omitempty"`
	ReschedValue    int                   `xml:"RESCHED,omitempty"`
	STime           int                   `xml:"STIME,omitempty"`
	ETime           int                   `xml:"ETIME,omitempty"`
	DeployID        string                `xml:"DEPLOY_ID,omitempty"`
	MonitoringInfos dyn.Template          `xml:"MONITORING,omitempty"`
	Template        Template              `xml:"TEMPLATE,omitempty"`
	UserTemplate    UserTemplate          `xml:"USER_TEMPLATE,omitempty"`
	HistoryRecords  []HistoryRecord       `xml:"HISTORY_RECORDS>HISTORY,omitempty"`
	Snapshots       []shared.DiskSnapshot `xml:"SNAPSHOTS,omitempty"`

	// Not filled with NewUserPool call
	LockInfos *shared.Lock `xml:"LOCK"`
}

VM represents an OpenNebula Virtual Machine

func (*VM) State

func (vm *VM) State() (State, LCMState, error)

State returns the State and LCMState

func (*VM) StateString

func (vm *VM) StateString() (string, string, error)

StateString returns the State and LCMState as strings

Directories

Path Synopsis
-------------------------------------------------------------------------- Copyright 2002-2023, OpenNebula Project, OpenNebula Systems
-------------------------------------------------------------------------- Copyright 2002-2023, OpenNebula Project, OpenNebula Systems

Jump to

Keyboard shortcuts

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