hypervisors

package
v0.0.0-...-8db8df1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package hypervisors returns details about the hypervisors in the OpenStack cloud.

Example of Retrieving Details of All Hypervisors

allPages, err := hypervisors.List(computeClient).AllPages()
if err != nil {
	panic(err)
}

allHypervisors, err := hypervisors.ExtractHypervisors(allPages)
if err != nil {
	panic(err)
}

for _, hypervisor := range allHypervisors {
	fmt.Printf("%+v\n", hypervisor)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List makes a request against the API to list hypervisors.

Types

type CPUInfo

type CPUInfo struct {
	Vendor   string   `json:"vendor"`
	Arch     string   `json:"arch"`
	Model    string   `json:"model"`
	Features []string `json:"features"`
	Topology Topology `json:"topology"`
}

CPUInfo represents CPU information of the hypervisor.

type Hypervisor

type Hypervisor struct {
	// A structure that contains cpu information like arch, model, vendor,
	// features and topology.
	CPUInfo CPUInfo `json:"-"`

	// The current_workload is the number of tasks the hypervisor is responsible
	// for. This will be equal or greater than the number of active VMs on the
	// system (it can be greater when VMs are being deleted and the hypervisor is
	// still cleaning up).
	CurrentWorkload int `json:"current_workload"`

	// Status of the hypervisor, either "enabled" or "disabled".
	Status string `json:"status"`

	// State of the hypervisor, either "up" or "down".
	State string `json:"state"`

	// DiskAvailableLeast is the actual free disk on this hypervisor,
	// measured in GB.
	DiskAvailableLeast int `json:"disk_available_least"`

	// HostIP is the hypervisor's IP address.
	HostIP string `json:"host_ip"`

	// FreeDiskGB is the free disk remaining on the hypervisor, measured in GB.
	FreeDiskGB int `json:"-"`

	// FreeRAMMB is the free RAM in the hypervisor, measured in MB.
	FreeRamMB int `json:"free_ram_mb"`

	// HypervisorHostname is the hostname of the hypervisor.
	HypervisorHostname string `json:"hypervisor_hostname"`

	// HypervisorType is the type of hypervisor.
	HypervisorType string `json:"hypervisor_type"`

	// HypervisorVersion is the version of the hypervisor.
	HypervisorVersion int `json:"-"`

	// ID is the unique ID of the hypervisor.
	ID int `json:"id"`

	// LocalGB is the disk space in the hypervisor, measured in GB.
	LocalGB int `json:"-"`

	// LocalGBUsed is the used disk space of the  hypervisor, measured in GB.
	LocalGBUsed int `json:"local_gb_used"`

	// MemoryMB is the total memory of the hypervisor, measured in MB.
	MemoryMB int `json:"memory_mb"`

	// MemoryMBUsed is the used memory of the hypervisor, measured in MB.
	MemoryMBUsed int `json:"memory_mb_used"`

	// RunningVMs is the The number of running vms on the hypervisor.
	RunningVMs int `json:"running_vms"`

	// Service is the service this hypervisor represents.
	Service Service `json:"service"`

	// VCPUs is the total number of vcpus on the hypervisor.
	VCPUs int `json:"vcpus"`

	// VCPUsUsed is the number of used vcpus on the hypervisor.
	VCPUsUsed int `json:"vcpus_used"`
}

Hypervisor represents a hypervisor in the OpenStack cloud.

func ExtractHypervisors

func ExtractHypervisors(p pagination.Page) ([]Hypervisor, error)

ExtractHypervisors interprets a page of results as a slice of Hypervisors.

func (*Hypervisor) UnmarshalJSON

func (r *Hypervisor) UnmarshalJSON(b []byte) error

type HypervisorPage

type HypervisorPage struct {
	pagination.SinglePageBase
}

HypervisorPage represents a single page of all Hypervisors from a List request.

func (HypervisorPage) IsEmpty

func (page HypervisorPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a HypervisorPage is empty.

type Service

type Service struct {
	Host           string `json:"host"`
	ID             int    `json:"id"`
	DisabledReason string `json:"disabled_reason"`
}

Service represents a Compute service running on the hypervisor.

type Topology

type Topology struct {
	Sockets int `json:"sockets"`
	Cores   int `json:"cores"`
	Threads int `json:"threads"`
}

Topology represents a CPU Topology.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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