mcapi

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiMaximumLUN   = 255
	ApiTierAffinity = "no-affinity"
	ApiSuccess      = 0
	ApiError        = 1
	ApiInfo         = 2
	ApiWarning      = 3
)

Variables

This section is empty.

Functions

func AddSystem

func AddSystem(url string, client *Client) error

AddSystem: Uses the client to query and store system data

func CreateCommonStatus

func CreateCommonStatus(logger logr.Logger, response *[]client.StatusResourceInner) *common.ResponseStatus

CreateCommonStatus : create a common API status object based on the OpenAPI client response

func GetPoolType

func GetPoolType(system *common.SystemInfo, pool string) (string, error)

GetPoolType: Return the pool type for a given pool

func GetPortals

func GetPortals(system *common.SystemInfo) (string, error)

GetPortals: Return a list of iSCSI portals for the storage system

func GetSystem

func GetSystem(url string) (*common.SystemInfo, error)

GetSystem: Return the System data object corresponding to the IP Address

func GetTargetId

func GetTargetId(system *common.SystemInfo, portType string) (string, error)

GetTargetId: Return the target id value for this storage system

func Log

func Log(system *common.SystemInfo) error

Log: Display the contents of all system information collected

func UpdateVolumeObject

func UpdateVolumeObject(target *common.VolumeObject, source *client.VolumesResourceInner)

UpdateVolumeObject: transfer results to the common Volume object

Types

type Client

type Client struct {
	Ctx        context.Context
	Username   string
	Password   string
	Addr       string
	Protocol   string
	HTTPClient http.Client
	Collector  *common.Collector
	SessionKey string
	Initiator  []string
	PoolName   string
	Info       *common.SystemInfo
	// contains filtered or unexported fields
}

Client : Can be used to request the API

func NewClient

func NewClient() *Client

NewClient : Creates an API client by setting up its HTTP transport

func (*Client) CheckVolumeExists

func (client *Client) CheckVolumeExists(volumeId string, size int64) (bool, error)

CheckVolumeExists: Return true if a volume already exists

func (*Client) CopyVolume

func (client *Client) CopyVolume(sourceName string, destinationName string, pool string) (*common.ResponseStatus, error)

CopyVolume : create an new volume by copying another one or a snapshot

func (*Client) CreateNickname

func (client *Client) CreateNickname(name, iqn string) (*common.ResponseStatus, error)

CreateNickname : Create a nickname for an initiator. The Storage API policy is to prohibit mapping of initiators which are not either (a) presently connected to the array or (b) represented by an entry in the initiator nickname table.

func (*Client) CreateSnapshot

func (client *Client) CreateSnapshot(volumeName string, snapshotName string) (*common.ResponseStatus, error)

CreateSnapshot : create a snapshot in a snap pool and the snap pool if it doesn't already exist

func (*Client) CreateVolume

func (client *Client) CreateVolume(name, size, pool string) (*common.VolumeObject, *common.ResponseStatus, error)

CreateVolume : creates a volume with the given name, capacity in the given pool

func (*Client) DeleteSnapshot

func (client *Client) DeleteSnapshot(name string) (*common.ResponseStatus, error)

DeleteSnapshot : delete a snapshot

func (*Client) DeleteVolume

func (client *Client) DeleteVolume(name string) (*common.ResponseStatus, error)

DeleteVolume : deletes a volume

func (*Client) ExpandVolume

func (client *Client) ExpandVolume(name, size string) (*common.ResponseStatus, error)

ExpandVolume : extend a volume if there is enough space in the disk group

func (*Client) GetPoolType added in v2.0.2

func (client *Client) GetPoolType(pool string) (string, error)

GetPoolType: Return the pool type of the storage system

func (*Client) GetPortals

func (client *Client) GetPortals() (string, error)

GetPortals: Return a list of portals for the storage system

func (*Client) GetVolumeMapsHostNames

func (client *Client) GetVolumeMapsHostNames(name string) ([]string, *common.ResponseStatus, error)

GetVolumeMapsHostNames: Use /show/maps to retrieve host names

func (*Client) GetVolumeWwn

func (client *Client) GetVolumeWwn(volumeName string) (string, error)

GetVolumeWwn: Retrieve the WWN for a volume, very useful for host operating system device mapping

func (*Client) InitSystemInfo

func (client *Client) InitSystemInfo() error

InitSystemInfo: Retrieve and store system information for this client

func (*Client) Login

func (client *Client) Login(ctx context.Context) error

Login: Called to log into the storage controller API

func (*Client) Logout added in v2.1.0

func (client *Client) Logout() error

Login: Called to log into the storage controller API

func (*Client) MapVolume

func (client *Client) MapVolume(name, initiator, access string, lun int) (*common.ResponseStatus, error)

MapVolume : map a volume to an initiator using a specified LUN

func (*Client) PublishVolume

func (client *Client) PublishVolume(volumeId string, initiators []string) (string, error)

PublishVolume: Attach a volume to an initiator

func (*Client) SessionValid deprecated

func (client *Client) SessionValid(addr, username string) bool

SessionValid : Determine if a session is valid, if not a login is required Makes the 'show controller-date' API call to validate the session is still valid

Deprecated: This function will be made redundant by retry logic in a future update

func (*Client) ShowHostMaps

func (client *Client) ShowHostMaps(host string) ([]Volume, *common.ResponseStatus, error)

ShowHostMaps: list the volume mappings for given host. If host is an empty string, mapping for all hosts is shown

func (*Client) ShowSnapshots

func (client *Client) ShowSnapshots(snapshotId string, sourceVolumeId string) ([]common.SnapshotObject, *common.ResponseStatus, error)

ShowSnapshots : Show one snaphot, or all snapshots, or all snapshots for a volume

func (*Client) ShowVolumes

func (client *Client) ShowVolumes(volume string) ([]common.VolumeObject, *common.ResponseStatus, error)

ShowVolumes : get information about volumes

func (*Client) StoreCredentials

func (client *Client) StoreCredentials(addr string, protocol string, username string, password string)

StoreCredentials : Called to store ip address, username, and password for the client

func (*Client) UnmapVolume

func (client *Client) UnmapVolume(name, initiator string) (*common.ResponseStatus, error)

UnmapVolume : unmap a volume from an initiator

type Volume

type Volume struct {
	LUN int
}

Volume : volume-view representation

type Volumes

type Volumes []Volume

func (Volumes) Len

func (v Volumes) Len() int

func (Volumes) Less

func (v Volumes) Less(i, j int) bool

func (Volumes) Swap

func (v Volumes) Swap(i, j int)

Jump to

Keyboard shortcuts

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