openstack

package
v0.0.0-...-ecdaeff Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataLatestPath is the path to the metadata on the config drive
	MetadataLatestPath string = "openstack/latest/meta_data.json"

	// MetadataID is the identifier for the metadata service
	MetadataID string = "metadataService"

	// MetadataLastestServiceURL points to the latest metadata of the metadata service
	MetadataLatestServiceURL string = "http://169.254.169.254/" + MetadataLatestPath

	// ConfigDriveID is the identifier for the config drive containing metadata
	ConfigDriveID string = "configDrive"

	// ConfigDriveLabel identifies the config drive by label on the OS
	ConfigDriveLabel string = "config-2"

	// DefaultMetadataSearchOrder defines the default order in which the metadata services are queried
	DefaultMetadataSearchOrder string = ConfigDriveID + ", " + MetadataID
)

Variables

View Source
var (
	APIRequestMetrics = &OpenstackMetrics{
		Duration: prometheus.NewHistogramVec(
			prometheus.HistogramOpts{
				Name: "openstack_api_request_duration_seconds",
				Help: "Latency of an OpenStack API call",
			}, []string{"request"}),
		Total: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name: "openstack_api_requests_total",
				Help: "Total number of OpenStack API calls",
			}, []string{"request"}),
		Errors: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name: "openstack_api_request_errors_total",
				Help: "Total number of errors for an OpenStack API call",
			}, []string{"request"}),
	}
)

Functions

func GetServerFixedIP

func GetServerFixedIP(addrs map[string]interface{}, name string, networkCIDR *net.IPNet) (poolAddress string, err error)

func RegisterMetrics

func RegisterMetrics()

Types

type BlockStorageOpts

type BlockStorageOpts struct {
	IgnoreVolumeAZ bool `gcfg:"ignore-volume-az"`
}

type Config

type Config struct {
	Global struct {
		AuthURL                     string `gcfg:"auth-url"`
		Username                    string
		UserID                      string `gcfg:"user-id"`
		Password                    string
		TenantID                    string `gcfg:"tenant-id"`
		TenantName                  string `gcfg:"tenant-name"`
		TrustID                     string `gcfg:"trust-id"`
		DomainID                    string `gcfg:"domain-id"`
		DomainName                  string `gcfg:"domain-name"`
		TenantDomainID              string `gcfg:"tenant-domain-id"`
		TenantDomainName            string `gcfg:"tenant-domain-name"`
		Region                      string
		CAFile                      string `gcfg:"ca-file"`
		Cloud                       string `gcfg:"cloud,omitempty"`
		ApplicationCredentialID     string `gcfg:"application-credential-id"`
		ApplicationCredentialName   string `gcfg:"application-credential-name"`
		ApplicationCredentialSecret string `gcfg:"application-credential-secret"`
	}
	BlockStorage BlockStorageOpts
}

func ReadConfig

func ReadConfig(config io.Reader) (Config, error)

type InstanceMetadata

type InstanceMetadata struct {
	Name             string `json:"name"`
	ProjectID        string `json:"project_id"`
	AvailabilityZone string `json:"availability_zone"`
	Hostname         string `json:"hostname"`
	ServerID         string `json:"uuid"`
}

type MetadataService

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

type MetricContext

type MetricContext struct {
	Start      time.Time
	Attributes []string
	Metrics    *OpenstackMetrics
}

MetricContext indicates the context for OpenStack metrics.

func NewMetricContext

func NewMetricContext(resource string, request string) *MetricContext

NewMetricContext creates a new MetricContext.

func (*MetricContext) Observe

func (mc *MetricContext) Observe(om *OpenstackMetrics, err error) error

Observe records the request latency and counts the errors.

func (*MetricContext) ObserveRequest

func (mc *MetricContext) ObserveRequest(err error) error

ObserveRequest records the request latency and counts the errors.

type OpenstackMetrics

type OpenstackMetrics struct {
	Duration *prometheus.HistogramVec
	Total    *prometheus.CounterVec
	Errors   *prometheus.CounterVec
}

type OpenstackVolumes

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

OpenstackVolumes is the Volumes implementation for Openstack

func NewOpenstackVolumes

func NewOpenstackVolumes(clusterName string, volumeTags []string, nameTag string, networkCIDR *net.IPNet) (*OpenstackVolumes, error)

NewOpenstackVolumes builds a OpenstackVolume

func (*OpenstackVolumes) AttachVolume

func (stack *OpenstackVolumes) AttachVolume(volume *volumes.Volume) error

AttachVolume attaches the specified volume to this instance, returning the mountpoint & nil if successful

func (*OpenstackVolumes) FindMountedVolume

func (_ *OpenstackVolumes) FindMountedVolume(volume *volumes.Volume) (string, error)

FindMountedVolume implements Volumes::FindMountedVolume

func (*OpenstackVolumes) FindVolumes

func (stack *OpenstackVolumes) FindVolumes() ([]*volumes.Volume, error)

func (*OpenstackVolumes) InstanceName

func (stack *OpenstackVolumes) InstanceName() string

func (*OpenstackVolumes) InternalIP

func (stack *OpenstackVolumes) InternalIP() net.IP

InternalIP implements Volumes InternalIP

func (*OpenstackVolumes) MyIP

func (stack *OpenstackVolumes) MyIP() (string, error)

func (*OpenstackVolumes) Poll

func (os *OpenstackVolumes) Poll() (map[string]discovery.Node, error)

Jump to

Keyboard shortcuts

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