metadata

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (

	// MetadataID is used as an identifier on the metadata search order configuration.
	MetadataID = "metadataService"

	// ConfigDriveID is used as an identifier on the metadata search order configuration.
	ConfigDriveID = "configDrive"
)

Variables

View Source
var ErrBadMetadata = errors.New("invalid OpenStack metadata, got empty uuid")

ErrBadMetadata is used to indicate a problem parsing data from metadata server

Functions

func CheckMetadataSearchOrder added in v1.21.0

func CheckMetadataSearchOrder(order string) error

func Clear

func Clear()

Clear clears the metadatacache

func GetDevicePath added in v1.15.0

func GetDevicePath(volumeID string) (string, error)

GetDevicePath retrieves device path from metadata service

func Set

func Set(value *Metadata)

Set sets the value of metadatacache

Types

type DeviceMetadata

type DeviceMetadata struct {
	Type    string `json:"type"`
	Bus     string `json:"bus,omitempty"`
	Serial  string `json:"serial,omitempty"`
	Address string `json:"address,omitempty"`
}

DeviceMetadata is a single/simplified data structure for all kinds of device metadata types.

type IMetadata added in v1.19.0

type IMetadata interface {
	GetInstanceID() (string, error)
	GetAvailabilityZone() (string, error)
}

IMetadata implements GetInstanceID & GetAvailabilityZone

var MetadataService IMetadata

MetadataService instance of IMetadata

func GetMetadataProvider added in v1.19.0

func GetMetadataProvider(order string) IMetadata

GetMetadataProvider retrieves instance of IMetadata

type Metadata

type Metadata struct {
	UUID             string           `json:"uuid"`
	Name             string           `json:"name"`
	AvailabilityZone string           `json:"availability_zone"`
	Devices          []DeviceMetadata `json:"devices,omitempty"`
}

Metadata has the information fetched from OpenStack metadata service or config drives. Assumes the "latest" meta_data.json format.

func Get

func Get(order string) (*Metadata, error)

Get retrieves metadata from either config drive or metadata service. Search order depends on the order set in config file.

type MetadataMock added in v1.19.0

type MetadataMock struct {
	mock.Mock
}

MetadataMock is an autogenerated mock type for the IMetadata type

func (*MetadataMock) GetAvailabilityZone added in v1.19.0

func (_m *MetadataMock) GetAvailabilityZone() (string, error)

GetAvailabilityZone provides a mock function with given fields:

func (*MetadataMock) GetInstanceID added in v1.19.0

func (_m *MetadataMock) GetInstanceID() (string, error)

GetInstanceID provides a mock function with given fields:

type MetadataOpts added in v1.21.0

type MetadataOpts struct {
	SearchOrder    string          `gcfg:"search-order"`
	RequestTimeout util.MyDuration `gcfg:"request-timeout"`
}

MetadataOpts is used for configuring how to talk to metadata service or config drive

Jump to

Keyboard shortcuts

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