nodes

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package nodes provides information and interaction with the nodes API resource in the OpenStack Bare Metal service.

Example to List Nodes with Detail

nodes.ListDetail(client, nodes.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) {
	nodeList, err := nodes.ExtractNodes(page)
	if err != nil {
		return false, err
	}

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

	return true, nil
})

Example to List Nodes

listOpts := nodes.ListOpts{
	ProvisionState: nodes.Deploying,
	Fields:         []string{"name"},
}

nodes.List(client, listOpts).EachPage(func(page pagination.Page) (bool, error) {
	nodeList, err := nodes.ExtractNodes(page)
	if err != nil {
		return false, err
	}

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

	return true, nil
})

Example to Create Node

createOpts := nodes.CreateOpts
	Driver:        "ipmi",
	BootInterface: "pxe",
	Name:          "coconuts",
	DriverInfo: map[string]interface{}{
		"ipmi_port":      "6230",
		"ipmi_username":  "admin",
		"deploy_kernel":  "http://172.22.0.1/images/tinyipa-stable-rocky.vmlinuz",
		"ipmi_address":   "192.168.122.1",
		"deploy_ramdisk": "http://172.22.0.1/images/tinyipa-stable-rocky.gz",
		"ipmi_password":  "admin",
	},
}

createNode, err := nodes.Create(client, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Get Node

showNode, err := nodes.Get(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").Extract()
if err != nil {
	panic(err)
}

Example to Update Node

updateOpts := nodes.UpdateOpts{
	nodes.UpdateOperation{
		Op:    ReplaceOp,
		Path:  "/maintenance",
		Value: "true",
	},
}

updateNode, err := nodes.Update(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474", updateOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete Node

err = nodes.Delete(client, "c9afd385-5d89-4ecb-9e1c-68194da6b474").ExtractErr()
if err != nil {
	panic(err)
}

Example to Validate Node

validation, err := nodes.Validate(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8").Extract()
if err != nil {
	panic(err)
}

Example to inject non-masking interrupts

err := nodes.InjectNMI(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8").ExtractErr()
if err != nil {
	panic(err)
}

Example to get array of supported boot devices for a node

bootDevices, err := nodes.GetSupportedBootDevices(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8").Extract()
if err != nil {
	panic(err)
}

Example to set boot device for a node

bootOpts := nodes.BootDeviceOpts{
	BootDevice: "pxe",
	Persistent: false,
}

err := nodes.SetBootDevice(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8", bootOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to get boot device for a node

bootDevice, err := nodes.GetBootDevice(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8").Extract()
if err != nil {
	panic(err)
}

Example to list all vendor passthru methods

methods, err := nodes.GetVendorPassthruMethods(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8").Extract()
if err != nil {
	panic(err)
}

Example to list all subscriptions

method := nodes.CallVendorPassthruOpts{
	Method: "get_all_subscriptions",
}
allSubscriptions, err := nodes.GetAllSubscriptions(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8", method).Extract()
if err != nil {
	panic(err)
}

Example to get a subscription

method := nodes.CallVendorPassthruOpts{
	Method: "get_subscription",
}
subscriptionOpt := nodes.GetSubscriptionOpts{
	Id:     "subscription id",
}

subscription, err := nodes.GetSubscription(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8", method, subscriptionOpt).Extract()
if err != nil {
	panic(err)
}

Example to delete a subscription

method := nodes.CallVendorPassthruOpts{
	Method: "delete_subscription",
}
subscriptionDeleteOpt := nodes.DeleteSubscriptionOpts{
	Id: "subscription id",
}

err := nodes.DeleteSubscription(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8", method, subscriptionDeleteOpt).ExtractErr()
if err != nil {
	panic(err)
}

Example to create a subscription

method := nodes.CallVendorPassthruOpts{
	Method: "create_subscription",
}
subscriptionCreateOpt := nodes.CreateSubscriptionOpts{
	Destination: "https://subscription_destination_url"
	Context:     "MyContext",
	Protocol:    "Redfish",
	EventTypes:  ["Alert"],
	HttpHeaders: [{"Key1":"Value1"}, {"Key2":"Value2"}],
}

newSubscription, err := nodes.CreateSubscription(client, "a62b8495-52e2-407b-b3cb-62775d04c2b8", method, subscriptionCreateOpt).Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNodesInto

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

func List

List makes a request against the API to list nodes accessible to you.

func ListDetail

func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

Return a list of bare metal Nodes with complete details. Some filtering is possible by passing in flags in ListOpts, but you cannot limit by the fields returned.

func ToCreateSubscriptionMap

func ToCreateSubscriptionMap(method CallVendorPassthruOpts, opts CreateSubscriptionOpts) (string, map[string]interface{}, error)

ToCreateSubscriptionMap assembles a query based on the contents of CallVendorPassthruOpts and a request body based on the contents of a CreateSubscriptionOpts

func ToDeleteSubscriptionMap

func ToDeleteSubscriptionMap(method CallVendorPassthruOpts, opts DeleteSubscriptionOpts) (string, map[string]interface{}, error)

ToDeleteSubscriptionMap assembles a query based on the contents of CallVendorPassthruOpts and a request body based on the contents of a DeleteSubscriptionOpts

func ToGetAllSubscriptionMap

func ToGetAllSubscriptionMap(opts CallVendorPassthruOpts) (string, error)

ToGetSubscriptionMap assembles a query based on the contents of a CallVendorPassthruOpts

func ToGetSubscriptionMap

func ToGetSubscriptionMap(method CallVendorPassthruOpts, opts GetSubscriptionOpts) (string, map[string]interface{}, error)

ToGetSubscriptionMap assembles a query based on the contents of CallVendorPassthruOpts and a request body based on the contents of a GetSubscriptionOpts

Types

type BIOSSetting

type BIOSSetting struct {

	// Identifier for the BIOS setting.
	Name string `json:"name"`

	// Value of the BIOS setting.
	Value string `json:"value"`

	// The type of setting - Enumeration, String, Integer, or Boolean.
	AttributeType string `json:"attribute_type"`

	// The allowable value for an Enumeration type setting.
	AllowableValues []string `json:"allowable_values"`

	// The lowest value for an Integer type setting.
	LowerBound *int `json:"lower_bound"`

	// The highest value for an Integer type setting.
	UpperBound *int `json:"upper_bound"`

	// Minimum length for a String type setting.
	MinLength *int `json:"min_length"`

	// Maximum length for a String type setting.
	MaxLength *int `json:"max_length"`

	// Whether or not this setting is read only.
	ReadOnly *bool `json:"read_only"`

	// Whether or not a reset is required after changing this setting.
	ResetRequired *bool `json:"reset_required"`

	// Whether or not this setting's value is unique to this node, e.g.
	// a serial number.
	Unique *bool `json:"unique"`
}

A particular BIOS setting for a node in the OpenStack Bare Metal API.

type BootDeviceOpts

type BootDeviceOpts struct {
	BootDevice string `json:"boot_device"` // e.g., 'pxe', 'disk', etc.
	Persistent bool   `json:"persistent"`  // Whether this is one-time or not
}

func (BootDeviceOpts) ToBootDeviceMap

func (opts BootDeviceOpts) ToBootDeviceMap() (map[string]interface{}, error)

ToBootDeviceSetMap assembles a request body based on the contents of a BootDeviceOpts.

type BootDeviceOptsBuilder

type BootDeviceOptsBuilder interface {
	ToBootDeviceMap() (map[string]interface{}, error)
}

BootDeviceOptsBuilder allows extensions to add additional parameters to the SetBootDevice request.

type BootDeviceResult

type BootDeviceResult struct {
	gophercloud.Result
}

BootDeviceResult is the response from a GetBootDevice operation. Call its Extract method to interpret it as a BootDeviceOpts struct.

func GetBootDevice

func GetBootDevice(client *gophercloud.ServiceClient, id string) (r BootDeviceResult)

Get the current boot device for the given Node.

func (BootDeviceResult) Extract

func (r BootDeviceResult) Extract() (*BootDeviceOpts, error)

Extract interprets a BootDeviceResult as BootDeviceOpts, if possible.

type CallVendorPassthruOpts

type CallVendorPassthruOpts struct {
	Method string `q:"method"`
}

CallVendorPassthruOpts defines query options that can be passed to any VendorPassthruCall

type ChangePowerStateResult

type ChangePowerStateResult struct {
	gophercloud.ErrResult
}

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

func ChangePowerState

func ChangePowerState(client *gophercloud.ServiceClient, id string, opts PowerStateOptsBuilder) (r ChangePowerStateResult)

Request to change a Node's power state.

type ChangeStateResult

type ChangeStateResult struct {
	gophercloud.ErrResult
}

ChangeStateResult is the response from any state change operation. Call its ExtractErr method to determine if the call succeeded or failed.

func ChangeProvisionState

func ChangeProvisionState(client *gophercloud.ServiceClient, id string, opts ProvisionStateOptsBuilder) (r ChangeStateResult)

Request a change to the Node’s provision state. Acceptable target states depend on the Node’s current provision state. More detailed documentation of the Ironic State Machine is available in the developer docs.

func SetRAIDConfig

func SetRAIDConfig(client *gophercloud.ServiceClient, id string, raidConfigOptsBuilder RAIDConfigOptsBuilder) (r ChangeStateResult)

Request to change a Node's RAID config.

type CleanStep

type CleanStep struct {
	Interface StepInterface          `json:"interface" required:"true"`
	Step      string                 `json:"step" required:"true"`
	Args      map[string]interface{} `json:"args,omitempty"`
}

A cleaning step has required keys ‘interface’ and ‘step’, and optional key ‘args’. If specified, the value for ‘args’ is a keyword variable argument dictionary that is passed to the cleaning step method.

type ConfigDrive

type ConfigDrive struct {
	MetaData    map[string]interface{} `json:"meta_data,omitempty"`
	NetworkData map[string]interface{} `json:"network_data,omitempty"`
	UserData    interface{}            `json:"user_data,omitempty"`
}

Starting with Ironic API version 1.56, a configdrive may be a JSON object with structured data. Prior to this version, it must be a base64-encoded, gzipped ISO9660 image.

type CreateOpts

type CreateOpts struct {
	// The interface to configure automated cleaning for a Node.
	// Requires microversion 1.47 or later.
	AutomatedClean *bool `json:"automated_clean,omitempty"`

	// The BIOS interface for a Node, e.g. “redfish”.
	BIOSInterface string `json:"bios_interface,omitempty"`

	// The boot interface for a Node, e.g. “pxe”.
	BootInterface string `json:"boot_interface,omitempty"`

	// The conductor group for a node. Case-insensitive string up to 255 characters, containing a-z, 0-9, _, -, and ..
	ConductorGroup string `json:"conductor_group,omitempty"`

	// The console interface for a node, e.g. “no-console”.
	ConsoleInterface string `json:"console_interface,omitempty"`

	// The deploy interface for a node, e.g. “iscsi”.
	DeployInterface string `json:"deploy_interface,omitempty"`

	// All the metadata required by the driver to manage this Node. List of fields varies between drivers, and can
	// be retrieved from the /v1/drivers/<DRIVER_NAME>/properties resource.
	DriverInfo map[string]interface{} `json:"driver_info,omitempty"`

	// name of the driver used to manage this Node.
	Driver string `json:"driver,omitempty"`

	// A set of one or more arbitrary metadata key and value pairs.
	Extra map[string]interface{} `json:"extra,omitempty"`

	// The interface used for node inspection, e.g. “no-inspect”.
	InspectInterface string `json:"inspect_interface,omitempty"`

	// Interface for out-of-band node management, e.g. “ipmitool”.
	ManagementInterface string `json:"management_interface,omitempty"`

	// Human-readable identifier for the Node resource. May be undefined. Certain words are reserved.
	Name string `json:"name,omitempty"`

	// Which Network Interface provider to use when plumbing the network connections for this Node.
	NetworkInterface string `json:"network_interface,omitempty"`

	// Interface used for performing power actions on the node, e.g. “ipmitool”.
	PowerInterface string `json:"power_interface,omitempty"`

	// Physical characteristics of this Node. Populated during inspection, if performed. Can be edited via the REST
	// API at any time.
	Properties map[string]interface{} `json:"properties,omitempty"`

	// Interface used for configuring RAID on this node, e.g. “no-raid”.
	RAIDInterface string `json:"raid_interface,omitempty"`

	// The interface used for node rescue, e.g. “no-rescue”.
	RescueInterface string `json:"rescue_interface,omitempty"`

	// A string which can be used by external schedulers to identify this Node as a unit of a specific type
	// of resource.
	ResourceClass string `json:"resource_class,omitempty"`

	// Interface used for attaching and detaching volumes on this node, e.g. “cinder”.
	StorageInterface string `json:"storage_interface,omitempty"`

	// The UUID for the resource.
	UUID string `json:"uuid,omitempty"`

	// Interface for vendor-specific functionality on this node, e.g. “no-vendor”.
	VendorInterface string `json:"vendor_interface,omitempty"`

	// A string or UUID of the tenant who owns the baremetal node.
	Owner string `json:"owner,omitempty"`

	// Static network configuration to use during deployment and cleaning.
	NetworkData map[string]interface{} `json:"network_data,omitempty"`
}

CreateOpts specifies node creation parameters.

func (CreateOpts) ToNodeCreateMap

func (opts CreateOpts) ToNodeCreateMap() (map[string]interface{}, error)

ToNodeCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToNodeCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult is the response from a Create operation.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create requests a node to be created

func (CreateResult) Extract

func (r CreateResult) Extract() (*Node, error)

Extract interprets any nodeResult as a Node, if possible.

func (CreateResult) ExtractInto

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

type CreateSubscriptionMethod

type CreateSubscriptionMethod struct {
	HTTPMethods          []string `json:"http_methods"`
	Async                bool     `json:"async"`
	Description          string   `json:"description"`
	Attach               bool     `json:"attach"`
	RequireExclusiveLock bool     `json:"require_exclusive_lock"`
}

type CreateSubscriptionOpts

type CreateSubscriptionOpts struct {
	Destination string              `json:"Destination"`
	EventTypes  []string            `json:"EventTypes,omitempty"`
	HttpHeaders []map[string]string `json:"HttpHeaders,omitempty"`
	Context     string              `json:"Context,omitempty"`
	Protocol    string              `json:"Protocol,omitempty"`
}

The desired subscription to be created from the baremetal node.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

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

func Delete

func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete requests that a node be removed

type DeleteSubscriptionMethod

type DeleteSubscriptionMethod struct {
	HTTPMethods          []string `json:"http_methods"`
	Async                bool     `json:"async"`
	Description          string   `json:"description"`
	Attach               bool     `json:"attach"`
	RequireExclusiveLock bool     `json:"require_exclusive_lock"`
}

type DeleteSubscriptionOpts

type DeleteSubscriptionOpts struct {
	Id string `json:"id"`
}

The desired subscription to be deleted from the baremetal node.

type DeleteSubscriptionVendorPassthruResult

type DeleteSubscriptionVendorPassthruResult struct {
	gophercloud.ErrResult
}

DeleteSubscriptionVendorPassthruResult is the response from DeleteSubscription operation. Call its ExtractErr method to determine if the call succeeded of failed.

func DeleteSubscription

Delete a subscription on the given node.

type DeployStep

type DeployStep struct {
	Interface StepInterface          `json:"interface" required:"true"`
	Step      string                 `json:"step" required:"true"`
	Args      map[string]interface{} `json:"args" required:"true"`
	Priority  int                    `json:"priority" required:"true"`
}

A deploy step has required keys ‘interface’, ‘step’, ’args’ and ’priority’. The value for ‘args’ is a keyword variable argument dictionary that is passed to the deploy step method. Priority is a numeric priority at which the step is running.

type DiskType

type DiskType string

DiskType is used to specify the disk type for a logical disk, e.g. hdd or ssd.

const (
	HDD DiskType = "hdd"
	SSD DiskType = "ssd"
)

type DriverValidation

type DriverValidation struct {
	Result bool   `json:"result"`
	Reason string `json:"reason"`
}

Each element in the response will contain a “result” variable, which will have a value of “true” or “false”, and also potentially a reason. A value of nil indicates that the Node’s driver does not support that interface.

type GetAllSubscriptionsMethod

type GetAllSubscriptionsMethod struct {
	HTTPMethods          []string `json:"http_methods"`
	Async                bool     `json:"async"`
	Description          string   `json:"description"`
	Attach               bool     `json:"attach"`
	RequireExclusiveLock bool     `json:"require_exclusive_lock"`
}

type GetAllSubscriptionsVendorPassthru

type GetAllSubscriptionsVendorPassthru struct {
	Context      string              `json:"@odata.context"`
	Etag         string              `json:"@odata.etag"`
	Id           string              `json:"@odata.id"`
	Type         string              `json:"@odata.type"`
	Description  string              `json:"Description"`
	Name         string              `json:"Name"`
	Members      []map[string]string `json:"Members"`
	MembersCount int                 `json:"Members@odata.count"`
}

A List of subscriptions from a node in the OpenStack Bare Metal API.

type GetAllSubscriptionsVendorPassthruResult

type GetAllSubscriptionsVendorPassthruResult struct {
	gophercloud.Result
}

GetAllSubscriptionsVendorPassthruResult is the response from GetAllSubscriptions operation. Call its Extract method to interpret it as a GetAllSubscriptionsVendorPassthru struct.

func GetAllSubscriptions

Get all subscriptions available for the given Node.

func (GetAllSubscriptionsVendorPassthruResult) Extract

type GetBIOSSettingResult

type GetBIOSSettingResult struct {
	gophercloud.Result
}

GetBIOSSettingResult is the response from a GetBIOSSetting operation. Call its Extract method to interpret it as a BIOSSetting struct.

func GetBIOSSetting

func GetBIOSSetting(client *gophercloud.ServiceClient, id string, setting string) (r GetBIOSSettingResult)

Get one BIOS Setting for the given Node.

func (GetBIOSSettingResult) Extract

func (r GetBIOSSettingResult) Extract() (*BIOSSetting, error)

Extract interprets a SingleBIOSSettingResult as a BIOSSetting struct, if possible.

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as a Node.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get requests details on a single node, by ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Node, error)

Extract interprets any nodeResult as a Node, if possible.

func (GetResult) ExtractInto

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

type GetSubscriptionMethod

type GetSubscriptionMethod struct {
	HTTPMethods          []string `json:"http_methods"`
	Async                bool     `json:"async"`
	Description          string   `json:"description"`
	Attach               bool     `json:"attach"`
	RequireExclusiveLock bool     `json:"require_exclusive_lock"`
}

type GetSubscriptionOpts

type GetSubscriptionOpts struct {
	Id string `json:"id"`
}

The desired subscription id on the baremetal node.

type InjectNMIResult

type InjectNMIResult struct {
	gophercloud.ErrResult
}

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

func InjectNMI

func InjectNMI(client *gophercloud.ServiceClient, id string) (r InjectNMIResult)

Inject NMI (Non-Masking Interrupts) for the given Node. This feature can be used for hardware diagnostics, and actual support depends on a driver.

type InterfaceType

type InterfaceType string

InterfaceType is used to specify the interface for a logical disk.

const (
	SATA InterfaceType = "sata"
	SCSI InterfaceType = "scsi"
	SAS  InterfaceType = "sas"
)

type ListBIOSSettingsOpts

type ListBIOSSettingsOpts struct {
	// Provide additional information for the BIOS Settings
	Detail bool `q:"detail"`

	// One or more fields to be returned in the response.
	Fields []string `q:"fields"`
}

ListBIOSSettingsOpts defines query options that can be passed to ListBIOSettings

func (ListBIOSSettingsOpts) ToListBIOSSettingsOptsQuery

func (opts ListBIOSSettingsOpts) ToListBIOSSettingsOptsQuery() (string, error)

ToListBIOSSettingsOptsQuery formats a ListBIOSSettingsOpts into a query string

type ListBIOSSettingsOptsBuilder

type ListBIOSSettingsOptsBuilder interface {
	ToListBIOSSettingsOptsQuery() (string, error)
}

ListBIOSSettingsOptsBuilder allows extensions to add additional parameters to the ListBIOSSettings request.

type ListBIOSSettingsResult

type ListBIOSSettingsResult struct {
	gophercloud.Result
}

ListBIOSSettingsResult is the response from a ListBIOSSettings operation. Call its Extract method to interpret it as an array of BIOSSetting structs.

func ListBIOSSettings

Get the current BIOS Settings for the given Node. To use the opts requires microversion 1.74.

func (ListBIOSSettingsResult) Extract

func (r ListBIOSSettingsResult) Extract() ([]BIOSSetting, error)

Extract interprets a BIOSSettingsResult as an array of BIOSSetting structs, if possible.

type ListOpts

type ListOpts struct {
	// Filter the list by specific instance UUID
	InstanceUUID string `q:"instance_uuid"`

	// Filter the list by chassis UUID
	ChassisUUID string `q:"chassis_uuid"`

	// Filter the list by maintenance set to True or False
	Maintenance bool `q:"maintenance"`

	// Nodes which are, or are not, associated with an instance_uuid.
	Associated bool `q:"associated"`

	// Only return those with the specified provision_state.
	ProvisionState ProvisionState `q:"provision_state"`

	// Filter the list with the specified driver.
	Driver string `q:"driver"`

	// Filter the list with the specified resource class.
	ResourceClass string `q:"resource_class"`

	// Filter the list with the specified conductor_group.
	ConductorGroup string `q:"conductor_group"`

	// Filter the list with the specified fault.
	Fault string `q:"fault"`

	// One or more fields to be returned in the response.
	Fields []string `q:"fields"`

	// Requests a page size of items.
	Limit int `q:"limit"`

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

	// Sorts the response by the requested sort direction.
	SortDir string `q:"sort_dir"`

	// Sorts the response by the this attribute value.
	SortKey string `q:"sort_key"`

	// A string or UUID of the tenant who owns the baremetal node.
	Owner string `q:"owner"`
}

ListOpts allows the filtering and sorting of paginated collections through the 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 (ListOpts) ToNodeListDetailQuery

func (opts ListOpts) ToNodeListDetailQuery() (string, error)

ToNodeListDetailQuery formats a ListOpts into a query string for the list details API.

func (ListOpts) ToNodeListQuery

func (opts ListOpts) ToNodeListQuery() (string, error)

ToNodeListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToNodeListQuery() (string, error)
	ToNodeListDetailQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type LogicalDisk

type LogicalDisk struct {
	// Size (Integer) of the logical disk to be created in GiB.  If unspecified, "MAX" will be used.
	SizeGB *int `json:"size_gb"`

	// RAID level for the logical disk.
	RAIDLevel RAIDLevel `json:"raid_level" required:"true"`

	// Name of the volume. Should be unique within the Node. If not specified, volume name will be auto-generated.
	VolumeName string `json:"volume_name,omitempty"`

	// Set to true if this is the root volume. At most one logical disk can have this set to true.
	IsRootVolume *bool `json:"is_root_volume,omitempty"`

	// Set to true if this logical disk can share physical disks with other logical disks.
	SharePhysicalDisks *bool `json:"share_physical_disks,omitempty"`

	// If this is not specified, disk type will not be a criterion to find backing physical disks
	DiskType DiskType `json:"disk_type,omitempty"`

	// If this is not specified, interface type will not be a criterion to find backing physical disks.
	InterfaceType InterfaceType `json:"interface_type,omitempty"`

	// Integer, number of disks to use for the logical disk. Defaults to minimum number of disks required
	// for the particular RAID level.
	NumberOfPhysicalDisks int `json:"number_of_physical_disks,omitempty"`

	// The name of the controller as read by the RAID interface.
	Controller string `json:"controller,omitempty"`

	// A list of physical disks to use as read by the RAID interface.
	PhysicalDisks []interface{} `json:"physical_disks,omitempty"`
}

type MaintenanceOpts

type MaintenanceOpts struct {
	Reason string `json:"reason,omitempty"`
}

MaintenanceOpts for a request to set the node's maintenance mode.

func (MaintenanceOpts) ToMaintenanceMap

func (opts MaintenanceOpts) ToMaintenanceMap() (map[string]interface{}, error)

ToMaintenanceMap assembles a request body based on the contents of a MaintenanceOpts.

type MaintenanceOptsBuilder

type MaintenanceOptsBuilder interface {
	ToMaintenanceMap() (map[string]interface{}, error)
}

MaintenanceOptsBuilder allows extensions to add additional parameters to the SetMaintenance request.

type Node

type Node struct {
	// Whether automated cleaning is enabled or disabled on this node.
	// Requires microversion 1.47 or later.
	AutomatedClean *bool `json:"automated_clean"`

	// UUID for the resource.
	UUID string `json:"uuid"`

	// Identifier for the Node resource. May be undefined. Certain words are reserved.
	Name string `json:"name"`

	// Current power state of this Node. Usually, “power on” or “power off”, but may be “None”
	// if Ironic is unable to determine the power state (eg, due to hardware failure).
	PowerState string `json:"power_state"`

	// A power state transition has been requested, this field represents the requested (ie, “target”)
	// state either “power on”, “power off”, “rebooting”, “soft power off” or “soft rebooting”.
	TargetPowerState string `json:"target_power_state"`

	// Current provisioning state of this Node.
	ProvisionState string `json:"provision_state"`

	// A provisioning action has been requested, this field represents the requested (ie, “target”) state. Note
	// that a Node may go through several states during its transition to this target state. For instance, when
	// requesting an instance be deployed to an AVAILABLE Node, the Node may go through the following state
	// change progression: AVAILABLE -> DEPLOYING -> DEPLOYWAIT -> DEPLOYING -> ACTIVE
	TargetProvisionState string `json:"target_provision_state"`

	// Whether or not this Node is currently in “maintenance mode”. Setting a Node into maintenance mode removes it
	// from the available resource pool and halts some internal automation. This can happen manually (eg, via an API
	// request) or automatically when Ironic detects a hardware fault that prevents communication with the machine.
	Maintenance bool `json:"maintenance"`

	// Description of the reason why this Node was placed into maintenance mode
	MaintenanceReason string `json:"maintenance_reason"`

	// Fault indicates the active fault detected by ironic, typically the Node is in “maintenance mode”. None means no
	// fault has been detected by ironic. “power failure” indicates ironic failed to retrieve power state from this
	// node. There are other possible types, e.g., “clean failure” and “rescue abort failure”.
	Fault string `json:"fault"`

	// Error from the most recent (last) transaction that started but failed to finish.
	LastError string `json:"last_error"`

	// Name of an Ironic Conductor host which is holding a lock on this node, if a lock is held. Usually “null”,
	// but this field can be useful for debugging.
	Reservation string `json:"reservation"`

	// Name of the driver.
	Driver string `json:"driver"`

	// The metadata required by the driver to manage this Node. List of fields varies between drivers, and can be
	// retrieved from the /v1/drivers/<DRIVER_NAME>/properties resource.
	DriverInfo map[string]interface{} `json:"driver_info"`

	// Metadata set and stored by the Node’s driver. This field is read-only.
	DriverInternalInfo map[string]interface{} `json:"driver_internal_info"`

	// Characteristics of this Node. Populated by ironic-inspector during inspection. May be edited via the REST
	// API at any time.
	Properties map[string]interface{} `json:"properties"`

	// Used to customize the deployed image. May include root partition size, a base 64 encoded config drive, and other
	// metadata. Note that this field is erased automatically when the instance is deleted (this is done by requesting
	// the Node provision state be changed to DELETED).
	InstanceInfo map[string]interface{} `json:"instance_info"`

	// ID of the Nova instance associated with this Node.
	InstanceUUID string `json:"instance_uuid"`

	// ID of the chassis associated with this Node. May be empty or None.
	ChassisUUID string `json:"chassis_uuid"`

	// Set of one or more arbitrary metadata key and value pairs.
	Extra map[string]interface{} `json:"extra"`

	// Whether console access is enabled or disabled on this node.
	ConsoleEnabled bool `json:"console_enabled"`

	// The current RAID configuration of the node. Introduced with the cleaning feature.
	RAIDConfig map[string]interface{} `json:"raid_config"`

	// The requested RAID configuration of the node, which will be applied when the Node next transitions
	// through the CLEANING state. Introduced with the cleaning feature.
	TargetRAIDConfig map[string]interface{} `json:"target_raid_config"`

	// Current clean step. Introduced with the cleaning feature.
	CleanStep map[string]interface{} `json:"clean_step"`

	// Current deploy step.
	DeployStep map[string]interface{} `json:"deploy_step"`

	// String which can be used by external schedulers to identify this Node as a unit of a specific type of resource.
	// For more details, see: https://docs.openstack.org/ironic/latest/install/configure-nova-flavors.html
	ResourceClass string `json:"resource_class"`

	// BIOS interface for a Node, e.g. “redfish”.
	BIOSInterface string `json:"bios_interface"`

	// Boot interface for a Node, e.g. “pxe”.
	BootInterface string `json:"boot_interface"`

	// Console interface for a node, e.g. “no-console”.
	ConsoleInterface string `json:"console_interface"`

	// Deploy interface for a node, e.g. “iscsi”.
	DeployInterface string `json:"deploy_interface"`

	// Interface used for node inspection, e.g. “no-inspect”.
	InspectInterface string `json:"inspect_interface"`

	// For out-of-band node management, e.g. “ipmitool”.
	ManagementInterface string `json:"management_interface"`

	// Network Interface provider to use when plumbing the network connections for this Node.
	NetworkInterface string `json:"network_interface"`

	// used for performing power actions on the node, e.g. “ipmitool”.
	PowerInterface string `json:"power_interface"`

	// Used for configuring RAID on this node, e.g. “no-raid”.
	RAIDInterface string `json:"raid_interface"`

	// Interface used for node rescue, e.g. “no-rescue”.
	RescueInterface string `json:"rescue_interface"`

	// Used for attaching and detaching volumes on this node, e.g. “cinder”.
	StorageInterface string `json:"storage_interface"`

	// Array of traits for this node.
	Traits []string `json:"traits"`

	// For vendor-specific functionality on this node, e.g. “no-vendor”.
	VendorInterface string `json:"vendor_interface"`

	// Conductor group for a node. Case-insensitive string up to 255 characters, containing a-z, 0-9, _, -, and ..
	ConductorGroup string `json:"conductor_group"`

	// The node is protected from undeploying, rebuilding and deletion.
	Protected bool `json:"protected"`

	// Reason the node is marked as protected.
	ProtectedReason string `json:"protected_reason"`

	// A string or UUID of the tenant who owns the baremetal node.
	Owner string `json:"owner"`

	// Static network configuration to use during deployment and cleaning.
	NetworkData map[string]interface{} `json:"network_data"`

	// The UTC date and time when the resource was created, ISO 8601 format.
	CreatedAt time.Time `json:"created_at"`

	// The UTC date and time when the resource was updated, ISO 8601 format. May be “null”.
	UpdatedAt time.Time `json:"updated_at"`

	// The UTC date and time when the provision state was updated, ISO 8601 format. May be “null”.
	ProvisionUpdatedAt time.Time `json:"provision_updated_at"`
}

Node represents a node in the OpenStack Bare Metal API.

func ExtractNodes

func ExtractNodes(r pagination.Page) ([]Node, error)

ExtractNodes interprets the results of a single page from a List() call, producing a slice of Node entities.

type NodePage

type NodePage struct {
	pagination.LinkedPageBase
}

NodePage abstracts the raw results of making a List() request against the 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 ExtractNodes call.

func (NodePage) IsEmpty

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

IsEmpty returns true if a page contains no Node results.

func (NodePage) NextPageURL

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

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

type NodeValidation

type NodeValidation struct {
	BIOS       DriverValidation `json:"bios"`
	Boot       DriverValidation `json:"boot"`
	Console    DriverValidation `json:"console"`
	Deploy     DriverValidation `json:"deploy"`
	Inspect    DriverValidation `json:"inspect"`
	Management DriverValidation `json:"management"`
	Network    DriverValidation `json:"network"`
	Power      DriverValidation `json:"power"`
	RAID       DriverValidation `json:"raid"`
	Rescue     DriverValidation `json:"rescue"`
	Storage    DriverValidation `json:"storage"`
}

Ironic validates whether the Node’s driver has enough information to manage the Node. This polls each interface on the driver, and returns the status of that interface as an DriverValidation struct.

type Patch

type Patch interface {
	ToNodeUpdateMap() (map[string]interface{}, error)
}

type PowerStateOpts

type PowerStateOpts struct {
	Target  TargetPowerState `json:"target" required:"true"`
	Timeout int              `json:"timeout,omitempty"`
}

PowerStateOpts for a request to change a node's power state.

func (PowerStateOpts) ToPowerStateMap

func (opts PowerStateOpts) ToPowerStateMap() (map[string]interface{}, error)

ToPowerStateMap assembles a request body based on the contents of a PowerStateOpts.

type PowerStateOptsBuilder

type PowerStateOptsBuilder interface {
	ToPowerStateMap() (map[string]interface{}, error)
}

PowerStateOptsBuilder allows extensions to add additional parameters to the ChangePowerState request.

type ProvisionState

type ProvisionState string

Provision state reports the current provision state of the node, these are only used in filtering

const (
	Enroll       ProvisionState = "enroll"
	Verifying    ProvisionState = "verifying"
	Manageable   ProvisionState = "manageable"
	Available    ProvisionState = "available"
	Active       ProvisionState = "active"
	DeployWait   ProvisionState = "wait call-back"
	Deploying    ProvisionState = "deploying"
	DeployFail   ProvisionState = "deploy failed"
	DeployDone   ProvisionState = "deploy complete"
	Deleting     ProvisionState = "deleting"
	Deleted      ProvisionState = "deleted"
	Cleaning     ProvisionState = "cleaning"
	CleanWait    ProvisionState = "clean wait"
	CleanFail    ProvisionState = "clean failed"
	Error        ProvisionState = "error"
	Rebuild      ProvisionState = "rebuild"
	Inspecting   ProvisionState = "inspecting"
	InspectFail  ProvisionState = "inspect failed"
	InspectWait  ProvisionState = "inspect wait"
	Adopting     ProvisionState = "adopting"
	AdoptFail    ProvisionState = "adopt failed"
	Rescue       ProvisionState = "rescue"
	RescueFail   ProvisionState = "rescue failed"
	Rescuing     ProvisionState = "rescuing"
	UnrescueFail ProvisionState = "unrescue failed"
	RescueWait   ProvisionState = "rescue wait"
	Unrescuing   ProvisionState = "unrescuing"
)

type ProvisionStateOpts

type ProvisionStateOpts struct {
	Target         TargetProvisionState `json:"target" required:"true"`
	ConfigDrive    interface{}          `json:"configdrive,omitempty"`
	CleanSteps     []CleanStep          `json:"clean_steps,omitempty"`
	DeploySteps    []DeployStep         `json:"deploy_steps,omitempty"`
	RescuePassword string               `json:"rescue_password,omitempty"`
}

ProvisionStateOpts for a request to change a node's provision state. A config drive should be base64-encoded gzipped ISO9660 image. Deploy steps are supported starting with API 1.69.

func (ProvisionStateOpts) ToProvisionStateMap

func (opts ProvisionStateOpts) ToProvisionStateMap() (map[string]interface{}, error)

ToProvisionStateMap assembles a request body based on the contents of a CreateOpts.

type ProvisionStateOptsBuilder

type ProvisionStateOptsBuilder interface {
	ToProvisionStateMap() (map[string]interface{}, error)
}

ProvisionStateOptsBuilder allows extensions to add additional parameters to the ChangeProvisionState request.

type RAIDConfigOpts

type RAIDConfigOpts struct {
	LogicalDisks []LogicalDisk `json:"logical_disks"`
}

This is the desired RAID configuration on the bare metal node.

func (RAIDConfigOpts) ToRAIDConfigMap

func (opts RAIDConfigOpts) ToRAIDConfigMap() (map[string]interface{}, error)

type RAIDConfigOptsBuilder

type RAIDConfigOptsBuilder interface {
	ToRAIDConfigMap() (map[string]interface{}, error)
}

RAIDConfigOptsBuilder allows extensions to modify a set RAID config request.

type RAIDLevel

type RAIDLevel string

RAIDLevel type is used to specify the RAID level for a logical disk.

const (
	RAID0  RAIDLevel = "0"
	RAID1  RAIDLevel = "1"
	RAID2  RAIDLevel = "2"
	RAID5  RAIDLevel = "5"
	RAID6  RAIDLevel = "6"
	RAID10 RAIDLevel = "1+0"
	RAID50 RAIDLevel = "5+0"
	RAID60 RAIDLevel = "6+0"
	JBOD   RAIDLevel = "JBOD"
)

type SetBootDeviceResult

type SetBootDeviceResult struct {
	gophercloud.ErrResult
}

SetBootDeviceResult is the response from a SetBootDevice operation. Call its Extract method to interpret it as a BootDeviceOpts struct.

func SetBootDevice

func SetBootDevice(client *gophercloud.ServiceClient, id string, bootDevice BootDeviceOptsBuilder) (r SetBootDeviceResult)

Set the boot device for the given Node, and set it persistently or for one-time boot. The exact behaviour of this depends on the hardware driver.

type SetMaintenanceResult

type SetMaintenanceResult struct {
	gophercloud.ErrResult
}

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

func SetMaintenance

func SetMaintenance(client *gophercloud.ServiceClient, id string, opts MaintenanceOptsBuilder) (r SetMaintenanceResult)

Request to set the Node's maintenance mode.

func UnsetMaintenance

func UnsetMaintenance(client *gophercloud.ServiceClient, id string) (r SetMaintenanceResult)

Request to unset the Node's maintenance mode.

type SingleBIOSSetting

type SingleBIOSSetting struct {
	Setting BIOSSetting
}

type StepInterface

type StepInterface string

An interface type for a deploy (or clean) step.

const (
	InterfaceBIOS       StepInterface = "bios"
	InterfaceDeploy     StepInterface = "deploy"
	InterfaceManagement StepInterface = "management"
	InterfacePower      StepInterface = "power"
	InterfaceRAID       StepInterface = "raid"
)

type SubscriptionVendorPassthru

type SubscriptionVendorPassthru struct {
	Id          string   `json:"Id"`
	Context     string   `json:"Context"`
	Destination string   `json:"Destination"`
	EventTypes  []string `json:"EventTypes"`
	Protocol    string   `json:"Protocol"`
}

A Subscription from a node in the OpenStack Bare Metal API.

type SubscriptionVendorPassthruResult

type SubscriptionVendorPassthruResult struct {
	gophercloud.Result
}

SubscriptionVendorPassthruResult is the response from GetSubscription and CreateSubscription operation. Call its Extract method to interpret it as a SubscriptionVendorPassthru struct.

func CreateSubscription

func CreateSubscription(client *gophercloud.ServiceClient, id string, method CallVendorPassthruOpts, subscriptionOpts CreateSubscriptionOpts) (r SubscriptionVendorPassthruResult)

Creates a subscription on the given node.

func GetSubscription

func GetSubscription(client *gophercloud.ServiceClient, id string, method CallVendorPassthruOpts, subscriptionOpts GetSubscriptionOpts) (r SubscriptionVendorPassthruResult)

Get a subscription on the given Node.

func (SubscriptionVendorPassthruResult) Extract

type SupportedBootDeviceResult

type SupportedBootDeviceResult struct {
	gophercloud.Result
}

SupportedBootDeviceResult is the response from a GetSupportedBootDevices operation. Call its Extract method to interpret it as an array of supported boot device values.

func GetSupportedBootDevices

func GetSupportedBootDevices(client *gophercloud.ServiceClient, id string) (r SupportedBootDeviceResult)

Retrieve the acceptable set of supported boot devices for a specific Node.

func (SupportedBootDeviceResult) Extract

func (r SupportedBootDeviceResult) Extract() ([]string, error)

Extract interprets a SupportedBootDeviceResult as an array of supported boot devices, if possible.

type TargetPowerState

type TargetPowerState string
const (
	PowerOn       TargetPowerState = "power on"
	PowerOff      TargetPowerState = "power off"
	Rebooting     TargetPowerState = "rebooting"
	SoftPowerOff  TargetPowerState = "soft power off"
	SoftRebooting TargetPowerState = "soft rebooting"
)

TargetPowerState is used when changing the power state of a node.

type TargetProvisionState

type TargetProvisionState string

TargetProvisionState is used when setting the provision state for a node.

const (
	TargetActive   TargetProvisionState = "active"
	TargetDeleted  TargetProvisionState = "deleted"
	TargetManage   TargetProvisionState = "manage"
	TargetProvide  TargetProvisionState = "provide"
	TargetInspect  TargetProvisionState = "inspect"
	TargetAbort    TargetProvisionState = "abort"
	TargetClean    TargetProvisionState = "clean"
	TargetAdopt    TargetProvisionState = "adopt"
	TargetRescue   TargetProvisionState = "rescue"
	TargetUnrescue TargetProvisionState = "unrescue"
)

type UpdateOp

type UpdateOp string
const (
	ReplaceOp UpdateOp = "replace"
	AddOp     UpdateOp = "add"
	RemoveOp  UpdateOp = "remove"
)

type UpdateOperation

type UpdateOperation struct {
	Op    UpdateOp    `json:"op" required:"true"`
	Path  string      `json:"path" required:"true"`
	Value interface{} `json:"value,omitempty"`
}

func (UpdateOperation) ToNodeUpdateMap

func (opts UpdateOperation) ToNodeUpdateMap() (map[string]interface{}, error)

type UpdateOpts

type UpdateOpts []Patch

UpdateOpts is a slice of Patches used to update a node

type UpdateResult

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

UpdateResult is the response from an Update operation. Call its Extract method to interpret it as a Node.

func Update

func Update(client *gophercloud.ServiceClient, id string, opts UpdateOpts) (r UpdateResult)

Update requests that a node be updated

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Node, error)

Extract interprets any nodeResult as a Node, if possible.

func (UpdateResult) ExtractInto

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

type ValidateResult

type ValidateResult struct {
	gophercloud.Result
}

ValidateResult is the response from a Validate operation. Call its Extract method to interpret it as a NodeValidation struct.

func Validate

func Validate(client *gophercloud.ServiceClient, id string) (r ValidateResult)

Request that Ironic validate whether the Node’s driver has enough information to manage the Node. This polls each interface on the driver, and returns the status of that interface.

func (ValidateResult) Extract

func (r ValidateResult) Extract() (*NodeValidation, error)

Extract interprets a ValidateResult as NodeValidation, if possible.

type VendorPassthruMethods

type VendorPassthruMethods struct {
	CreateSubscription  CreateSubscriptionMethod  `json:"create_subscription,omitempty"`
	DeleteSubscription  DeleteSubscriptionMethod  `json:"delete_subscription,omitempty"`
	GetSubscription     GetSubscriptionMethod     `json:"get_subscription,omitempty"`
	GetAllSubscriptions GetAllSubscriptionsMethod `json:"get_all_subscriptions,omitempty"`
}

type VendorPassthruMethodsResult

type VendorPassthruMethodsResult struct {
	gophercloud.Result
}

VendorPassthruMethodsResult is the response from a GetVendorPassthruMethods operation. Call its Extract method to interpret it as an array of allowed vendor methods.

func GetVendorPassthruMethods

func GetVendorPassthruMethods(client *gophercloud.ServiceClient, id string) (r VendorPassthruMethodsResult)

Get all vendor_passthru methods available for the given Node.

func (VendorPassthruMethodsResult) Extract

Extract interprets a VendorPassthruMethod as

Directories

Path Synopsis
nodes unit tests
nodes unit tests

Jump to

Keyboard shortcuts

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