Documentation
¶
Overview ¶
Package array provides structs and methods for configuring connection to PowerStore array.
Index ¶
- Constants
- Variables
- func CreateOrUpdateJournalEntry(ctx context.Context, name string, volumeHandle VolumeHandle, ...) error
- func GetLeastUsedActiveNAS(ctx context.Context, arr *PowerStoreArray, nasServers []string) (string, error)
- func GetNASInCooldown(arr *PowerStoreArray, nasServers []string) []string
- func GetVolumeUUIDPrefix(volumeID string) (prefix string)
- func IsLessUsed(nas, current *gopowerstore.NAS) bool
- type Consumer
- type HostConnectivity
- type Locker
- func (s *Locker) Arrays() map[string]*PowerStoreArray
- func (s *Locker) DefaultArray() *PowerStoreArray
- func (s *Locker) Get(globalID string) (storage.HealthChecker, error)
- func (s *Locker) GetOneArray(globalID string) (*PowerStoreArray, error)
- func (s *Locker) SetArrays(arrays map[string]*PowerStoreArray)
- func (s *Locker) SetDefaultArray(array *PowerStoreArray)
- func (s *Locker) UpdateArrays(configPath string, fs fs.Interface) error
- type MetroConnectivityOptions
- type MetroFracturedResponse
- type NASCooldown
- func (n *NASCooldown) FallbackRetry(nasList []string) string
- func (n *NASCooldown) GetCooldownPeriod() time.Duration
- func (n *NASCooldown) GetStatusMap() map[string]*NASStatus
- func (n *NASCooldown) GetThreshold() int
- func (n *NASCooldown) IsInCooldown(nas string) bool
- func (n *NASCooldown) MarkFailure(nas string)
- func (n *NASCooldown) ResetFailure(nas string)
- type NASCooldownTracker
- type NASStatus
- type PowerStoreArray
- func (psa *PowerStoreArray) CheckConnectivity(ctx context.Context, kubeNodeID string) bool
- func (psa *PowerStoreArray) DoesNodeMatchMetroSelectors(node *k8score.Node) bool
- func (psa *PowerStoreArray) GetClient() gopowerstore.Client
- func (psa *PowerStoreArray) GetGlobalID() string
- func (psa *PowerStoreArray) GetIP() string
- func (psa *PowerStoreArray) GetNasName() string
- func (psa *PowerStoreArray) IsOnline(ctx context.Context) bool
- type VolumeHandle
Constants ¶
const ( MediumTimeout = 30 * time.Second MetroPrefixRegex = `^Metro_(Demote|Promote|Reprotect).*` )
Variables ¶
var GetDRClientFunc = drv1Client.Get
var ( // IPToArray - Store Array IPs IPToArray map[string]string )
Functions ¶
func CreateOrUpdateJournalEntry ¶ added in v2.16.0
func GetLeastUsedActiveNAS ¶ added in v2.14.0
func GetLeastUsedActiveNAS(ctx context.Context, arr *PowerStoreArray, nasServers []string) (string, error)
GetLeastUsedActiveNAS finds the active NAS with the least FS count
func GetNASInCooldown ¶ added in v2.14.0
func GetNASInCooldown(arr *PowerStoreArray, nasServers []string) []string
GetNASInCooldown returns a list of NAS servers that are in cooldown
func GetVolumeUUIDPrefix ¶ added in v2.14.0
GetVolumeUUIDPrefix extracts the prefix, if any exists, from a volume ID with a UUID format. The prefix is assumed to be all characters preceding the volume UUID including separators/delimiters, e.g. '-'. If no prefix is found, or the volume ID is not of the UUID format, the function returns an empty string.
func IsLessUsed ¶ added in v2.14.0
func IsLessUsed(nas, current *gopowerstore.NAS) bool
Types ¶
type Consumer ¶
type Consumer interface {
Arrays() map[string]*PowerStoreArray
SetArrays(map[string]*PowerStoreArray)
DefaultArray() *PowerStoreArray
SetDefaultArray(*PowerStoreArray)
UpdateArrays(string, fs.Interface) error
}
Consumer provides methods for safe management of arrays
type HostConnectivity ¶ added in v2.16.0
type HostConnectivity struct {
// Local contains a NodeSelector term used to identify nodes that are locally
// connected to the current PowerStore array and should register their hosts locally.
Local k8score.NodeSelector `yaml:"local" json:"local"`
// Metro contains more-specific options for how to register a host for
// use with uniform metro replication. For non-uniform metro replication,
// hosts should be registered as Local.
Metro MetroConnectivityOptions `yaml:"metro" json:"metro"`
}
HostConnectivity provides two host connectivity options for nodes that will register hosts in a PowerStore system -- Local and Metro.
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
Locker provides implementation for safe management of arrays
func (*Locker) Arrays ¶
func (s *Locker) Arrays() map[string]*PowerStoreArray
Arrays is a getter for list of arrays
func (*Locker) DefaultArray ¶
func (s *Locker) DefaultArray() *PowerStoreArray
DefaultArray is a getter for default array
func (*Locker) Get ¶ added in v2.16.0
func (s *Locker) Get(globalID string) (storage.HealthChecker, error)
Get returns a PowerStoreArray associated with the globalID if one exists in the Locker.
Satisfies the ArrayLister interface for csm-dr
func (*Locker) GetOneArray ¶
func (s *Locker) GetOneArray(globalID string) (*PowerStoreArray, error)
GetOneArray is a getter for an arrays based on globalID
func (*Locker) SetArrays ¶
func (s *Locker) SetArrays(arrays map[string]*PowerStoreArray)
SetArrays adds an array
func (*Locker) SetDefaultArray ¶
func (s *Locker) SetDefaultArray(array *PowerStoreArray)
SetDefaultArray sets default array
type MetroConnectivityOptions ¶ added in v2.16.0
type MetroConnectivityOptions struct {
// ColocatedLocal contains a NodeSelector term used to identify nodes that are
// colocated with the current PowerStore array and should register a host with the system.
ColocatedLocal k8score.NodeSelector `yaml:"colocatedLocal" json:"colocatedLocal"`
// ColocatedRemote contains a NodeSelector term used to identify nodes that are
// NOT colocated with the current PowerStore array, but are instead colocated with the
// metro replication target and should still register a host with this system as a secondary path.
ColocatedRemote k8score.NodeSelector `yaml:"colocatedRemote" json:"colocatedRemote"`
// ColocatedBoth contains a NodeSelector term used to identify nodes that are
// colocated with both the current PowerStore array and the metro replication target PowerStore
// array and should register a host with the current system.
ColocatedBoth k8score.NodeSelector `yaml:"colocatedBoth" json:"colocatedBoth"`
}
MetroConnectivityOptions provides options for how a host should be registered to optimize the connection for uniform metro replication.
type MetroFracturedResponse ¶ added in v2.16.0
func CheckMetroState ¶ added in v2.16.0
func CheckMetroState(ctx context.Context, volumeHandle VolumeHandle, localClient gopowerstore.Client, remoteClient gopowerstore.Client) (*MetroFracturedResponse, bool, error)
checkMetroState checks metro state of a volume. Tries to get metroState from the localArray first. if there was error fetching this, tries to get the metro state from the remote array. Parameters: volumeHandle of the metro volume and the clients for the local and remote arrays. Returns: MetroFracturedResponse, bool indicating if localVolume of the metro was demoted or not and error
- empty MetroFracturedResponse , false and error in case of error checking metro state.
- MetroFracturedResponse(including isFractured and volumeName), true, nil error in case metro is Fractured and localVolume is demoted.
- MetroFracturedResponse(including isFractured and volumeName), false, nil error in case metro is Fractured and localVolume is promoted.
MetroFracturedResponse ( includes isFractured and volumeName which are used from the response) , a boolean that indicates whether the localVolume of the metro was demoted or not and error.
func IsMetroFractured ¶ added in v2.16.0
func IsMetroFractured(ctx context.Context, client gopowerstore.Client, id string) (*MetroFracturedResponse, error)
type NASCooldown ¶ added in v2.14.0
type NASCooldown struct {
// contains filtered or unexported fields
}
func NewNASCooldown ¶ added in v2.14.0
func NewNASCooldown(cooldownPeriod time.Duration, threshold int) *NASCooldown
NewNASCooldown returns a new instance of NASCooldown.
func (*NASCooldown) FallbackRetry ¶ added in v2.14.0
func (n *NASCooldown) FallbackRetry(nasList []string) string
Fallback logic - Retry all NAS servers, prioritizing least failed ones
func (*NASCooldown) GetCooldownPeriod ¶ added in v2.14.0
func (n *NASCooldown) GetCooldownPeriod() time.Duration
GetCooldownPeriod is a getter for cooldownPeriod
func (*NASCooldown) GetStatusMap ¶ added in v2.14.0
func (n *NASCooldown) GetStatusMap() map[string]*NASStatus
GetStatusMap is a getter for statusMap
func (*NASCooldown) GetThreshold ¶ added in v2.14.0
func (n *NASCooldown) GetThreshold() int
GetThreshold is a getter for threshold
func (*NASCooldown) IsInCooldown ¶ added in v2.14.0
func (n *NASCooldown) IsInCooldown(nas string) bool
Check if NAS is in cooldown
func (*NASCooldown) MarkFailure ¶ added in v2.14.0
func (n *NASCooldown) MarkFailure(nas string)
Mark NAS as failed; only enter cooldown if threshold exceeded
func (*NASCooldown) ResetFailure ¶ added in v2.14.0
func (n *NASCooldown) ResetFailure(nas string)
Reset failure count on successful FS creation
type NASCooldownTracker ¶ added in v2.14.0
type PowerStoreArray ¶
type PowerStoreArray struct {
Endpoint string `yaml:"endpoint" json:"endpoint"`
GlobalID string `yaml:"globalID" json:"globalID"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
NasName string `yaml:"nasName" json:"nasName"`
BlockProtocol identifiers.TransportType `yaml:"blockProtocol" json:"blockProtocol"`
Insecure bool `yaml:"skipCertificateValidation" json:"skipCertificateValidation"`
IsDefault bool `yaml:"isDefault" json:"isDefault"`
NfsAcls string `yaml:"nfsAcls" json:"nfsAcls"`
// MetroTopology describes the desired topology of the hosts configured for
// metro replication. Accepted values are "Uniform" and "Non-Uniform", with
// "Non-Uniform" not yet being implemented.
//
// Deprecated: MetroTopology is deprecated and remains only for purposes of
// backward compatibility. Use HostConnectivity instead.
MetroTopology string `yaml:"metroTopology" json:"metroTopology"`
// Labels is a set of labels, ANDed to build a node selector query. Used in
// conjunction with MetroTopology to identify nodes that should register
// metro hosts in this PowerStore system.
Labels map[string]string `yaml:"labels" json:"labels"`
// HostConnectivity describes how nodes should register their hosts
// for this PowerStore system.
HostConnectivity *HostConnectivity `yaml:"hostConnectivity" json:"hostConnectivity"`
Client gopowerstore.Client
IP string
NASCooldownTracker NASCooldownTracker
}
PowerStoreArray is a struct that stores all PowerStore connection information. It stores gopowerstore client that can be directly used to invoke PowerStore API calls. This structure is supposed to be parsed from config and mainly is created by GetPowerStoreArrays function.
func GetPowerStoreArrays ¶
func GetPowerStoreArrays(fs fs.Interface, filePath string) (map[string]*PowerStoreArray, map[string]string, *PowerStoreArray, error)
GetPowerStoreArrays parses config.yaml file, initializes gopowerstore Clients and composes map of arrays for ease of access. It will return array that can be used as default as a second return parameter. If config does not have any array as a default then the first will be returned as a default.
func (*PowerStoreArray) CheckConnectivity ¶ added in v2.16.0
func (psa *PowerStoreArray) CheckConnectivity(ctx context.Context, kubeNodeID string) bool
checkConnectivity checks if kubeNode matches metro selector.
func (*PowerStoreArray) DoesNodeMatchMetroSelectors ¶ added in v2.16.0
func (psa *PowerStoreArray) DoesNodeMatchMetroSelectors(node *k8score.Node) bool
DoesNodeMatchMetroSelectors checks if the given node matches any of the provided metro selectors in secret
func (*PowerStoreArray) GetClient ¶
func (psa *PowerStoreArray) GetClient() gopowerstore.Client
GetClient is a getter that returns gopowerstore Client interface
func (*PowerStoreArray) GetGlobalID ¶
func (psa *PowerStoreArray) GetGlobalID() string
GetGlobalID is a getter that returns GlobalID address of the array
func (*PowerStoreArray) GetIP ¶
func (psa *PowerStoreArray) GetIP() string
GetIP is a getter that returns IP address of the array
func (*PowerStoreArray) GetNasName ¶
func (psa *PowerStoreArray) GetNasName() string
GetNasName is a getter that returns name of configured NAS
func (*PowerStoreArray) IsOnline ¶ added in v2.16.0
func (psa *PowerStoreArray) IsOnline(ctx context.Context) bool
IsOnline returns true if the PowerStoreArray is online; false otherwise. Array status is determined by submitting a REST request for the array cluster using the gopowerstore API.
Satisfies the HealthChecker interface for csm-dr.
type VolumeHandle ¶ added in v2.14.0
type VolumeHandle struct {
// The UUID of a volume provisioned by a PowerStore system that is locally managed by this driver.
LocalUUID string
// The Global ID of the PowerStore system that is locally managed by this driver. The Global ID
// can be found in the PowerStore UI under Settings > Properties
LocalArrayGlobalID string
// The UUID of a volume provisioned by a PowerStore system that is paired for replication with the
// PowerStore system managed by this driver. Currently only used for Metro replicated volume handles.
RemoteUUID string
// The Global ID of the PowerStore system that is paired for replication with the PowerStore system
// managed by this driver. Currently only used for Metro replicated volume handles.
// The Global ID can be found in the PowerStore UI under Settings > Properties
RemoteArrayGlobalID string
// One of "scsi" or "nfs"
Protocol string
}
VolumeHandle represents the components of a unique csi-powerstore volume identifier and any remote volumes associated with the volume via data replication.
func ParseVolumeID ¶
func ParseVolumeID(ctx context.Context, volumeHandleRaw string, defaultArray *PowerStoreArray, vc *csi.VolumeCapability, ) (volumeHandle VolumeHandle, err error)
ParseVolumeID parses a volume id from the CO (Kubernetes) and tries to extract local and remote PowerStore volume UUID, Global ID, and protocol.
Example:
ParseVolumeID("1cd254s/192.168.0.1/scsi") assuming 192.168.0.1 is the IP array PSabc0123def will return
VolumeHandle{
LocalUUID: "1cd254s",
LocalArrayGlobalID: "PSabc0123def",
RemoteUUID: "",
RemoteArrayGlobalID: "",
Protocol: "scsi",
}, nil
Example:
ParseVolumeID("9f840c56-96e6-4de9-b5a3-27e7c20eaa77/PSabcdef0123/scsi:9f840c56-96e6-4de9-b5a3-27e7c20eaa77/PS0123abcdef") returns
VolumeHandle{
LocalUUID: "9f840c56-96e6-4de9-b5a3-27e7c20eaa77",
LocalArrayGlobalID: "PSabcdef0123",
RemoteUUID: "9f840c56-96e6-4de9-b5a3-27e7c20eaa77",
RemoteArrayGlobalID: "PS0123abcdef",
Protocol: "scsi",
}, nil
This function is backwards compatible and will try to understand volume protocol even if there is no such information in volume id. It will do that by querying default powerstore array passed as one of the arguments
func (*VolumeHandle) IsMetro ¶ added in v2.16.0
func (v *VolumeHandle) IsMetro() bool
IsMetro determines if the volume handle belongs to a metro volume by checking if the RemoteUUID field is non-empty.