shared

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: 2 Imported by: 28

Documentation

Index

Constants

View Source
const (
	DiskVec      string   = "DISK"
	DevPrefix    DiskKeys = "DEV_PREFIX"
	Cache        DiskKeys = "CACHE"
	Discard      DiskKeys = "DISCARD"
	IO           DiskKeys = "IO"
	DiskID       DiskKeys = "DISK_ID"
	Datastore    DiskKeys = "DATASTORE"
	DatastoreID  DiskKeys = "DATASTORE_ID"
	DiskType     DiskKeys = "DISK_TYPE"
	Driver       DiskKeys = "DRIVER"
	Image        DiskKeys = "IMAGE"
	ImageID      DiskKeys = "IMAGE_ID"
	ImageUname   DiskKeys = "IMAGE_UNAME"
	OriginalSize DiskKeys = "ORIGINAL_SIZE"
	Size         DiskKeys = "SIZE"
	TargetDisk   DiskKeys = "TARGET"
)

Some keys are specific to VM some others to VRouter

View Source
const (
	NICVec            string  = "NIC"
	NICID             NICKeys = "NIC_ID"
	Bridge            NICKeys = "BRIDGE"
	Filter            NICKeys = "FILTER"
	IP                NICKeys = "IP"
	MAC               NICKeys = "MAC"
	Network           NICKeys = "NETWORK"
	NetworkMask       NICKeys = "NETWORK_MASK"
	NetworkID         NICKeys = "NETWORK_ID"
	NetworkUID        NICKeys = "NETWORK_UID"
	NetworkUName      NICKeys = "NETWORK_UNAME"
	NetworkAddress    NICKeys = "NETWORK_ADDRESS"
	SecurityGroups    NICKeys = "SECURITY_GROUPS"
	Target            NICKeys = "TARGET"
	VlanID            NICKeys = "VLAN_ID"
	Script            NICKeys = "SCRIPT"
	Model             NICKeys = "MODEL"
	InboundAvgBw      NICKeys = "INBOUND_AVG_BW"
	InboundPeakBw     NICKeys = "INBOUND_PEAK_BW"
	InboundPeakK      NICKeys = "INBOUND_PEAK_KB"
	OutboundAvgBw     NICKeys = "OUTBOUND_AVG_BW"
	OutboundPeakBw    NICKeys = "OUTBOUND_PEAK_BW"
	OutboundPeakKb    NICKeys = "OUTBOUND_PEAK_KB"
	NetworkMode       NICKeys = "NETWORK_MODE"
	SchedRequirements NICKeys = "SCHED_REQUIREMENTS"
	SchedRank         NICKeys = "SCHED_RANK"
	Name              NICKeys = "NAME"
	Parent            NICKeys = "PARENT"
	External          NICKeys = "EXTERNAL"
	ExternalIP        NICKeys = "EXTERNAL_IP"
)

Some keys are specific to VM some others to VRouter For VM values: https://docs.opennebula.io/5.8/operation/references/template.html#network-section

View Source
const (
	SchedActionVec string = "SCHED_ACTION"

	ActionID SchedActionKeys = "ID"
	ParentID SchedActionKeys = "PARENT_ID"
	Action   SchedActionKeys = "ACTION"
	Time     SchedActionKeys = "TIME"
	Repeat   SchedActionKeys = "REPEAT"
	Days     SchedActionKeys = "DAYS"
	EndType  SchedActionKeys = "END_TYPE"
	EndValue SchedActionKeys = "END_VALUE"
	Done     SchedActionKeys = "DONE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatastoreQuota

type DatastoreQuota struct {
	ID         int `xml:"ID"`
	Images     int `xml:"IMAGES"`
	ImagesUsed int `xml:"IMAGES_USED,omitempty"`
	Size       int `xml:"SIZE"`
	SizeUsed   int `xml:"SIZE_USED,omitempty"`
}

DatastoreQuota keeps quota for a datastore

type Disk

type Disk struct {
	dyn.Vector
}

Disk is a structure allowing to parse disk templates

func NewDisk

func NewDisk() *Disk

NewDisk returns a structure disk entity to build

func (*Disk) Add

func (d *Disk) Add(key DiskKeys, value interface{})

Add adds a disk key, value pair

func (*Disk) Get

func (d *Disk) Get(key DiskKeys) (string, error)

Get return the string value for a disk key

func (*Disk) GetI

func (d *Disk) GetI(key DiskKeys) (int, error)

GetI returns the integer value for a disk key

func (*Disk) ID

func (d *Disk) ID() (int, error)

ID returns the disk ID as an integer

type DiskKeys

type DiskKeys string

DiskKeys is here to help the user to keep track of XML tags defined in Disk

type DiskSnapshot

type DiskSnapshot struct {
	AllowOrphans string     `xml:"ALLOW_ORPHANS"`
	CurrentBase  int        `xml:"CURRENT_BASE"`
	DiskID       int        `xml:"DISK_ID"`
	NextSnapshot int        `xml:"NEXT_SNAPSHOT"`
	Snapshots    []Snapshot `xml:"SNAPSHOT"`
}

DiskSnapshot represent a disk snapshot

type EntitiesID

type EntitiesID struct {
	ID []int `xml"ID,omitempty"`
}

type ImageQuota

type ImageQuota struct {
	ID       int `xml:"ID"`
	RVMs     int `xml:"RVMS"`
	RVMsUsed int `xml:"RVMS_USED,omitempty"`
}

ImageQuota keeps quota for an image

type Lock

type Lock struct {
	Locked int `xml:"LOCKED"`
	Owner  int `xml:"OWNER"`
	Time   int `xml:"TIME"`
	ReqID  int `xml:"REQ_ID"`
}

Lock actions on a resources

type LockLevel

type LockLevel int

LockLevel is the level of locking of an OpenNebula entity

const (
	// LockUse locks all possible actions
	LockUse LockLevel = 1

	// LockManage locks manage and admin actions
	LockManage LockLevel = 2

	// LockAdmin locks admin actions
	LockAdmin LockLevel = 3

	// LockAll locks all actions. Deprecated use LockUse
	LockAll LockLevel = 4
)

type NIC

type NIC struct {
	dyn.Vector
}

NIC is a structure allowing to parse NIC templates. Common to VM and VRouter.

func NewNIC

func NewNIC() *NIC

NewNIC returns a structure disk entity to build

func (*NIC) Add

func (n *NIC) Add(key NICKeys, value interface{})

Add adds a NIC key, value pair

func (*NIC) Get

func (n *NIC) Get(key NICKeys) (string, error)

Get returns the string value for a NIC key

func (*NIC) GetI

func (n *NIC) GetI(key NICKeys) (int, error)

GetI returns the integer value for a NIC key

func (*NIC) ID

func (n *NIC) ID() (int, error)

ID returns the NIC ID as an integer

type NICKeys

type NICKeys string

NICKeys is here to help the user to keep track of XML tags defined in NIC

type NetworkQuota

type NetworkQuota struct {
	ID         int `xml:"ID"`
	Leases     int `xml:"LEASES"`
	LeasesUsed int `xml:"LEASES_USED,omitempty"`
}

NetworkQuota keeps quota for a network

type Permissions

type Permissions struct {
	OwnerU int8 `xml:"OWNER_U" json:"OWNER_U,string"`
	OwnerM int8 `xml:"OWNER_M" json:"OWNER_M,string"`
	OwnerA int8 `xml:"OWNER_A" json:"OWNER_A,string"`
	GroupU int8 `xml:"GROUP_U" json:"GROUP_U,string"`
	GroupM int8 `xml:"GROUP_M" json:"GROUP_M,string"`
	GroupA int8 `xml:"GROUP_A" json:"GROUP_A,string"`
	OtherU int8 `xml:"OTHER_U" json:"OTHER_U,string"`
	OtherM int8 `xml:"OTHER_M" json:"OTHER_M,string"`
	OtherA int8 `xml:"OTHER_A" json:"OTHER_A,string"`
}

Permissions is associated to OpenNebula resources * uu: USER USE bit. * um: USER MANAGE bit. * ua: USER ADMIN bit. * gu: GROUP USE bit. * gm: GROUP MANAGE bit. * ga: GROUP ADMIN bit. * ou: OTHER USE bit. * om: OTHER MANAGE bit. * oa: OTHER ADMIN bit.

func NewDefaultPermission

func NewDefaultPermission() Permissions

func (Permissions) Octet

func (p Permissions) Octet() int

func (Permissions) String

func (p Permissions) String() string

func (Permissions) ToArgs

func (p Permissions) ToArgs() []interface{}

If a bit is set to -1, it will not change when calling Chmod

type Quotas

type Quotas struct {
	XMLName xml.Name `xml:"QUOTAS"`
	ID      int      `xml:"ID"`
	QuotasList
}

Quotas keeps quota value per User or Group

type QuotasList

type QuotasList struct {
	Datastore []DatastoreQuota `xml:"DATASTORE_QUOTA>DATASTORE"`
	Network   []NetworkQuota   `xml:"NETWORK_QUOTA>NETWORK"`
	VM        *VMQuota         `xml:"VM_QUOTA>VM"`
	Image     []ImageQuota     `xml:"IMAGE_QUOTA>IMAGE"`
}

QuotasList keeps quota per entity type

type SchedAction

type SchedAction struct {
	dyn.Vector
}

SchedAction is a scheduled action on VM

func NewSchedAction

func NewSchedAction() *SchedAction

AddSchedAction returns a Scheduled Action structure

func (*SchedAction) Add

func (sa *SchedAction) Add(key SchedActionKeys, value interface{})

Add adds a key, value pair to Scheduled Action

func (*SchedAction) Get

func (t *SchedAction) Get(key SchedActionKeys) (string, error)

Get return the string value for Scheduled Action key

func (*SchedAction) GetI

func (d *SchedAction) GetI(key SchedActionKeys) (int, error)

GetI returns the integer value for a disk key

func (*SchedAction) ID

func (sa *SchedAction) ID() (int, error)

ID returns the Scheduled Action ID as an integer

type SchedActionKeys

type SchedActionKeys string

SchedAction define keys for scheduled action

type Snapshot

type Snapshot struct {
	Children string `xml:"CHILDREN"` //minOccur=0
	Active   string `xml:"ACTIVE"`   //minOccur=0
	Date     int    `xml:"DATE"`
	ID       int    `xml:"ID"`
	Name     string `xml:"NAME"` //minOccur=0
	Parent   int    `xml:"PARENT"`
	Size     int    `xml:"SIZE"`
}

Snapshot is a common part for external snapshot structures

type VMQuota

type VMQuota struct {
	CPU                float32 `xml:"CPU"`
	CPUUsed            float32 `xml:"CPU_USED,omitempty"`
	Memory             int     `xml:"MEMORY"`
	MemoryUsed         int     `xml:"MEMORY_USED,omitempty"`
	RunningCPU         float32 `xml:"RUNNING_CPU"`
	RunningCPUUsed     float32 `xml:"RUNNING_CPU_USED,omitempty"`
	RunningMemory      int     `xml:"RUNNING_MEMORY"`
	RunningMemoryUsed  int     `xml:"RUNNING_MEMORY_USED,omitempty"`
	RunningVMs         int     `xml:"RUNNING_VMS"`
	RunningVMsUsed     int     `xml:"RUNNING_VMS_USED,omitempty"`
	SystemDiskSize     int64   `xml:"SYSTEM_DISK_SIZE"`
	SystemDiskSizeUsed int64   `xml:"SYSTEM_DISK_SIZE_USED,omitempty"`
	VMs                int     `xml:"VMS"`
	VMsUsed            int     `xml:"VMS_USED,omitempty"`
}

VMQuota keeps quota for all VMs in the group

Jump to

Keyboard shortcuts

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