schedulerstats

package
Version: v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package schedulerstats returns information about block storage pool capacity and utilisation. Example:

listOpts := schedulerstats.ListOpts{
	Detail: true,
}

allPages, err := schedulerstats.List(client, listOpts).AllPages()
if err != nil {
	panic(err)
}

allStats, err := schedulerstats.ExtractStoragePools(allPages)
if err != nil {
	panic(err)
}

for _, stat := range allStats {
	fmt.Printf("%+v\n", stat)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List makes a request against the API to list storage pool information.

Types

type Capabilities

type Capabilities struct {
	// The following fields should be present in all storage drivers.
	DriverVersion     string  `json:"driver_version"`
	FreeCapacityGB    float64 `json:"-"`
	StorageProtocol   string  `json:"storage_protocol"`
	TotalCapacityGB   float64 `json:"-"`
	VendorName        string  `json:"vendor_name"`
	VolumeBackendName string  `json:"volume_backend_name"`

	// The following fields are optional and may have empty values depending
	// on the storage driver in use.
	ReservedPercentage       int64   `json:"reserved_percentage"`
	LocationInfo             string  `json:"location_info"`
	QoSSupport               bool    `json:"QoS_support"`
	ProvisionedCapacityGB    float64 `json:"provisioned_capacity_gb"`
	MaxOverSubscriptionRatio float64 `json:"max_over_subscription_ratio"`
	ThinProvisioningSupport  bool    `json:"thin_provisioning_support"`
	ThickProvisioningSupport bool    `json:"thick_provisioning_support"`
	TotalVolumes             int64   `json:"total_volumes"`
	FilterFunction           string  `json:"filter_function"`
	GoodnessFuction          string  `json:"goodness_function"`
	Mutliattach              bool    `json:"multiattach"`
	SparseCopyVolume         bool    `json:"sparse_copy_volume"`
}

Capabilities represents the information of an individual StoragePool.

func (*Capabilities) UnmarshalJSON

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

type ListOpts

type ListOpts struct {
	// ID of the tenant to look up storage pools for.
	TenantID string `q:"tenant_id"`

	// Whether to list extended details.
	Detail bool `q:"detail"`
}

ListOpts controls the view of data returned (e.g globally or per project) via tenant_id and the verbosity via detail.

func (ListOpts) ToStoragePoolsListQuery

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

ToStoragePoolsListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToStoragePoolsListQuery() (string, error)
}

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

type StoragePool

type StoragePool struct {
	Name         string       `json:"name"`
	Capabilities Capabilities `json:"capabilities"`
}

StoragePool represents an individual StoragePool retrieved from the schedulerstats API.

func ExtractStoragePools

func ExtractStoragePools(p pagination.Page) ([]StoragePool, error)

ExtractStoragePools takes a List result and extracts the collection of StoragePools returned by the API.

type StoragePoolPage

type StoragePoolPage struct {
	pagination.SinglePageBase
}

StoragePoolPage is a single page of all List results.

func (StoragePoolPage) IsEmpty

func (page StoragePoolPage) IsEmpty() (bool, error)

IsEmpty satisfies the IsEmpty method of the Page interface. It returns true if a List contains no results.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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