array

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package array provides structs and methods for configuring connection to PowerStore array.

Index

Constants

This section is empty.

Variables

View Source
var (
	IpToArray map[string]string
)

Functions

func ParseVolumeID

func ParseVolumeID(ctx context.Context, volumeID string, defaultArray *PowerStoreArray, cap *csi.VolumeCapability) (id string, arrayID string, protocol string, e error)

ParseVolumeID parses volume id in from CO (Kubernetes) and tries to understand what in it are PowerStore volume id, and what is ip, protocol. "/" is used as a delimiter.

Example:

ParseVolumeID("1cd254s/192.168.0.1/scsi") will return
	id = "1cd254s"
	ip = "192.168.0.1"
	protocol = "scsi"

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.FsInterface) 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

func (*Locker) DefaultArray

func (s *Locker) DefaultArray() *PowerStoreArray

func (*Locker) SetArrays

func (s *Locker) SetArrays(arrays map[string]*PowerStoreArray)

func (*Locker) SetDefaultArray

func (s *Locker) SetDefaultArray(array *PowerStoreArray)

func (*Locker) UpdateArrays

func (s *Locker) UpdateArrays(configPath string, fs fs.FsInterface) error

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"`

	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.FsInterface, 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 added in v1.4.0

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

Jump to

Keyboard shortcuts

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