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(context.TODO(), client, NodeUUID, introspection.StartOpts{}).ExtractErr() if err != nil { panic(err) }
Example to Get an Introspection status
_, err := introspection.GetIntrospectionStatus(context.TODO(), client, NodeUUID).Extract() if err != nil { panic(err) }
Example to List all introspection statuses
introspection.ListIntrospections(client.ServiceClient(), nil).EachPage(context.TODO(), func(_ context.Context, 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(context.TODO(), 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 ¶
- func ExtractIntrospectionsInto(r pagination.Page, v any) error
- func ListIntrospections(client *gophercloud.ServiceClient, opts ListIntrospectionsOptsBuilder) pagination.Pager
- type AbortResult
- type ApplyDataResult
- type BaseInterfaceType
- type Data
- type DataResult
- type GetIntrospectionStatusResult
- type Introspection
- type IntrospectionPage
- type ListIntrospectionsOpts
- type ListIntrospectionsOptsBuilder
- type StartOpts
- type StartOptsBuilder
- type StartResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractIntrospectionsInto ¶
func ExtractIntrospectionsInto(r pagination.Page, v any) error
ExtractIntrospectionsInto will extract a collection of introspectResult pages into a slice of Introspection entities.
func ListIntrospections ¶
func ListIntrospections(client *gophercloud.ServiceClient, opts ListIntrospectionsOptsBuilder) pagination.Pager
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(ctx context.Context, 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(ctx context.Context, 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 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 inventory.InventoryType `json:"inventory"` IPMIAddress string `json:"ipmi_address"` LocalGB int `json:"local_gb"` MACs []string `json:"macs"` MemoryMB int `json:"memory_mb"` RootDisk inventory.RootDiskType `json:"root_disk"` Extra inventory.ExtraDataType `json:"extra"` NUMATopology inventory.NUMATopology `json:"numa_topology"` RawLLDP map[string][]inventory.LLDPTLVType `json:"lldp_raw"` }
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(ctx context.Context, 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 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(ctx context.Context, 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 ¶
ExtractInto will extract a response body into an Introspection struct.
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 []any `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 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 ¶
ListIntrospectionsOptsBuilder allows extensions to add additional parameters to the ListIntrospections request.
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 ¶
ToStartIntrospectionQuery converts a StartOpts into a request.
type StartOptsBuilder ¶
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(ctx context.Context, 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.