Documentation
¶
Overview ¶
Package hypervisors returns details about list of hypervisors, shows details for a hypervisor and shows summary statistics for all hypervisors over all compute nodes in the OpenStack cloud.
Example of Show Hypervisor Details
hypervisorID := 42
hypervisor, err := hypervisors.Get(computeClient, 42).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisor)
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)
}
Example of Show Hypervisor Statistics
hypervisorsStatistics, err := hypervisors.GetStatistics(computeClient).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisorsStatistics)
Example of Show Hypervisor Uptime
hypervisorID := 42
hypervisorUptime, err := hypervisors.GetUptime(computeClient, hypervisorID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisorUptime)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient) pagination.Pager
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 HypervisorResult ¶
type HypervisorResult struct {
gophercloud.Result
}
func Get ¶
func Get(client *gophercloud.ServiceClient, hypervisorID int) (r HypervisorResult)
Get makes a request against the API to get details for specific hypervisor.
func (HypervisorResult) Extract ¶
func (r HypervisorResult) Extract() (*Hypervisor, error)
Extract interprets any HypervisorResult as a Hypervisor, if possible.
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 Statistics ¶
type Statistics struct {
// The number of hypervisors.
Count int `json:"count"`
// The current_workload is the number of tasks the hypervisor is responsible for
CurrentWorkload int `json:"current_workload"`
// The actual free disk on this hypervisor(in GB).
DiskAvailableLeast int `json:"disk_available_least"`
// The free disk remaining on this hypervisor(in GB).
FreeDiskGB int `json:"free_disk_gb"`
// The free RAM in this hypervisor(in MB).
FreeRamMB int `json:"free_ram_mb"`
// The disk in this hypervisor(in GB).
LocalGB int `json:"local_gb"`
// The disk used in this hypervisor(in GB).
LocalGBUsed int `json:"local_gb_used"`
// The memory of this hypervisor(in MB).
MemoryMB int `json:"memory_mb"`
// The memory used in this hypervisor(in MB).
MemoryMBUsed int `json:"memory_mb_used"`
// The total number of running vms on all hypervisors.
RunningVMs int `json:"running_vms"`
// The number of vcpu in this hypervisor.
VCPUs int `json:"vcpus"`
// The number of vcpu used in this hypervisor.
VCPUsUsed int `json:"vcpus_used"`
}
Statistics represents a summary statistics for all enabled hypervisors over all compute nodes in the OpenStack cloud.
type StatisticsResult ¶
type StatisticsResult struct {
gophercloud.Result
}
func GetStatistics ¶
func GetStatistics(client *gophercloud.ServiceClient) (r StatisticsResult)
Statistics makes a request against the API to get hypervisors statistics.
func (StatisticsResult) Extract ¶
func (r StatisticsResult) Extract() (*Statistics, error)
Extract interprets any StatisticsResult as a Statistics, if possible.
type Topology ¶
type Topology struct {
Sockets int `json:"sockets"`
Cores int `json:"cores"`
Threads int `json:"threads"`
}
Topology represents a CPU Topology.
type Uptime ¶
type Uptime struct {
// The hypervisor host name provided by the Nova virt driver.
// For the Ironic driver, it is the Ironic node uuid.
HypervisorHostname string `json:"hypervisor_hostname"`
// The id of the hypervisor.
ID int `json:"id"`
// The state of the hypervisor. One of up or down.
State string `json:"state"`
// The status of the hypervisor. One of enabled or disabled.
Status string `json:"status"`
// The total uptime of the hypervisor and information about average load.
Uptime string `json:"uptime"`
}
Uptime represents uptime and additional info for a specific hypervisor.
type UptimeResult ¶
type UptimeResult struct {
gophercloud.Result
}
func GetUptime ¶
func GetUptime(client *gophercloud.ServiceClient, hypervisorID int) (r UptimeResult)
GetUptime makes a request against the API to get uptime for specific hypervisor.
func (UptimeResult) Extract ¶
func (r UptimeResult) Extract() (*Uptime, error)
Extract interprets any UptimeResult as a Uptime, if possible.