manila

package
v0.0.0-...-a7521c8 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logic

type Logic struct {
	// configuration
	CapacityCalculation struct {
		CapacityBalance   float64 `json:"capacity_balance"`
		ShareNetworks     uint64  `json:"share_networks"`
		SharesPerPool     uint64  `json:"shares_per_pool"`
		SnapshotsPerShare uint64  `json:"snapshots_per_share"`
		WithSubcapacities bool    `json:"with_subcapacities"`
	} `json:"capacity_calculation"`
	VirtualShareTypes                   []VirtualShareType `json:"share_types"`
	PrometheusAPIConfigForAZAwareness   *promquery.Config  `json:"prometheus_api_for_az_awareness"`
	PrometheusAPIConfigForNetappMetrics *promquery.Config  `json:"prometheus_api_for_netapp_metrics"`
	// connections
	ManilaV2      *gophercloud.ServiceClient                                 `json:"-"`
	AZMetrics     *promquery.BulkQueryCache[azMetricsKey, azMetrics]         `json:"-"`
	NetappMetrics *promquery.BulkQueryCache[netappMetricsKey, netappMetrics] `json:"-"`
	// caches
	ShareTypeIDByName liquidapi.State[map[RealShareType]string] `json:"-"`
}

func (*Logic) BuildServiceInfo

func (l *Logic) BuildServiceInfo(ctx context.Context) (liquid.ServiceInfo, error)

BuildServiceInfo implements the liquidapi.Logic interface.

func (*Logic) Init

func (l *Logic) Init(ctx context.Context, provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (err error)

Init implements the liquidapi.Logic interface.

func (*Logic) ScanCapacity

ScanCapacity implements the liquidapi.Logic interface.

func (*Logic) ScanUsage

func (l *Logic) ScanUsage(ctx context.Context, projectUUID string, req liquid.ServiceUsageRequest, serviceInfo liquid.ServiceInfo) (liquid.ServiceUsageReport, error)

ScanUsage implements the liquidapi.Logic interface.

func (*Logic) SetQuota

func (l *Logic) SetQuota(ctx context.Context, projectUUID string, req liquid.ServiceQuotaRequest, serviceInfo liquid.ServiceInfo) error

SetQuota implements the liquidapi.Logic interface.

type Pool

type Pool struct {
	Name         string `json:"name"`
	Host         string `json:"host"`
	Capabilities struct {
		// standard fields
		TotalCapacityGB     liquids.Float64WithStringErrors `json:"total_capacity_gb"`
		AllocatedCapacityGB liquids.Float64WithStringErrors `json:"allocated_capacity_gb"`
		// CCloud extension fields
		HardwareState string `json:"hardware_state"`
	} `json:"capabilities,omitempty"`
}

Pool is a custom extension of the type `schedulerstats.Pool`.

func (Pool) CountsUnusedCapacity

func (p Pool) CountsUnusedCapacity() bool

CountsUnusedCapacity returns whether this pool has all its capacity count towards the total (instead of just the used capacity).

type QuotaDetail

type QuotaDetail struct {
	Quota int64  `json:"limit"`
	Usage uint64 `json:"in_use"`
}

QuotaDetail appears in type QuotaSetDetail.

func (QuotaDetail) PrepareForBreakdownInto

func (q QuotaDetail) PrepareForBreakdownInto(allAZs []liquid.AvailabilityZone) *liquid.ResourceUsageReport

PrepareForBreakdownInto converts this QuotaDetail into a ResourceUsageReport.

func (QuotaDetail) ToResourceReport

func (q QuotaDetail) ToResourceReport(allAZs []liquid.AvailabilityZone, withAZMetrics bool) *liquid.ResourceUsageReport

ToResourceReport converts this QuotaDetail into a ResourceUsageReport.

type QuotaSet

type QuotaSet struct {
	Shares            uint64  `json:"shares"`
	Snapshots         uint64  `json:"snapshots"`
	Gigabytes         uint64  `json:"gigabytes"`
	SnapshotGigabytes uint64  `json:"snapshot_gigabytes"`
	ShareNetworks     *uint64 `json:"share_networks,omitempty"`
	Replicas          *uint64 `json:"share_replicas,omitempty"`
	ReplicaGigabytes  *uint64 `json:"replica_gigabytes,omitempty"`
}

QuotaSet is used when writing quotas.

func (QuotaSet) IsEmpty

func (qs QuotaSet) IsEmpty() bool

IsEmpty returns whether there is no non-zero value in this QuotaSet.

type QuotaSetDetail

type QuotaSetDetail struct {
	Shares            QuotaDetail `json:"shares"`
	Snapshots         QuotaDetail `json:"snapshots"`
	Gigabytes         QuotaDetail `json:"gigabytes"`
	SnapshotGigabytes QuotaDetail `json:"snapshot_gigabytes"`
	ShareNetworks     QuotaDetail `json:"share_networks,omitempty"`
	Replicas          QuotaDetail `json:"share_replicas"`
	ReplicaGigabytes  QuotaDetail `json:"replica_gigabytes"`
}

QuotaSetDetail is used when reading quota and usage.

type RealShareType

type RealShareType string

RealShareType is a share type name that can be used in the Manila API.

type StoragePoolAttributes

type StoragePoolAttributes struct {
	ExclusionReason string `json:"exclusion_reason,omitempty"`
	// Only set when ExclusionReason is set.
	RealCapacity uint64 `json:"real_capacity,omitempty"`
}

StoragePoolAttributes is the Attributes payload type for a Manila subcapacity.

type VirtualShareType

type VirtualShareType struct {
	Name               RealShareType `json:"name"`
	ReplicationEnabled bool          `json:"replication_enabled"` // only used by QuotaPlugin
	MappingRules       []struct {
		FullProjectNamePattern regexpext.BoundedRegexp `json:"match_project_name"`
		Name                   RealShareType           `json:"name"`
	} `json:"mapping_rules"`
}

VirtualShareType is the configuration for a virtual share type.

func (VirtualShareType) AllRealShareTypes

func (vst VirtualShareType) AllRealShareTypes() (result []RealShareType)

AllRealShareTypes returns all real share types that can be used on the Manila API to set quota or read usage for this virtual share type.

func (VirtualShareType) RealShareTypeIn

func (vst VirtualShareType) RealShareTypeIn(project liquid.ProjectMetadata) (rst RealShareType, omit bool)

RealShareTypeIn returns the real share type that we have to use on the Manila API for this particular project, or "" if this share type shall be skipped for this project.

func (VirtualShareType) ShareCapacityResourceName

func (vst VirtualShareType) ShareCapacityResourceName() liquid.ResourceName

func (VirtualShareType) SharesResourceName

func (vst VirtualShareType) SharesResourceName() liquid.ResourceName

func (VirtualShareType) SnapmirrorCapacityResourceName

func (vst VirtualShareType) SnapmirrorCapacityResourceName() liquid.ResourceName

func (VirtualShareType) SnapshotCapacityResourceName

func (vst VirtualShareType) SnapshotCapacityResourceName() liquid.ResourceName

func (VirtualShareType) SnapshotsResourceName

func (vst VirtualShareType) SnapshotsResourceName() liquid.ResourceName

Jump to

Keyboard shortcuts

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