volume

package
v0.20.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// StorageDriver to be used to store name of the storage driver
	StorageDriver string
	// StorageProvisioner to be used to store name of the storage provisioner
	StorageProvisioner StorageProvisionerType
)

Functions

func GetStorageDriver

func GetStorageDriver() string

GetStorageDriver storage driver name to be used with Torpedo

func GetStorageProvisioner

func GetStorageProvisioner() string

GetStorageProvisioner storage provsioner name to be used with Torpedo

func GetVolumeDrivers

func GetVolumeDrivers() []string

GetVolumeDrivers returns list of supported volume drivers

func GetVolumeProvisioners

func GetVolumeProvisioners() []string

GetVolumeProvisioners returns list of supported volume provisioners

func Register

func Register(name string, driverProvisioners map[StorageProvisionerType]StorageProvisionerType, d Driver) error

Register registers the given volume driver

Types

type DefaultDriver

type DefaultDriver struct {
}

DefaultDriver implements defaults for Driver interface

func (*DefaultDriver) CalculateAutopilotObjectSize

func (d *DefaultDriver) CalculateAutopilotObjectSize(apRule apapi.AutopilotRule, initSize uint64, workloadSize uint64) uint64

CalculateAutopilotObjectSize calculates expected size based on autopilot rule, initial and workload sizes

func (*DefaultDriver) CleanupVolume

func (d *DefaultDriver) CleanupVolume(name string) error

CleanupVolume forcefully unmounts/detaches and deletes a storage volume. This is only called by Torpedo during cleanup operations, it is not used during orchestration simulations.

func (*DefaultDriver) CollectDiags

func (d *DefaultDriver) CollectDiags(n node.Node) error

CollectDiags collects live diags on a node

func (*DefaultDriver) CreateAutopilotRules

func (d *DefaultDriver) CreateAutopilotRules([]apapi.AutopilotRule) error

CreateAutopilotRules creates autopilot rules

func (*DefaultDriver) DecommissionNode

func (d *DefaultDriver) DecommissionNode(n *node.Node) error

DecommissionNode decommissions the given node from the cluster

func (*DefaultDriver) EstimatePoolExpandSize

func (d *DefaultDriver) EstimatePoolExpandSize(apRule apapi.AutopilotRule, pool node.StoragePool, node node.Node) (uint64, error)

EstimatePoolExpandSize calculates the expected size based on autopilot rule, initial and workload sizes

func (*DefaultDriver) EstimateVolumeExpand

func (d *DefaultDriver) EstimateVolumeExpand(apRule apapi.AutopilotRule, initialSize, workloadSize uint64) (uint64, int, error)

EstimateVolumeExpand calculates the expected size of a volume based on autopilot rule, initial and workload sizes

func (*DefaultDriver) ExtractVolumeInfo

func (d *DefaultDriver) ExtractVolumeInfo(params string) (string, map[string]string, error)

ExtractVolumeInfo extracts the volume params from the given string

func (*DefaultDriver) GetAggregationLevel

func (d *DefaultDriver) GetAggregationLevel(vol *Volume) (int64, error)

GetAggregationLevel returns the aggregation level for the given volume

func (*DefaultDriver) GetClusterPairingInfo

func (d *DefaultDriver) GetClusterPairingInfo() (map[string]string, error)

GetClusterPairingInfo returns cluster pair information

func (*DefaultDriver) GetMaxReplicationFactor

func (d *DefaultDriver) GetMaxReplicationFactor() int64

GetMaxReplicationFactor returns the max supported repl factor of a volume

func (*DefaultDriver) GetMinReplicationFactor

func (d *DefaultDriver) GetMinReplicationFactor() int64

GetMinReplicationFactor returns the min supported repl factor of a volume

func (*DefaultDriver) GetNodeForBackup

func (d *DefaultDriver) GetNodeForBackup(backupID string) (node.Node, error)

GetNodeForBackup returns the node on which the volume is attached

func (*DefaultDriver) GetNodeForVolume

func (d *DefaultDriver) GetNodeForVolume(vol *Volume, timeout time.Duration, retryInterval time.Duration) (*node.Node, error)

GetNodeForVolume returns the node on which the volume is attached

func (*DefaultDriver) GetNodeStatus

func (d *DefaultDriver) GetNodeStatus(n node.Node) (*api.Status, error)

GetNodeStatus returns the status of a given node

func (*DefaultDriver) GetReplicaSets

func (d *DefaultDriver) GetReplicaSets(torpedovol *Volume) ([]*api.ReplicaSet, error)

GetReplicaSets returns the replica sets for a given volume

func (*DefaultDriver) GetReplicationFactor

func (d *DefaultDriver) GetReplicationFactor(vol *Volume) (int64, error)

GetReplicationFactor returns the current replication factor of the volume.

func (*DefaultDriver) GetStorageDevices

func (d *DefaultDriver) GetStorageDevices(n node.Node) ([]string, error)

GetStorageDevices returns the list of storage devices used by the given node.

func (*DefaultDriver) Init

func (d *DefaultDriver) Init(sched, nodeDriver, token, storageProvisioner, csiGenericDriverConfigMap string) error

Init initializes the volume driver under the given scheduler

func (*DefaultDriver) IsStorageExpansionEnabled

func (d *DefaultDriver) IsStorageExpansionEnabled() (bool, error)

IsStorageExpansionEnabled returns true if storage expansion enabled

func (*DefaultDriver) RandomizeVolumeName

func (d *DefaultDriver) RandomizeVolumeName(params string) string

RandomizeVolumeName randomizes the volume name from the given name

func (*DefaultDriver) RecoverDriver

func (d *DefaultDriver) RecoverDriver(n node.Node) error

RecoverDriver will recover a volume driver from a failure/storage down state. This could be used by a volume driver to recover itself from any underlying storage failure.

func (*DefaultDriver) RefreshDriverEndpoints

func (d *DefaultDriver) RefreshDriverEndpoints() error

RefreshDriverEndpoints refreshes volume driver endpoint

func (*DefaultDriver) RejoinNode

func (d *DefaultDriver) RejoinNode(n *node.Node) error

RejoinNode rejoins a given node back to the cluster

func (*DefaultDriver) RestartDriver

func (d *DefaultDriver) RestartDriver(n node.Node, triggerOpts *driver_api.TriggerOptions) error

RestartDriver must cause the volume driver to restart on a given node.

func (*DefaultDriver) SetReplicationFactor

func (d *DefaultDriver) SetReplicationFactor(vol *Volume, replFactor int64, opts ...Options) error

SetReplicationFactor sets the volume's replication factor to the passed param rf.

func (*DefaultDriver) StartDriver

func (d *DefaultDriver) StartDriver(n node.Node) error

StartDriver must cause the volume driver to start on a given node.

func (*DefaultDriver) StopDriver

func (d *DefaultDriver) StopDriver(nodes []node.Node, force bool, triggerOpts *driver_api.TriggerOptions) error

StopDriver must cause the volume driver to exit on a given node. If force==true, the volume driver should get killed ungracefully

func (*DefaultDriver) String

func (d *DefaultDriver) String() string

func (*DefaultDriver) UpgradeDriver

func (d *DefaultDriver) UpgradeDriver(endpointURL string, endpointVersion string, enableStork bool) error

UpgradeDriver upgrades the volume driver from the given link and checks if it was upgraded to endpointVersion

func (*DefaultDriver) ValidateCreateVolume

func (d *DefaultDriver) ValidateCreateVolume(name string, params map[string]string) error

ValidateCreateVolume validates whether a volume has been created properly. params are the custom volume options passed when creating the volume.

func (*DefaultDriver) ValidateDeleteVolume

func (d *DefaultDriver) ValidateDeleteVolume(vol *Volume) error

ValidateDeleteVolume validates whether a volume is cleanly removed from the volume driver

func (*DefaultDriver) ValidateStoragePools

func (d *DefaultDriver) ValidateStoragePools() error

ValidateStoragePools validates all the storage pools

func (*DefaultDriver) ValidateUpdateVolume

func (d *DefaultDriver) ValidateUpdateVolume(vol *Volume, params map[string]string) error

ValidateUpdateVolume validates if volume changes has been applied

func (*DefaultDriver) ValidateVolumeCleanup

func (d *DefaultDriver) ValidateVolumeCleanup() error

ValidateVolumeCleanup checks if the necessary cleanup has happened for the volumes by this driver

func (*DefaultDriver) ValidateVolumeSetup

func (d *DefaultDriver) ValidateVolumeSetup(vol *Volume) error

ValidateVolumeSetup validates if the given volume is setup correctly in the cluster

func (*DefaultDriver) ValidateVolumeSnapshotRestore

func (d *DefaultDriver) ValidateVolumeSnapshotRestore(vol string, snapshotData *snapv1.VolumeSnapshotData, timeStart time.Time) error

ValidateVolumeSnapshotRestore return nil if snapshot is restored successuflly to given volumes TODO: additionally check for restore objects in case of cloudsnap

func (*DefaultDriver) WaitDriverDownOnNode

func (d *DefaultDriver) WaitDriverDownOnNode(n node.Node) error

WaitDriverDownOnNode must wait till the volume driver becomes unusable on a given node

func (*DefaultDriver) WaitDriverUpOnNode

func (d *DefaultDriver) WaitDriverUpOnNode(n node.Node, timeout time.Duration) error

WaitDriverUpOnNode must wait till the volume driver becomes usable on a given node

type Driver

type Driver interface {
	// Init initializes the volume driver under the given scheduler
	Init(sched string, nodeDriver string, token string, storageProvisioner string, csiGenericConfigMap string) error

	// String returns the string name of this driver.
	String() string

	// CleanupVolume forcefully unmounts/detaches and deletes a storage volume.
	// This is only called by Torpedo during cleanup operations, it is not
	// used during orchestration simulations.
	CleanupVolume(name string) error

	// ValidateCreateVolume validates whether a volume has been created properly.
	// params are the custom volume options passed when creating the volume.
	ValidateCreateVolume(name string, params map[string]string) error

	// ValidateUpdateVolume validates if volume changes has been applied
	ValidateUpdateVolume(vol *Volume, params map[string]string) error

	// ValidateDeleteVolume validates whether a volume is cleanly removed from the volume driver
	ValidateDeleteVolume(vol *Volume) error

	// ValidateVolumeCleanup checks if the necessary cleanup has happened for the volumes by this driver
	ValidateVolumeCleanup() error

	// ValidateVolumeSetup validates if the given volume is setup correctly in the cluster
	ValidateVolumeSetup(vol *Volume) error

	// StopDriver must cause the volume driver to exit on a given node. If force==true, the volume driver should get killed ungracefully
	StopDriver(nodes []node.Node, force bool, triggerOpts *driver_api.TriggerOptions) error

	// StartDriver must cause the volume driver to start on a given node.
	StartDriver(n node.Node) error

	// RestartDriver must cause the volume driver to get restarted on a given node.
	RestartDriver(n node.Node, triggerOpts *driver_api.TriggerOptions) error

	// WaitDriverUpOnNode must wait till the volume driver becomes usable on a given node
	WaitDriverUpOnNode(n node.Node, timeout time.Duration) error

	// WaitDriverDownOnNode must wait till the volume driver becomes unusable on a given node
	WaitDriverDownOnNode(n node.Node) error

	// GetNodeForVolume returns the node on which the volume is attached
	GetNodeForVolume(vol *Volume, timeout time.Duration, retryInterval time.Duration) (*node.Node, error)

	// GetNodeForBackup returns the node on which cloudsnap backup is started
	GetNodeForBackup(backupID string) (node.Node, error)

	// ExtractVolumeInfo extracts the volume params from the given string
	ExtractVolumeInfo(params string) (string, map[string]string, error)

	// UpgradeDriver upgrades the volume driver from the given link and checks if it was upgraded to endpointVersion
	UpgradeDriver(endpointURL string, endpointVersion string, enableStork bool) error

	// RandomizeVolumeName randomizes the volume name from the given name
	RandomizeVolumeName(name string) string

	// RecoverDriver will recover a volume driver from a failure/storage down state.
	// This could be used by a volume driver to recover itself from any underlying storage
	// failure.
	RecoverDriver(n node.Node) error

	// RefreshDriverEndpoints refreshes volume driver endpoint
	RefreshDriverEndpoints() error

	// GetStorageDevices returns the list of storage devices used by the given node.
	GetStorageDevices(n node.Node) ([]string, error)

	// GetReplicationFactor returns the current replication factor of the volume.
	GetReplicationFactor(vol *Volume) (int64, error)

	// SetReplicationFactor sets the volume's replication factor to the passed param rf.
	SetReplicationFactor(vol *Volume, rf int64, opts ...Options) error

	// GetMaxReplicationFactor returns the max supported repl factor of a volume
	GetMaxReplicationFactor() int64

	// GetMinReplicationFactor returns the min supported repl factor of a volume
	GetMinReplicationFactor() int64

	// GetAggregationLevel returns the aggregation level for the given volume
	GetAggregationLevel(vol *Volume) (int64, error)

	// GetClusterPairingInfo returns cluster pairing information from remote cluster
	GetClusterPairingInfo() (map[string]string, error)

	// DecommissionNode decommissions the given node from the cluster
	DecommissionNode(n *node.Node) error

	// RejoinNode rejoins a given node back to the cluster
	RejoinNode(n *node.Node) error

	// GetNodeStatus returns the status of a given node
	GetNodeStatus(n node.Node) (*api.Status, error)

	// GetReplicaSets returns the replica sets for a given volume
	GetReplicaSets(vol *Volume) ([]*api.ReplicaSet, error)

	// ValidateVolumeSnapshotRestore return nil if snapshot is restored successuflly to
	// given volumes
	ValidateVolumeSnapshotRestore(vol string, snapData *snapv1.VolumeSnapshotData, timeStart time.Time) error

	// CollectDiags collects live diags on a node
	CollectDiags(n node.Node) error

	// ValidateStoragePools validates all the storage pools
	ValidateStoragePools() error

	// IsStorageExpansionEnabled returns true if storage expansion enabled
	IsStorageExpansionEnabled() (bool, error)

	// EstimatePoolExpandSize calculates expected pool size based on autopilot rule
	EstimatePoolExpandSize(apRule apapi.AutopilotRule, pool node.StoragePool, node node.Node) (uint64, error)

	// EstimatePoolExpandSize calculates expected volume size based on autopilot rule, initial and workload sizes
	EstimateVolumeExpand(apRule apapi.AutopilotRule, initialSize, workloadSize uint64) (uint64, int, error)
}

Driver defines an external volume driver interface that must be implemented by any external storage provider that wants to qualify their product with Torpedo. The functions defined here are meant to be destructive and illustrative of failure scenarious that can happen with an external storage provider.

func Get

func Get(name string) (Driver, error)

Get an external storage provider to be used with Torpedo.

type Image

type Image struct {
	Type    string
	Version string
}

Image is a generic struct for encapsulating driver images/version

type Options

type Options struct {
	ValidateReplicationUpdateTimeout time.Duration
}

Options to pass to APIs

type Snapshot

type Snapshot struct {
	ID        string
	Name      string
	Namespace string
}

Snapshot is a generic struct encapsulating snapshots in the cluster

type StorageProvisionerType

type StorageProvisionerType string

StorageProvisionerType provisioner to be used for torpedo volumes

const (
	// DefaultStorageProvisioner default storage provisioner name
	DefaultStorageProvisioner StorageProvisionerType = "portworx"
)

type Volume

type Volume struct {
	ID            string
	Name          string
	Namespace     string
	Annotations   map[string]string
	Labels        map[string]string
	Size          uint64
	RequestedSize uint64
	Shared        bool
}

Volume is a generic struct encapsulating volumes in the cluster

func (*Volume) String

func (v *Volume) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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