pmax

package module
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 16 Imported by: 2

README

GO powermax REST library

This directory contains a lighweight Go wrapper around the Unisphere REST API

Unit Tests

Unit Tests exist for the wrapper. These tests do not modify the array.

Running Unit Tests

To run these tests, from this directory, run:

make unit-test
Running Unit Tests With Debugging enabled

To run the tests and be able to attach debugger to the tests, run:

make unit-test-debug

Or this can be run in steps. Build the debug exec:

make unit-test-debug-build

Then to start with debugging:

make dlv-unit-test

The process will listen on port 55555 for a debugger to attach. Once the debugger is attached, the tests will start executing.

Integration Tests

Integration Tests exist for the wrapper as well. These tests WILL MODIFY the array.

Pre-requisites

Before running integration tests, do the following changes in user.env file in inttest folder:

  • Modify the Unisphere endpoint and Symmetrix ID.

  • In the file, are two variables defined:

    • username
    • password

    Either change those variables to match an existing user in Unisphere, or create a new user in Unisphere matching those credentials.

  • The integration test expects certain storage objects to be present on the PowerMax array you are using for integration tests. Examine the file and modify the following declared variables with appropriate names from the PowerMax array in use.

    • Set DefaultFCPortGroup to an existing FC port group from the array.
    • Set DefaultiSCSIPortGroup to an existing iSCSI port group from the array.
    • Set DefaultFCInitiator to an existing FC initiatorID from the array which is not part of any host. Suffix initiatorID with its Dir:Port.
    • Set FCInitiator1,FCInitiator2 to existing FC initiatorIDs from the array which is not part of any host.
    • Set DefaultiSCSIInitiator to an existing iSCSI initiatorID from the array which is not part of any host. Suffix initiatorID with its Dir:Port.
    • Set ISCSIInitiator1,ISCSIInitiator2 to existing iSCSI initiatorIDs from the array which is not part of any host.
Running Integration Tests

To run these tests, from the this directory, run:

For full tests:

make int-test

For an abbreviated set of tests:

make short-int-test

Documentation

Index

Constants

View Source
const (
	XRDFGroup = "/rdf_group"
	ASYNC     = "ASYNC"
	METRO     = "METRO"
	SYNC      = "SYNC"
)

The following constants are for internal use within the pmax library.

View Source
const (
	ReplicationX = "replication/"
	PrivateX     = "private/"
	//PrivURLPrefix = RESTPrefix + PrivateX + APIVersion + "/"
	XSnapshot    = "/snapshot"
	XGenereation = "/generation"
)

The following constants are for internal use within the pmax library.

View Source
const (
	// DefaultAPIVersion is the default API version you will get if not specified to NewClientWithArgs.
	// The other supported versions are listed here.
	DefaultAPIVersion = "90"
	// APIVersion90 is the API version corresponding to  90
	APIVersion90 = "90"
	// APIVersion91 is the API version corresponding to 91
	APIVersion91 = "91"
)
View Source
const (
	SLOProvisioningX       = "sloprovisioning/"
	SymmetrixX             = "symmetrix/"
	IteratorX              = "common/Iterator/"
	XPage                  = "/page"
	XVolume                = "/volume"
	XStorageGroup          = "/storagegroup"
	XPortGroup             = "/portgroup"
	XInitiator             = "/initiator"
	XHost                  = "/host"
	XMaskingView           = "/maskingview"
	Emulation              = "FBA"
	MaxVolIdentifierLength = 64
)

The follow constants are for internal use within the pmax library.

View Source
const (
	RESTPrefix          = "univmax/restapi/"
	StorageResourcePool = "srp"
)

The following constants are for internal use of the pmax library.

Variables

View Source
var (
	// MAXJobRetryCount is the maximum number of retries to wait on a job.
	// It is a variable so that unit testing can set it lower.
	MAXJobRetryCount = 30
	// JobRetrySleepDuration is the amount of time between retries.
	JobRetrySleepDuration = 3 * time.Second
)
View Source
var Debug = false

Debug is a boolean, when enabled, that enables logging of send payloads, and other debug information. Default to false. It is set true by unit testing.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the callers handle to the pmax client library. Obtain a client by calling NewClient.

func (*Client) AddVolumesToProtectedStorageGroup added in v1.4.0

func (c *Client) AddVolumesToProtectedStorageGroup(ctx context.Context, symID, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) error

AddVolumesToProtectedStorageGroup adds one or more volumes (given by their volumeIDs) to a Protected StorageGroup.

func (*Client) AddVolumesToStorageGroup

func (c *Client) AddVolumesToStorageGroup(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error

AddVolumesToStorageGroup adds one or more volumes (given by their volumeIDs) to a StorageGroup.

func (*Client) AddVolumesToStorageGroupS added in v1.2.0

func (c *Client) AddVolumesToStorageGroupS(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error

AddVolumesToStorageGroupS adds one or more volumes (given by their volumeIDs) to a StorageGroup.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, configConnect *ConfigConnect) error

Authenticate and get API version

func (*Client) CreateHost

func (c *Client) CreateHost(ctx context.Context, symID string, hostID string, initiatorIDs []string, hostFlags *types.HostFlags) (*types.Host, error)

CreateHost creates a host from a list of InitiatorIDs (and optional HostFlags) return returns a types.Host. Initiator IDs do not contain the storage port designations, just the IQN string or FC WWN. Initiator IDs cannot be a member of more than one host.

func (*Client) CreateMaskingView

func (c *Client) CreateMaskingView(ctx context.Context, symID string, maskingViewID string, storageGroupID string, hostOrhostGroupID string, isHost bool, portGroupID string) (*types.MaskingView, error)

CreateMaskingView creates a masking view and returns the masking view object

func (*Client) CreatePortGroup

func (c *Client) CreatePortGroup(ctx context.Context, symID string, portGroupID string, dirPorts []types.PortKey) (*types.PortGroup, error)

CreatePortGroup - Creates a Port Group

func (*Client) CreateRDFPair added in v1.4.0

func (c *Client) CreateRDFPair(ctx context.Context, symID, rdfGroupNo, deviceID, rdfMode, rdfType string, establish, exemptConsistency bool) (*types.RDFDevicePairList, error)

CreateRDFPair creates an RDF device pair in the given RDF group

func (*Client) CreateSGReplica added in v1.4.0

func (c *Client) CreateSGReplica(ctx context.Context, symID, remoteSymID, rdfMode, rdfGroupNo, sourceSG, remoteSGName, remoteServiceLevel string, bias bool) (*types.SGRDFInfo, error)

CreateSGReplica creates a storage group on remote array and protect them with given RDF Mode and a given source storage group

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(ctx context.Context, symID string, snapID string, sourceVolumeList []types.VolumeList, ttl int64) error

CreateSnapshot creates a snapVx snapshot of a volume or on the list of volumes passed as sourceVolumeList  BothSides flag is used in SRDF usecases to create snapshots on both R1 and R2 side  Star flag is used if the source device is participating in SRDF star mode  Use the Force flag to automate some scenarios to succeed  TimeToLive value ins hour is set on the snapshot to automatically delete the snapshot after target is unlinked

func (*Client) CreateStorageGroup

func (c *Client) CreateStorageGroup(ctx context.Context, symID, storageGroupID, srpID, serviceLevel string, thickVolumes bool) (*types.StorageGroup, error)

CreateStorageGroup creates a Storage Group given the storageGroupID (name), srpID (storage resource pool), service level, and boolean for thick volumes. If srpID is "None" then serviceLevel and thickVolumes settings are ignored

func (*Client) CreateVolumeInProtectedStorageGroupS added in v1.4.0

func (c *Client) CreateVolumeInProtectedStorageGroupS(ctx context.Context, symID, remoteSymID, storageGroupID string, remoteStorageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error)

CreateVolumeInProtectedStorageGroupS takes simplified input arguments to create a volume of a give name and size in a protected storage group. This will add volume in both Local and Remote Storage group This method is run synchronously

func (*Client) CreateVolumeInStorageGroup

func (c *Client) CreateVolumeInStorageGroup(
	ctx context.Context, symID string, storageGroupID string, volumeName string, sizeInCylinders int) (*types.Volume, error)

CreateVolumeInStorageGroup creates a volume in the specified Storage Group with a given volumeName and the size of the volume in cylinders.

func (*Client) CreateVolumeInStorageGroupS added in v1.2.0

func (c *Client) CreateVolumeInStorageGroupS(ctx context.Context, symID, storageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error)

CreateVolumeInStorageGroupS creates a volume in the specified Storage Group with a given volumeName and the size of the volume in cylinders. This method is run synchronously

func (*Client) DeleteHost

func (c *Client) DeleteHost(ctx context.Context, symID string, hostID string) error

DeleteHost deletes a host entry.

func (*Client) DeleteMaskingView

func (c *Client) DeleteMaskingView(ctx context.Context, symID string, maskingViewID string) error

DeleteMaskingView deletes a storage group

func (*Client) DeletePortGroup

func (c *Client) DeletePortGroup(ctx context.Context, symID string, portGroupID string) error

DeletePortGroup - Deletes a PG

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(ctx context.Context, symID, snapID string, sourceVolumes []types.VolumeList, generation int64) error

DeleteSnapshot deletes a snapshot from a volume DeviceNameListSource is a list which contains the names of source volumes Symforce flag is used to automate some internal establish scenarios  Star mode is used for devices in SRDF relations  Use the Force flag in acceptable error conditions Restore, when set to true will terminate the Restore and the Snapshot as well  Generation is used to tell which generation of snapshot needs to be deleted and is passed as int64 ExecutionOption tells the Unisphere to perform the operation either in Synchronous mode or Asynchronous mode

func (*Client) DeleteSnapshotS added in v1.2.0

func (c *Client) DeleteSnapshotS(ctx context.Context, symID, snapID string, sourceVolumes []types.VolumeList, generation int64) error

DeleteSnapshotS - Deletes a snapshot synchronously

func (*Client) DeleteStorageGroup

func (c *Client) DeleteStorageGroup(ctx context.Context, symID string, storageGroupID string) error

DeleteStorageGroup deletes a storage group

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(ctx context.Context, symID string, volumeID string) error

DeleteVolume deletes a volume given the symmetrix ID and volume ID. Any storage tracks for the volume must have been previously deallocated using InitiateDeallocationOfTracksFromVolume, and the volume must not be a member of any Storage Group.

func (*Client) DeleteVolumeIDsIterator

func (c *Client) DeleteVolumeIDsIterator(ctx context.Context, iter *types.VolumeIterator) error

DeleteVolumeIDsIterator deletes a volume iterator.

func (*Client) ExecuteReplicationActionOnSG added in v1.4.0

func (c *Client) ExecuteReplicationActionOnSG(ctx context.Context, symID, action, storageGroup, rdfGroup string, force, exemptConsistency, bias bool) error

ExecuteReplicationActionOnSG executes supported replication based actions on the protected SG

func (*Client) ExpandVolume

func (c *Client) ExpandVolume(ctx context.Context, symID string, volumeID string, rdfgNo int, newSizeCYL int) (*types.Volume, error)

ExpandVolume expands an existing volume to a new (larger) size in CYL

func (*Client) GetAddVolumeToSGPayload added in v1.1.0

func (c *Client) GetAddVolumeToSGPayload(isSync, force bool, remoteSymID, remoteStorageGroupID string, volumeIDs ...string) (payload interface{})

GetAddVolumeToSGPayload returns payload for adding specific volume/s to SG.

func (*Client) GetAllowedArrays

func (c *Client) GetAllowedArrays() []string

GetAllowedArrays returns a slice of arrays that can be manipulated

func (*Client) GetCreateRDFPairPayload added in v1.4.0

func (c *Client) GetCreateRDFPairPayload(devList types.LocalDeviceListCriteria, rdfMode, rdfType string, establish, exemptConsistency bool) *types.CreateRDFPair

GetCreateRDFPairPayload returns payload for adding a replication pair based on replication mode

func (*Client) GetCreateSGReplicaPayload added in v1.4.0

func (c *Client) GetCreateSGReplicaPayload(remoteSymID string, rdfMode string, rdfgNo int, remoteSGName string, remoteServiceLevel string, establish, bias bool) *types.CreateSGSRDF

GetCreateSGReplicaPayload returns a payload to create a storage group on remote array from local array and protect it with rdfgNo

func (*Client) GetCreateStorageGroupPayload added in v1.1.0

func (c *Client) GetCreateStorageGroupPayload(storageGroupID, srpID, serviceLevel string, thickVolumes bool) (payload interface{})

GetCreateStorageGroupPayload returns U4P payload for creating storage group

func (*Client) GetCreateVolInSGPayload added in v1.1.0

func (c *Client) GetCreateVolInSGPayload(sizeInCylinders int, volumeName string, isSync bool, remoteSymID, remoteStorageGroupID string, opts ...http.Header) (payload interface{})

GetCreateVolInSGPayload returns payload for adding volume/s to SG. if remoteSymID is passed then the payload includes RemoteSymmSGInfoParam.

func (*Client) GetDirectorIDList

func (c *Client) GetDirectorIDList(ctx context.Context, symID string) (*types.DirectorIDList, error)

GetDirectorIDList returns a list of all the directors on a given array.

func (*Client) GetHTTPClient added in v1.6.0

func (c *Client) GetHTTPClient() *http.Client

GetHTTPClient will return an underlying http client

func (*Client) GetHostByID

func (c *Client) GetHostByID(ctx context.Context, symID string, hostID string) (*types.Host, error)

GetHostByID returns a Host given the Symmetrix ID and Host ID.

func (*Client) GetHostList

func (c *Client) GetHostList(ctx context.Context, symID string) (*types.HostList, error)

GetHostList returns an HostList object, which contains a list of all the Hosts.

func (*Client) GetISCSITargets added in v1.1.0

func (c *Client) GetISCSITargets(ctx context.Context, symID string) ([]ISCSITarget, error)

GetISCSITargets returns list of target addresses

func (*Client) GetInitiatorByID

func (c *Client) GetInitiatorByID(ctx context.Context, symID string, initID string) (*types.Initiator, error)

GetInitiatorByID returns an Initiator given the Symmetrix ID and Initiator ID.

func (*Client) GetInitiatorList

func (c *Client) GetInitiatorList(ctx context.Context, symID string, initiatorHBA string, isISCSI bool, inHost bool) (*types.InitiatorList, error)

GetInitiatorList returns an InitiatorList object, which contains a list of all the Initiators. initiatorHBA, isISCSI, inHost are optional arguments which act as filters for the initiator list

func (*Client) GetJobByID

func (c *Client) GetJobByID(ctx context.Context, symID string, jobID string) (*types.Job, error)

GetJobByID returns a job given the job ID.

func (*Client) GetJobIDList

func (c *Client) GetJobIDList(ctx context.Context, symID string, statusQuery string) ([]string, error)

GetJobIDList returns a list of all the jobs in the symmetrix system. If optional statusQuery is something like JobStatusRunning it will search for running jobs.

func (*Client) GetListOfTargetAddresses

func (c *Client) GetListOfTargetAddresses(ctx context.Context, symID string) ([]string, error)

GetListOfTargetAddresses returns list of target addresses

func (*Client) GetMaskingViewByID

func (c *Client) GetMaskingViewByID(ctx context.Context, symID string, maskingViewID string) (*types.MaskingView, error)

GetMaskingViewByID returns a masking view given it's identifier (which is the name)

func (*Client) GetMaskingViewConnections

func (c *Client) GetMaskingViewConnections(ctx context.Context, symID string, maskingViewID string, volumeID string) ([]*types.MaskingViewConnection, error)

GetMaskingViewConnections returns the connections of a masking view (optionally for a specific volume id.) Here volume id is the 5 digit volume ID.

func (*Client) GetMaskingViewList

func (c *Client) GetMaskingViewList(ctx context.Context, symID string) (*types.MaskingViewList, error)

GetMaskingViewList returns a list of the MaskingView names.

func (*Client) GetPort

func (c *Client) GetPort(ctx context.Context, symID string, directorID string, portID string) (*types.Port, error)

GetPort returns port details.

func (*Client) GetPortGroupByID

func (c *Client) GetPortGroupByID(ctx context.Context, symID string, portGroupID string) (*types.PortGroup, error)

GetPortGroupByID returns a PortGroup given the Symmetrix ID and Port Group ID.

func (*Client) GetPortGroupList

func (c *Client) GetPortGroupList(ctx context.Context, symID string, portGroupType string) (*types.PortGroupList, error)

GetPortGroupList returns a PortGroupList object, which contains a list of the Port Groups which can be optionally filtered based on type

func (*Client) GetPortList

func (c *Client) GetPortList(ctx context.Context, symID string, directorID string, query string) (*types.PortList, error)

GetPortList returns a list of all the ports on a specified director/array.

func (*Client) GetPrivVolumeByID

func (c *Client) GetPrivVolumeByID(ctx context.Context, symID string, volumeID string) (*types.VolumeResultPrivate, error)

GetPrivVolumeByID returns a Volume structure given the symmetrix and volume ID

func (*Client) GetProtectedStorageGroup added in v1.4.0

func (c *Client) GetProtectedStorageGroup(ctx context.Context, symID, storageGroup string) (*types.RDFStorageGroup, error)

GetProtectedStorageGroup returns protected storage group given the storage group ID

func (*Client) GetRDFDevicePairInfo added in v1.4.0

func (c *Client) GetRDFDevicePairInfo(ctx context.Context, symID, rdfGroup, volumeID string) (*types.RDFDevicePair, error)

GetRDFDevicePairInfo returns RDF volume information

func (*Client) GetRDFGroup added in v1.4.0

func (c *Client) GetRDFGroup(ctx context.Context, symID, rdfGroupNo string) (*types.RDFGroup, error)

GetRDFGroup returns RDF group information given the RDF group number

func (*Client) GetRemoveVolumeFromSGPayload added in v1.1.0

func (c *Client) GetRemoveVolumeFromSGPayload(force bool, remoteSymID, remoteStorageGroupID string, volumeIDs ...string) (payload interface{})

GetRemoveVolumeFromSGPayload returns payload for removing volume/s from SG.

func (*Client) GetReplicationCapabilities

func (c *Client) GetReplicationCapabilities(ctx context.Context) (*types.SymReplicationCapabilities, error)

GetReplicationCapabilities returns details about SnapVX and SRDF execution capabilities on the Symmetrix array

func (*Client) GetSnapVolumeList

func (c *Client) GetSnapVolumeList(ctx context.Context, symID string, queryParams types.QueryParams) (*types.SymVolumeList, error)

GetSnapVolumeList returns a list of all snapshot volumes on the array.

func (*Client) GetSnapshotGenerationInfo

func (c *Client) GetSnapshotGenerationInfo(ctx context.Context, symID, volumeID, snapID string, generation int64) (*types.VolumeSnapshotGeneration, error)

GetSnapshotGenerationInfo returns the specific generation info related to a snapshot

func (*Client) GetSnapshotGenerations

func (c *Client) GetSnapshotGenerations(ctx context.Context, symID, volumeID, snapID string) (*types.VolumeSnapshotGenerations, error)

GetSnapshotGenerations returns a list of all the snapshot generation on a specific snapshot

func (*Client) GetSnapshotInfo

func (c *Client) GetSnapshotInfo(ctx context.Context, symID, volumeID, snapID string) (*types.VolumeSnapshot, error)

GetSnapshotInfo returns snapVx information of the specified snapshot

func (*Client) GetStorageGroup

func (c *Client) GetStorageGroup(ctx context.Context, symID string, storageGroupID string) (*types.StorageGroup, error)

GetStorageGroup returns a StorageGroup given the Symmetrix ID and Storage Group ID (which is really a name).

func (*Client) GetStorageGroupIDList

func (c *Client) GetStorageGroupIDList(ctx context.Context, symID string) (*types.StorageGroupIDList, error)

GetStorageGroupIDList returns a list of StorageGroupIds in a StorageGroupIDList type.

func (*Client) GetStorageGroupRDFInfo added in v1.4.0

func (c *Client) GetStorageGroupRDFInfo(ctx context.Context, symID, sgName, rdfGroupNo string) (*types.StorageGroupRDFG, error)

GetStorageGroupRDFInfo returns the of RDF info of protected storage group

func (*Client) GetStoragePool

func (c *Client) GetStoragePool(ctx context.Context, symID string, storagePoolID string) (*types.StoragePool, error)

GetStoragePool returns a StoragePool given the Symmetrix ID and Storage Pool ID

func (*Client) GetStoragePoolList

func (c *Client) GetStoragePoolList(ctx context.Context, symid string) (*types.StoragePoolList, error)

GetStoragePoolList returns a StoragePoolList object, which contains a list of all the Storage Pool names.

func (*Client) GetSymmetrixByID

func (c *Client) GetSymmetrixByID(ctx context.Context, id string) (*types.Symmetrix, error)

GetSymmetrixByID returns the Symmetrix summary structure given a symmetrix id.

func (*Client) GetSymmetrixIDList

func (c *Client) GetSymmetrixIDList(ctx context.Context) (*types.SymmetrixIDList, error)

GetSymmetrixIDList returns a list of all the symmetrix systems known to the connected Unisphere instance.

func (*Client) GetTimeoutContext added in v1.6.0

func (c *Client) GetTimeoutContext(ctx context.Context) (context.Context, context.CancelFunc)

GetTimeoutContext sets up a timeout of time PmaxTimeout for the returned context. The user caller should call the cancel function that is returned.

func (*Client) GetVolumeByID

func (c *Client) GetVolumeByID(ctx context.Context, symID string, volumeID string) (*types.Volume, error)

GetVolumeByID returns a Volume structure given the symmetrix and volume ID (volume ID is 5-digit hex field)

func (*Client) GetVolumeByIdentifier added in v1.4.0

func (c *Client) GetVolumeByIdentifier(ctx context.Context, symID, storageGroupID string, volumeName string, sizeInCylinders int) (*types.Volume, error)

GetVolumeByIdentifier on the given symmetrix in specific storage group with a volume name and having size in cylinders

func (*Client) GetVolumeIDList

func (c *Client) GetVolumeIDList(ctx context.Context, symID string, volumeIdentifierMatch string, like bool) ([]string, error)

GetVolumeIDList gets a list of matching volume ids. If volumeIdentifierMatch is the empty string, all volumes are returned. Otherwise the volumes are filtered to volumes whose VolumeIdentifier exactly matches the volumeIdentfierMatch argument (when like is false), or whose VolumeIdentifier contains the volumeIdentifierMatch argument (when like is true).

func (*Client) GetVolumeIDListInStorageGroup

func (c *Client) GetVolumeIDListInStorageGroup(ctx context.Context, symID string, storageGroupID string) ([]string, error)

GetVolumeIDListInStorageGroup - Gets a list of volume in a SG

func (*Client) GetVolumeIDsIterator

func (c *Client) GetVolumeIDsIterator(ctx context.Context, symID string, volumeIdentifierMatch string, like bool) (*types.VolumeIterator, error)

GetVolumeIDsIterator returns a VolumeIDs Iterator. It generally fetches the first page in the result as part of the operation.

func (*Client) GetVolumeIDsIteratorPage

func (c *Client) GetVolumeIDsIteratorPage(ctx context.Context, iter *types.VolumeIterator, from, to int) ([]string, error)

GetVolumeIDsIteratorPage fetches the next page of the iterator's result. From is the starting point. To can be left as 0, or can be set to the last element desired.

func (*Client) GetVolumeSnapInfo

func (c *Client) GetVolumeSnapInfo(ctx context.Context, symID string, volumeID string) (*types.SnapshotVolumeGeneration, error)

GetVolumeSnapInfo returns snapVx information associated with a volume.

func (*Client) GetVolumesInStorageGroupIterator

func (c *Client) GetVolumesInStorageGroupIterator(ctx context.Context, symID string, storageGroupID string) (*types.VolumeIterator, error)

GetVolumesInStorageGroupIterator returns a iterator of a list of volumes associated with a StorageGroup.

func (*Client) InitiateDeallocationOfTracksFromVolume

func (c *Client) InitiateDeallocationOfTracksFromVolume(ctx context.Context, symID string, volumeID string) (*types.Job, error)

InitiateDeallocationOfTracksFromVolume is an asynchrnous operation (that returns a job) to remove tracks from a volume.

func (*Client) IsAllowedArray

func (c *Client) IsAllowedArray(array string) (bool, error)

IsAllowedArray checks to see if we can manipulate the specified array

func (*Client) JobToString

func (c *Client) JobToString(job *types.Job) string

JobToString takes a Job and returns a string giving the job id, status, time completed, and result for easy display.

func (*Client) ModifySnapshot

func (c *Client) ModifySnapshot(ctx context.Context, symID string, sourceVol []types.VolumeList,
	targetVol []types.VolumeList, snapID string, action string,
	newSnapID string, generation int64) error

ModifySnapshot executes actions on a snapshot VolumeNameListSource is a list which contains the names of source volumes VolumeNameListTarget is a list which contains the names of target volumes to which the snapshot is linked or going to be linked Symforce flag is used to automate some internal establish scenarios  Star mode is used for devices in SRDF relations  Use the Force flag in acceptable error conditions Restore, when set to true will terminate the Restore and the Snapshot as well Exact when specified, pairs source and link devices in their ordinal positions within the selection. When not set uses the source and link device selections as a pool that pairs by best match Copy when specified creates an exact copy of the source device, otherwise copies the references Remote when specified propagates the data to the remote mirror of the RDF device  Generation is used to tell which generation of snapshot needs to be updated, it is passed as int64 NewSnapshotName specifies the new snapshot name to which the old snapshot will be renamed ExecutionOption tells the Unisphere to perform the operation either in Synchronous mode or Asynchronous mode Action defined the operation which will be performed on the given snapshot

func (*Client) ModifySnapshotS added in v1.2.0

func (c *Client) ModifySnapshotS(ctx context.Context, symID string, sourceVol []types.VolumeList,
	targetVol []types.VolumeList, snapID string, action string,
	newSnapID string, generation int64) error

ModifySnapshotS executes actions on snapshots synchronously

func (*Client) RemoveVolumesFromProtectedStorageGroup added in v1.4.0

func (c *Client) RemoveVolumesFromProtectedStorageGroup(ctx context.Context, symID string, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error)

RemoveVolumesFromProtectedStorageGroup removes one or more volumes (given by their volumeIDs) from a Protected StorageGroup.

func (*Client) RemoveVolumesFromStorageGroup

func (c *Client) RemoveVolumesFromStorageGroup(ctx context.Context, symID string, storageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error)

RemoveVolumesFromStorageGroup removes one or more volumes (given by their volumeIDs) from a StorageGroup.

func (*Client) RenameVolume

func (c *Client) RenameVolume(ctx context.Context, symID string, volumeID string, newName string) (*types.Volume, error)

RenameVolume renames a volume.

func (*Client) SetAllowedArrays

func (c *Client) SetAllowedArrays(arrays []string) error

SetAllowedArrays sets the list of arrays which can be manipulated an empty list will allow all arrays to be accessed

func (*Client) SetContextTimeout added in v1.6.0

func (c *Client) SetContextTimeout(timeout time.Duration) Pmax

SetContextTimeout sets the context timeout value for the API requests

func (*Client) TimeSpent

func (c *Client) TimeSpent(functionName string, startTime time.Time)

TimeSpent - Calculates and prints time spent for a caller function

func (*Client) UpdateHostInitiators

func (c *Client) UpdateHostInitiators(ctx context.Context, symID string, host *types.Host, initiatorIDs []string) (*types.Host, error)

UpdateHostInitiators updates a host from a list of InitiatorIDs and returns a types.Host.

func (*Client) UpdateHostName added in v1.2.0

func (c *Client) UpdateHostName(ctx context.Context, symID, oldHostID, newHostID string) (*types.Host, error)

UpdateHostName updates a host with new hostID and returns a types.Host.

func (*Client) UpdatePortGroup

func (c *Client) UpdatePortGroup(ctx context.Context, symID string, portGroupID string, ports []types.PortKey) (*types.PortGroup, error)

UpdatePortGroup - Update the PortGroup based on the 'ports' slice. The slice represents the intended configuration of the PortGroup after _successful_ completion of the request. NB: based on the passed in 'ports' the implementation will determine how to update the PortGroup and make appropriate REST calls sequentially. Take this into consideration when making parallel calls.

func (*Client) UpdateStorageGroup

func (c *Client) UpdateStorageGroup(ctx context.Context, symID string, storageGroupID string, payload interface{}) (*types.Job, error)

UpdateStorageGroup is a general method to update a StorageGroup (PUT operation) using a UpdateStorageGroupPayload.

func (*Client) UpdateStorageGroupS added in v1.2.0

func (c *Client) UpdateStorageGroupS(ctx context.Context, symID string, storageGroupID string, payload interface{}) error

UpdateStorageGroupS is a general method to update a StorageGroup (PUT operation) using a UpdateStorageGroupPayload.

func (*Client) WaitOnJobCompletion

func (c *Client) WaitOnJobCompletion(ctx context.Context, symID string, jobID string) (*types.Job, error)

WaitOnJobCompletion waits until a Job reaches a terminal state. The state may be JobStatusSucceeded or JobStatusFailed (it is the caller's responsibility to check.)

func (*Client) WithSymmetrixID added in v1.5.0

func (c *Client) WithSymmetrixID(symmetrixID string) Pmax

WithSymmetrixID sets the default array for the client

type ConfigConnect

type ConfigConnect struct {
	Endpoint string
	Version  string
	Username string
	Password string
}

ConfigConnect is an argument structure that can be passed to Authenticate. It contains the Endpoint, API Version (which should not be used), Username, and Password.

type ISCSITarget added in v1.1.0

type ISCSITarget struct {
	IQN       string
	PortalIPs []string
}

ISCSITarget is a structure representing a target IQN and associated IP addresses

type Pmax

type Pmax interface {
	GetHTTPClient() *http.Client

	// Authenticate causes authentication and tests the connection
	Authenticate(ctx context.Context, configConnect *ConfigConnect) error

	// WithSymmetrixID set a default symmetrix ID for the admin client,
	// for it to be added to the request header.
	WithSymmetrixID(symmetrixID string) Pmax

	// GetVolumeIDsIterator generates a VolumeIterator containing the ids of either all or a selected set volumes.
	// The volumeIdentifierMatch string can be used to find a specific volume, or if the like bool is set, all the
	// volumes containing match as part of their VolumeIdentifier.
	GetVolumeIDsIterator(ctx context.Context, symID string, volumeIdentifierMatch string, like bool) (*types.VolumeIterator, error)

	// GetVolumesInStorageGroupIterator returns a list of volumes for a given StorageGroup
	GetVolumesInStorageGroupIterator(ctx context.Context, symID string, storageGroupID string) (*types.VolumeIterator, error)

	// GetVolumeIDsIteraotrPage gets a page of volume ids from a Volume iterator.
	GetVolumeIDsIteratorPage(ctx context.Context, iter *types.VolumeIterator, from, to int) ([]string, error)

	// DeleteVolumeIDsIterator deletes a Volume iterator.
	DeleteVolumeIDsIterator(ctx context.Context, iter *types.VolumeIterator) error

	// GetVolumeIDList provides a simpler interface that returns a []string of volume ids
	// of volumes matching the volumeIdentifierMatch (and like) criteria. It is
	// implemented in terms of GetVolumeIDsIterator, GetVolumeIDsIteratorPage, and DeleteVolumeIDsIterator
	// and handles all the details of the iteration for you.
	GetVolumeIDList(ctx context.Context, symID string, volumeIdentifierMatch string, like bool) ([]string, error)

	// GetVolumeIDListInStorageGroup returns a list of volume IDs that are associated with the StorageGroup
	GetVolumeIDListInStorageGroup(ctx context.Context, symID string, storageGroupID string) ([]string, error)

	// GetVolumeById returns a Volume given the volumeID.
	GetVolumeByID(ctx context.Context, symID string, volumeID string) (*types.Volume, error)

	// GetStorageGroupIDList returns a list of all the StorageGroup ids.
	GetStorageGroupIDList(ctx context.Context, symID string) (*types.StorageGroupIDList, error)

	// GetStorageGroup returns a storage group given the StorageGroup id.
	GetStorageGroup(ctx context.Context, symID string, storageGroupID string) (*types.StorageGroup, error)

	// GetStoragePool returns a storage pool given the GetStoragePoolID and SymID.
	GetStoragePool(ctx context.Context, symID string, storagePoolID string) (*types.StoragePool, error)

	// CreateStorageGroup creates a storage group given the Storage group id
	// and returns the storage group object. The storage group can be configured for thick volumes as an option.
	// This is a blocking call and will only return after the storage group has been created
	CreateStorageGroup(ctx context.Context, symID string, storageGroupID string, srpID string, serviceLevel string, thickVolumes bool) (*types.StorageGroup, error)

	// UpdateStorageGroup updates a storage group (i.e. a PUT operation) and should support all the defined
	// operations (but many have not been tested).
	// This is done asynchronously and returns back a job
	UpdateStorageGroup(ctx context.Context, symID string, storageGroupID string, payload interface{}) (*types.Job, error)

	// UpdateStorageGroupS updates a storage group (i.e. a PUT operation) and should support all the defined
	// operations (but many have not been tested).
	// This is done synchronously and doesn't create any jobs
	UpdateStorageGroupS(ctx context.Context, symID string, storageGroupID string, payload interface{}) error

	// CreateVolumeInStorageGroup takes simplified input arguments to create a volume of a give name and size in a particular storage group.
	// This method creates a job and waits on the job to complete.
	CreateVolumeInStorageGroup(ctx context.Context, symID string, storageGroupID string, volumeName string, sizeInCylinders int) (*types.Volume, error)

	//CreateVolumeInStorageGroupS takes simplified input arguments to create a volume of a give name and size in a particular storage group.
	//This is done synchronously and no jobs are created. HTTP header argument is optional
	CreateVolumeInStorageGroupS(ctx context.Context, symID, storageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error)

	// CreateVolumeInProtectedStorageGroupS takes simplified input arguments to create a volume of a give name and size in a protected storage group.
	// This will add volume in both Local and Remote Storage group
	// This is done synchronously and no jobs are created. HTTP header argument is optional
	CreateVolumeInProtectedStorageGroupS(ctx context.Context, symID, remoteSymID, storageGroupID string, remoteStorageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error)

	// DeleteStorageGroup deletes a storage group given a storage group id
	DeleteStorageGroup(ctx context.Context, symID string, storageGroupID string) error

	// DeleteMaskingView deletes a masking view given a masking view id
	DeleteMaskingView(ctx context.Context, symID string, maskingViewID string) error

	//GetStoragePoolList Gets the list of Storage Pools
	GetStoragePoolList(ctx context.Context, symID string) (*types.StoragePoolList, error)

	//RenameVolume Renames a Volume given the volumeID
	RenameVolume(ctx context.Context, symID string, volumeID string, newName string) (*types.Volume, error)

	//AddVolumesToStorageGroup Adds volume(s) asynchronously to a StorageGroup
	AddVolumesToStorageGroup(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error

	//AddVolumesToStorageGroupS Adds volume(s) synchronously to a StorageGroup
	// This is a blocking call and will only return once the volumes have been added to storage group
	AddVolumesToStorageGroupS(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error

	//AddVolumesToProtectedStorageGroup Adds one or more volumes (given by their volumeIDs) to a Protected StorageGroup
	AddVolumesToProtectedStorageGroup(ctx context.Context, symID, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) error

	//RemoveVolumesFromStorageGroup Remove volume(s) synchronously from a StorageGroup
	RemoveVolumesFromStorageGroup(ctx context.Context, symID string, storageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error)

	// RemoveVolumesFromProtectedStorageGroup removes one or more volumes (given by their volumeIDs) from a Protected StorageGroup.
	RemoveVolumesFromProtectedStorageGroup(ctx context.Context, symID string, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error)

	//InitiateDeallocationOfTracksFromVolume Initiate a job to remove storage space from the volume.
	InitiateDeallocationOfTracksFromVolume(ctx context.Context, symID string, volumeID string) (*types.Job, error)

	//DeleteVolume Deletes a volume
	DeleteVolume(ctx context.Context, symID string, volumeID string) error

	// GetMaskingViewList  returns a list of the MaskingView names.
	GetMaskingViewList(ctx context.Context, symID string) (*types.MaskingViewList, error)

	// GetMaskingViewByID returns a masking view given it's identifier (which is the name)
	GetMaskingViewByID(ctx context.Context, symID string, maskingViewID string) (*types.MaskingView, error)

	// GetMaskingViewConnections returns the connections of a masking view (optionally for a specific volume id.)
	// Here volume id is the 5 digit volume ID.
	GetMaskingViewConnections(ctx context.Context, symID string, maskingViewID string, volumeID string) ([]*types.MaskingViewConnection, error)

	// CreateMaskingView creates a masking view given the Masking view id, Storage group id,
	// host id and the port id and returns the masking view object
	CreateMaskingView(ctx context.Context, symID string, maskingViewID string, storageGroupID string, hostOrhostGroupID string, isHost bool, portGroupID string) (*types.MaskingView, error)

	// CreatePortGroup creates a port group given the Port Group id and a list of dir/port ids
	CreatePortGroup(ctx context.Context, symID string, portGroupID string, dirPorts []types.PortKey) (*types.PortGroup, error)

	//GetSymmetrixIDList gets all the symmetrix systems
	GetSymmetrixIDList(ctx context.Context) (*types.SymmetrixIDList, error)
	GetSymmetrixByID(ctx context.Context, id string) (*types.Symmetrix, error)

	// GetJobIDList retrieves the list of jobs on a given Symmetrix.
	// If optional parameter statusQuery is a types.JobStatusRunning or similar string, will search for jobs
	// with a particular status.
	GetJobIDList(ctx context.Context, symID string, statusQuery string) ([]string, error)
	GetJobByID(ctx context.Context, symID string, jobID string) (*types.Job, error)
	WaitOnJobCompletion(ctx context.Context, symID string, jobID string) (*types.Job, error)
	JobToString(job *types.Job) string

	// GetPortGroupList returns a list of all the Port Group ids.
	GetPortGroupList(ctx context.Context, symID string, portGroupType string) (*types.PortGroupList, error)
	// GetPortGroupByID returns a port group given the PortGroup id.
	GetPortGroupByID(ctx context.Context, symID string, portGroupID string) (*types.PortGroup, error)

	// GetInitiatorList returns a list of all the Initiator ids based on filters supplied
	GetInitiatorList(ctx context.Context, symID string, initiatorHBA string, isISCSI bool, inHost bool) (*types.InitiatorList, error)
	// GetInitiatorByID returns an Initiator given the Initiator id.
	GetInitiatorByID(ctx context.Context, symID string, initID string) (*types.Initiator, error)

	// GetHostList returns a list of all the Host ids.
	GetHostList(ctx context.Context, symID string) (*types.HostList, error)
	// GetHostByID returns a Host given the Host id.
	GetHostByID(ctx context.Context, symID string, hostID string) (*types.Host, error)
	// CreateHost creates a host from a list of InitiatorIDs (and optional HostFlags) return returns a types.Host.
	// Initiator IDs do not contain the storage port designations, just the IQN string or FC WWN.
	// Initiator IDs cannot be a member of more than one host.
	CreateHost(ctx context.Context, symID string, hostID string, initiatorIDs []string, hostFlags *types.HostFlags) (*types.Host, error)
	// DeleteHost deletes a host given the hostID.
	DeleteHost(ctx context.Context, symID string, hostID string) error
	// UpdateHostInitiators will update the inititators
	UpdateHostInitiators(ctx context.Context, symID string, host *types.Host, initiatorIDs []string) (*types.Host, error)
	UpdateHostName(ctx context.Context, symID, oldHostID, newHostID string) (*types.Host, error)
	// GetDirectorIDList returns a list of directors
	GetDirectorIDList(ctx context.Context, symID string) (*types.DirectorIDList, error)
	// GetPortList returns a list of all the ports on a specified director/array.
	GetPortList(ctx context.Context, symID string, directorID string, query string) (*types.PortList, error)
	// GetPort returns port details.
	GetPort(ctx context.Context, symID string, directorID string, portID string) (*types.Port, error)
	// GetListOfTargetAddresses returns an array of all IP addresses which expose iscsi targets.
	GetListOfTargetAddresses(ctx context.Context, symID string) ([]string, error)
	// GetISCSITargets returns a list of ISCSI Targets for a given sym id
	GetISCSITargets(ctx context.Context, symID string) ([]ISCSITarget, error)

	// SetAllowedArrays sets the list of arrays which can be manipulated
	// an empty list will allow all arrays to be accessed
	SetAllowedArrays(arrays []string) error
	// GetAllowedArrays returns a slice of arrays that can be manipulated
	GetAllowedArrays() []string
	// IsAllowedArray checks to see if we can manipulate the specified array
	IsAllowedArray(array string) (bool, error)

	// GetSnapVolumeList returns a list of all snapshot volumes on the array.
	GetSnapVolumeList(ctx context.Context, symID string, queryParams types.QueryParams) (*types.SymVolumeList, error)
	// GetVolumeSnapInfo returns snapVx information associated with a volume.
	GetVolumeSnapInfo(ctx context.Context, symID string, volume string) (*types.SnapshotVolumeGeneration, error)
	// GetSnapshotInfo returns snapVx information of the specified volume
	GetSnapshotInfo(ctx context.Context, symID, volume, SnapID string) (*types.VolumeSnapshot, error)
	// CreateSnapshot creates a snapVx snapshot of a volume using the input parameters
	CreateSnapshot(ctx context.Context, symID string, SnapID string, sourceVolumeList []types.VolumeList, ttl int64) error

	//ModifySnapshot executes actions on a snapshot asynchronously
	// This creates a job and waits on its completion
	ModifySnapshot(ctx context.Context, symID string, sourceVol []types.VolumeList,
		targetVol []types.VolumeList, SnapID string, action string,
		newSnapID string, generation int64) error

	// ModifySnapshotS executes actions on a snapshot synchronously
	ModifySnapshotS(ctx context.Context, symID string, sourceVol []types.VolumeList,
		targetVol []types.VolumeList, SnapID string, action string,
		newSnapID string, generation int64) error
	// DeleteSnapshot deletes a snapshot from a volume
	// This is an asynchronous call and waits for the job to complete
	DeleteSnapshot(ctx context.Context, symID, SnapID string, sourceVolumes []types.VolumeList, generation int64) error

	// DeleteSnapshotS deletes a snapshot from a volume
	// This is a synchronous call and doesn't create a job
	DeleteSnapshotS(ctx context.Context, symID, SnapID string, sourceVolumes []types.VolumeList, generation int64) error

	// GetSnapshotGenerations returns a list of all the snapshot generation on a specific snapshot
	GetSnapshotGenerations(ctx context.Context, symID, volume, SnapID string) (*types.VolumeSnapshotGenerations, error)
	// GetSnapshotGenerationInfo returns the specific generation info related to a snapshot
	GetSnapshotGenerationInfo(ctx context.Context, symID, volume, SnapID string, generation int64) (*types.VolumeSnapshotGeneration, error)
	// GetReplicationCapabilities returns details about SnapVX and SRDF execution capabilities on the Symmetrix array
	GetReplicationCapabilities(ctx context.Context) (*types.SymReplicationCapabilities, error)
	// GetPrivVolumeByID returns a Volume structure given the symmetrix and volume ID (volume ID is in WWN format)
	GetPrivVolumeByID(ctx context.Context, symID string, volumeID string) (*types.VolumeResultPrivate, error)

	//DeletePortGroup Deletes a PortGroup
	DeletePortGroup(ctx context.Context, symID string, portGroupID string) error
	//UpdatePortGroup Updates a PortGroup
	UpdatePortGroup(ctx context.Context, symID string, portGroupID string, ports []types.PortKey) (*types.PortGroup, error)

	//ExpandVolume Expands the size of an existing volume
	ExpandVolume(ctx context.Context, symID string, volumeID string, rdfgNo int, newSizeCYL int) (*types.Volume, error)
	GetCreateVolInSGPayload(sizeInCylinders int, volumeName string, isSync bool, remoteSymID, storageGroupID string, opts ...http.Header) (payload interface{})

	//GetRDFGroup Fetches RDF group information
	GetRDFGroup(ctx context.Context, symID, rdfGroup string) (*types.RDFGroup, error)
	// GetProtectedStorageGroup returns protected storage group given the storage group ID
	GetProtectedStorageGroup(ctx context.Context, symID, storageGroup string) (*types.RDFStorageGroup, error)
	// CreateSGReplica creates a storage group on remote array and protect them with given RDF Mode and a given source storage group
	CreateSGReplica(ctx context.Context, symID, remoteSymID, rdfMode, rdfGroupNo, sourceSG, remoteSGName, remoteServiceLevel string, bias bool) (*types.SGRDFInfo, error)
	// ExecuteReplicationActionOnSG executes supported replication based actions on the protected SG
	ExecuteReplicationActionOnSG(ctx context.Context, symID, action, storageGroup, rdfGroup string, force, exemptConsistency, bias bool) error
	//CreateRDFPair Creates a volume replication pair
	CreateRDFPair(ctx context.Context, symID, rdfGroupNo, deviceID, rdfMode, rdfType string, establish, exemptConsistency bool) (*types.RDFDevicePairList, error)
	//GetRDFDevicePairInfo returns RDF volume information
	GetRDFDevicePairInfo(ctx context.Context, symID, rdfGroup, volumeID string) (*types.RDFDevicePair, error)
	//GetStorageGroupRDFInfo returns the of RDF info of protected storage group
	GetStorageGroupRDFInfo(ctx context.Context, symID, sgName, rdfGroupNo string) (*types.StorageGroupRDFG, error)
}

Pmax interface has all the externally available functions provided by the pmax client library for the Powermax accessed through Unisphere.

func NewClient

func NewClient() (client Pmax, err error)

NewClient returns a new Client, which is of interface type Pmax. The Client holds state for the connection. Thhe following environment variables define the connection:

CSI_POWERMAX_ENDPOINT - A URL of the form https://1.2.3.4:8443
CSI_POWERMAX_VERSION - should not be used. Defines a particular form of versioning.
CSI_APPLICATION_NAME - Application name which will be used for registering the application with Unisphere REST APIs
CSI_POWERMAX_INSECURE - A boolean indicating whether unvalidated certificates can be accepted. Defaults to true.
CSI_POWERMAX_USECERTS - Indicates whether to use certificates at all. Defaults to true.

func NewClientWithArgs

func NewClientWithArgs(
	endpoint string,
	version string,
	applicationName string,
	insecure,
	useCerts bool) (client Pmax, err error)

NewClientWithArgs allows the user to specify the endpoint, version, application name, insecure boolean, and useCerts boolean as direct arguments rather than receiving them from the enviornment. See NewClient().

Directories

Path Synopsis
types
v90
v91
Package types ...
Package types ...

Jump to

Keyboard shortcuts

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