introspection

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package introspection contains the functionality for Starting introspection, Get introspection status, List all introspection statuses, Abort an introspection, Get stored introspection data and reapply introspection on stored data.

API reference https://developer.openstack.org/api-ref/baremetal-introspection/#node-introspection

Example to Start Introspection

err := introspection.StartIntrospection(client, NodeUUID, introspection.StartOpts{}).ExtractErr()
if err != nil {
	panic(err)
}

Example to Get an Introspection status

_, err := introspection.GetIntrospectionStatus(client, NodeUUID).Extract()
if err != nil {
	panic(err)
}

Example to List all introspection statuses

introspection.ListIntrospections(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
	introspectionsList, err := introspection.ExtractIntrospections(page)
	if err != nil {
		return false, err
	}

	for _, n := range introspectionsList {
		// Do something
	}

	return true, nil
})

Example to Abort an Introspection

err := introspection.AbortIntrospection(client, NodeUUID).ExtractErr()
if err != nil {
	panic(err)
}

Example to Get stored Introspection Data

v, err := introspection.GetIntrospectionData(c, NodeUUID).Extract()
if err != nil {
	panic(err)
}

Example to apply Introspection Data

err := introspection.ApplyIntrospectionData(c, NodeUUID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractIntrospectionsInto

func ExtractIntrospectionsInto(r pagination.Page, v interface{}) error

ExtractIntrospectionsInto will extract a collection of introspectResult pages into a slice of Introspection entities.

func ListIntrospections

ListIntrospections makes a request against the Inspector API to list the current introspections.

Types

type AbortResult

type AbortResult struct {
	gophercloud.ErrResult
}

AbortResult is the response from an AbortIntrospection operation. Call its ExtractErr method to determine if the call succeeded or failed.

func AbortIntrospection

func AbortIntrospection(client *gophercloud.ServiceClient, nodeID string) (r AbortResult)

AbortIntrospection abort running introspection.

type ApplyDataResult

type ApplyDataResult struct {
	gophercloud.ErrResult
}

ApplyDataResult is the response from an ApplyData operation. Call its ExtractErr method to determine if the call succeeded or failed.

func ReApplyIntrospection

func ReApplyIntrospection(client *gophercloud.ServiceClient, nodeID string) (r ApplyDataResult)

ReApplyIntrospection triggers introspection on stored unprocessed data. No data is allowed to be sent along with the request.

type BaseInterfaceType

type BaseInterfaceType struct {
	ClientID      string                 `json:"client_id"`
	IP            string                 `json:"ip"`
	MAC           string                 `json:"mac"`
	PXE           bool                   `json:"pxe"`
	LLDPProcessed map[string]interface{} `json:"lldp_processed"`
}

type BootInfoType

type BootInfoType struct {
	CurrentBootMode string `json:"current_boot_mode"`
	PXEInterface    string `json:"pxe_interface"`
}

type CPUType

type CPUType struct {
	Architecture string   `json:"architecture"`
	Count        int      `json:"count"`
	Flags        []string `json:"flags"`
	Frequency    string   `json:"frequency"`
	ModelName    string   `json:"model_name"`
}

type Data

type Data struct {
	AllInterfaces map[string]BaseInterfaceType `json:"all_interfaces"`
	BootInterface string                       `json:"boot_interface"`
	CPUArch       string                       `json:"cpu_arch"`
	CPUs          int                          `json:"cpus"`
	Error         string                       `json:"error"`
	Interfaces    map[string]BaseInterfaceType `json:"interfaces"`
	Inventory     InventoryType                `json:"inventory"`
	IPMIAddress   string                       `json:"ipmi_address"`
	LocalGB       int                          `json:"local_gb"`
	MACs          []string                     `json:"macs"`
	MemoryMB      int                          `json:"memory_mb"`
	RootDisk      RootDiskType                 `json:"root_disk"`
	Extra         ExtraHardwareDataType        `json:"extra"`
	NUMATopology  NUMATopology                 `json:"numa_topology"`
}

Data represents the full introspection data collected. The format and contents of the stored data depends on the ramdisk used and plugins enabled both in the ramdisk and in inspector itself. This structure has been provided for basic compatibility but it will need extensions

type DataResult

type DataResult struct {
	gophercloud.Result
}

DataResult represents the response from a GetIntrospectionData operation. Call its Extract method to interpret it as a Data.

func GetIntrospectionData

func GetIntrospectionData(client *gophercloud.ServiceClient, nodeID string) (r DataResult)

GetIntrospectionData return stored data from successful introspection.

func (DataResult) Extract

func (r DataResult) Extract() (*Data, error)

Extract interprets any IntrospectionDataResult as IntrospectionData, if possible.

type ExtraHardwareData

type ExtraHardwareData map[string]interface{}

type ExtraHardwareDataSection

type ExtraHardwareDataSection map[string]ExtraHardwareData

type ExtraHardwareDataType

type ExtraHardwareDataType struct {
	CPU      ExtraHardwareDataSection `json:"cpu"`
	Disk     ExtraHardwareDataSection `json:"disk"`
	Firmware ExtraHardwareDataSection `json:"firmware"`
	IPMI     ExtraHardwareDataSection `json:"ipmi"`
	Memory   ExtraHardwareDataSection `json:"memory"`
	Network  ExtraHardwareDataSection `json:"network"`
	System   ExtraHardwareDataSection `json:"system"`
}

type GetIntrospectionStatusResult

type GetIntrospectionStatusResult struct {
	// contains filtered or unexported fields
}

GetIntrospectionStatusResult is the response from a GetIntrospectionStatus operation. Call its Extract method to interpret it as an Introspection.

func GetIntrospectionStatus

func GetIntrospectionStatus(client *gophercloud.ServiceClient, nodeID string) (r GetIntrospectionStatusResult)

GetIntrospectionStatus makes a request against the Inspector API to get the status of a single introspection.

func (GetIntrospectionStatusResult) Extract

func (r GetIntrospectionStatusResult) Extract() (*Introspection, error)

Extract interprets any introspectionResult as an Introspection, if possible.

func (GetIntrospectionStatusResult) ExtractInto

func (r GetIntrospectionStatusResult) ExtractInto(v interface{}) error

ExtractInto will extract a response body into an Introspection struct.

type InterfaceType

type InterfaceType struct {
	BIOSDevName string        `json:"biosdevname"`
	ClientID    string        `json:"client_id"`
	HasCarrier  bool          `json:"has_carrier"`
	IPV4Address string        `json:"ipv4_address"`
	IPV6Address string        `json:"ipv6_address"`
	LLDP        []LLDPTLVType `json:"lldp"`
	MACAddress  string        `json:"mac_address"`
	Name        string        `json:"name"`
	Product     string        `json:"product"`
	Vendor      string        `json:"vendor"`
}

type Introspection

type Introspection struct {
	// Whether introspection is finished
	Finished bool `json:"finished"`

	// State of the introspection
	State string `json:"state"`

	// Error message, can be null; "Canceled by operator" in case introspection was aborted
	Error string `json:"error"`

	// UUID of the introspection
	UUID string `json:"uuid"`

	// UTC ISO8601 timestamp
	StartedAt time.Time `json:"-"`

	// UTC ISO8601 timestamp or null
	FinishedAt time.Time `json:"-"`

	// Link to the introspection URL
	Links []interface{} `json:"links"`
}

Introspection represents an introspection in the OpenStack Bare Metal Introspector API.

func ExtractIntrospections

func ExtractIntrospections(r pagination.Page) ([]Introspection, error)

ExtractIntrospections interprets the results of a single page from a ListIntrospections() call, producing a slice of Introspection entities.

func (*Introspection) UnmarshalJSON

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

UnmarshalJSON trie to convert values for started_at and finished_at from the json response into RFC3339 standard. Since Introspection API can remove the Z from the format, if the conversion fails, it falls back to an RFC3339 with no Z format supported by gophercloud.

type IntrospectionPage

type IntrospectionPage struct {
	pagination.LinkedPageBase
}

IntrospectionPage abstracts the raw results of making a ListIntrospections() request against the Inspector API. As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractIntrospections call.

func (IntrospectionPage) IsEmpty

func (r IntrospectionPage) IsEmpty() (bool, error)

IsEmpty returns true if a page contains no Introspection results.

func (IntrospectionPage) NextPageURL

func (r IntrospectionPage) NextPageURL() (string, error)

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type InventoryType

type InventoryType struct {
	BmcAddress   string           `json:"bmc_address"`
	Boot         BootInfoType     `json:"boot"`
	CPU          CPUType          `json:"cpu"`
	Disks        []RootDiskType   `json:"disks"`
	Interfaces   []InterfaceType  `json:"interfaces"`
	Memory       MemoryType       `json:"memory"`
	SystemVendor SystemVendorType `json:"system_vendor"`
	Hostname     string           `json:"hostname"`
}

type LLDPTLVType

type LLDPTLVType struct {
	Type  int
	Value string
}

func (*LLDPTLVType) UnmarshalJSON

func (r *LLDPTLVType) UnmarshalJSON(data []byte) error

UnmarshalJSON interprets an LLDP TLV [key, value] pair as an LLDPTLVType structure

type ListIntrospectionsOpts

type ListIntrospectionsOpts struct {
	// Requests a page size of items.
	Limit int `q:"limit"`

	// The ID of the last-seen item.
	Marker string `q:"marker"`
}

ListIntrospectionsOpts allows the filtering and sorting of paginated collections through the Introspection API. Filtering is achieved by passing in struct field values that map to the node attributes you want to see returned. Marker and Limit are used for pagination.

func (ListIntrospectionsOpts) ToIntrospectionsListQuery

func (opts ListIntrospectionsOpts) ToIntrospectionsListQuery() (string, error)

ToIntrospectionsListQuery formats a ListIntrospectionsOpts into a query string.

type ListIntrospectionsOptsBuilder

type ListIntrospectionsOptsBuilder interface {
	ToIntrospectionsListQuery() (string, error)
}

ListIntrospectionsOptsBuilder allows extensions to add additional parameters to the ListIntrospections request.

type MemoryType

type MemoryType struct {
	PhysicalMb int `json:"physical_mb"`
	Total      int `json:"total"`
}

type NUMACPU

type NUMACPU struct {
	CPU            int   `json:"cpu"`
	NUMANode       int   `json:"numa_node"`
	ThreadSiblings []int `json:"thread_siblings"`
}

type NUMANIC

type NUMANIC struct {
	Name     string `json:"name"`
	NUMANode int    `json:"numa_node"`
}

type NUMARAM

type NUMARAM struct {
	NUMANode int `json:"numa_node"`
	SizeKB   int `json:"size_kb"`
}

type NUMATopology

type NUMATopology struct {
	CPUs []NUMACPU `json:"cpus"`
	NICs []NUMANIC `json:"nics"`
	RAM  []NUMARAM `json:"ram"`
}

type RootDiskType

type RootDiskType struct {
	Hctl               string `json:"hctl"`
	Model              string `json:"model"`
	Name               string `json:"name"`
	ByPath             string `json:"by_path"`
	Rotational         bool   `json:"rotational"`
	Serial             string `json:"serial"`
	Size               int64  `json:"size"`
	Vendor             string `json:"vendor"`
	Wwn                string `json:"wwn"`
	WwnVendorExtension string `json:"wwn_vendor_extension"`
	WwnWithExtension   string `json:"wwn_with_extension"`
}

type StartOpts

type StartOpts struct {
	// Whether the current installation of ironic-inspector can manage PXE booting of nodes.
	ManageBoot *bool `q:"manage_boot"`
}

StartOpts represents options to start an introspection.

func (StartOpts) ToStartIntrospectionQuery

func (opts StartOpts) ToStartIntrospectionQuery() (string, error)

ToStartIntrospectionQuery converts a StartOpts into a request.

type StartOptsBuilder

type StartOptsBuilder interface {
	ToStartIntrospectionQuery() (string, error)
}

StartOptsBuilder allows extensions to add additional parameters to the Start request.

type StartResult

type StartResult struct {
	gophercloud.ErrResult
}

StartResult is the response from a StartIntrospection operation. Call its ExtractErr method to determine if the call succeeded or failed.

func StartIntrospection

func StartIntrospection(client *gophercloud.ServiceClient, nodeID string, opts StartOptsBuilder) (r StartResult)

StartIntrospection initiate hardware introspection for node NodeID . All power management configuration for this node needs to be done prior to calling the endpoint.

type SystemVendorType

type SystemVendorType struct {
	Manufacturer string `json:"manufacturer"`
	ProductName  string `json:"product_name"`
	SerialNumber string `json:"serial_number"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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