Documentation
¶
Overview ¶
Package array provides structs and methods for configuring connection to PowerStore array.
Index ¶
- Variables
- func ParseVolumeID(ctx context.Context, volumeHandle string, defaultArray *PowerStoreArray, ...) (localVolumeID, arrayID, protocol, remoteVolumeID, remoteArrayID string, ...)
- type Consumer
- type Locker
- func (s *Locker) Arrays() map[string]*PowerStoreArray
- func (s *Locker) DefaultArray() *PowerStoreArray
- 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 PowerStoreArray
Constants ¶
This section is empty.
Variables ¶
var IPToArray map[string]string
IPToArray - Store Array IPs
Functions ¶
func ParseVolumeID ¶
func ParseVolumeID(ctx context.Context, volumeHandle string, defaultArray *PowerStoreArray, cap *csi.VolumeCapability, ) (localVolumeID, arrayID, protocol, remoteVolumeID, remoteArrayID string, e error)
ParseVolumeID parses a volume id from the CO (Kubernetes) and tries to extract the PowerStore volume id, Global ID, and protocol.
Example:
ParseVolumeID("1cd254s/192.168.0.1/scsi") assuming 192.168.0.1 is the IP array PSabc0123def will return
localVolumeID = "1cd254s"
arrayID = "PSabc0123def"
protocol = "scsi"
e = nil
Example:
ParseVolumeID("9f840c56-96e6-4de9-b5a3-27e7c20eaa77/PSabcdef0123/scsi:9f840c56-96e6-4de9-b5a3-27e7c20eaa77/PS0123abcdef") returns
localVolumeID = "9f840c56-96e6-4de9-b5a3-27e7c20eaa77"
arrayID = "PSabcdef0123"
protocol = "scsi"
remoteVolumeID = "9f840c56-96e6-4de9-b5a3-27e7c20eaa77"
remoteArrayID = "PS0123abcdef"
e = 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
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 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) 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 PowerStoreArray ¶
type PowerStoreArray struct {
Endpoint string `yaml:"endpoint"`
GlobalID string `yaml:"globalID"`
Username string `yaml:"username"`
Password string `yaml:"password"`
NasName string `yaml:"nasName"`
BlockProtocol common.TransportType `yaml:"blockProtocol"`
Insecure bool `yaml:"skipCertificateValidation"`
IsDefault bool `yaml:"isDefault"`
NfsAcls string `yaml:"nfsAcls"`
Client gopowerstore.Client
IP string
}
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) 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