Documentation ¶
Overview ¶
This package provides a high-level interface to the E-series Web Services Proxy REST API.
Index ¶
- Constants
- Variables
- type ByFreeSpace
- type CallResponseError
- type Controller
- type DriverConfig
- type ESeriesAPIDriver
- func (d ESeriesAPIDriver) Connect() (string, error)
- func (d ESeriesAPIDriver) CreateHost(name string, iqn string, hostType string, hostGroup HostGroup) (HostEx, error)
- func (d ESeriesAPIDriver) CreateHostGroup(name string) (HostGroup, error)
- func (d ESeriesAPIDriver) CreateVolume(name string, volumeGroupRef string, size uint64, mediaType, fstype string) (VolumeEx, error)
- func (d ESeriesAPIDriver) DeleteVolume(volume VolumeEx) error
- func (d ESeriesAPIDriver) EnsureHostForIQN(iqn string) (HostEx, error)
- func (d ESeriesAPIDriver) EnsureHostGroup() (HostGroup, error)
- func (d ESeriesAPIDriver) GetControllers() ([]Controller, error)
- func (d ESeriesAPIDriver) GetHostForIQN(iqn string) (HostEx, error)
- func (d ESeriesAPIDriver) GetHostGroup(name string) (HostGroup, error)
- func (d *ESeriesAPIDriver) GetTargetIQN() (string, error)
- func (d ESeriesAPIDriver) GetVolume(name string) (VolumeEx, error)
- func (d ESeriesAPIDriver) GetVolumePools(mediaType string, minFreeSpaceBytes uint64, poolName string) ([]VolumeGroupEx, error)
- func (d ESeriesAPIDriver) GetVolumes() ([]VolumeEx, error)
- func (d ESeriesAPIDriver) InvokeAPI(requestBody []byte, method string, resourcePath string) (*http.Response, []byte, error)
- func (d ESeriesAPIDriver) IsRefValid(ref string) bool
- func (d ESeriesAPIDriver) ListNodeSerialNumbers() ([]string, error)
- func (d ESeriesAPIDriver) ListVolumes() ([]string, error)
- func (d ESeriesAPIDriver) MapVolume(volume VolumeEx, host HostEx) (LUNMapping, error)
- func (d ESeriesAPIDriver) UnmapVolume(volume VolumeEx) error
- type HostCreateRequest
- type HostEx
- type HostExInitiator
- type HostExScsiNodeName
- type HostGroup
- type HostGroupCreateRequest
- type HostPort
- type HostType
- type IscsiTargetSettings
- type LUNMapping
- type MsgConnect
- type MsgConnectResponse
- type VolumeCreateRequest
- type VolumeEx
- type VolumeGroupEx
- type VolumeMappingCreateRequest
- type VolumeTag
Constants ¶
const DEFAULT_POOL_SEARCH_PATTERN = ".+"
const HOST_GROUP_MAPPING_TYPE = "cluster"
const HOST_MAPPING_TYPE = "host"
const HTTP_TIMEOUT_SECONDS = 10
const HTTP_UNPROCESSABLE_ENTITY int = 422 // Not defined in net/http package
const MAX_NAME_LENGTH int = 30
const NULL_REF string = "0000000000000000000000000000000000000000"
Variables ¶
var HOST_TYPES = map[string]string{
"linux_atto": "LnxTPGSALUA",
"linux_dm_mp": "LnxALUA",
"linux_mpp_rdac": "LNX",
"linux_pathmanager": "LnxTPGSALUA_PM",
"linux_sf": "LnxTPGSALUA_SF",
"ontap": "ONTAP_ALUA",
"ontap_rdac": "ONTAP_RDAC",
"vmware": "VmwTPGSALUA",
"windows": "W2KNETNCL",
"windows_atto": "WinTPGSALUA",
"windows_clustered": "W2KNETCL",
}
Functions ¶
This section is empty.
Types ¶
type ByFreeSpace ¶ added in v1.4.0
type ByFreeSpace []VolumeGroupEx
Functions to allow sorting storage pools by free space
func (ByFreeSpace) Len ¶ added in v1.4.0
func (s ByFreeSpace) Len() int
func (ByFreeSpace) Less ¶ added in v1.4.0
func (s ByFreeSpace) Less(i, j int) bool
func (ByFreeSpace) Swap ¶ added in v1.4.0
func (s ByFreeSpace) Swap(i, j int)
type CallResponseError ¶
type CallResponseError struct { ErrorMsg string `json:"errorMessage"` LocalizedMsg string `json:"localizedMessage"` ReturnCode string `json:"retcode"` CodeType string `json:"codeType"` //'symbol', 'webservice', 'systemerror', 'devicemgrerror' }
Used for errors on RESTful calls to return what went wrong
type Controller ¶
type Controller struct { Active bool `json:"active"` Quiesced bool `json:"quiesced"` Status string `json:"status"` ControllerRef string `json:"controllerRef"` Manufacturer string `json:"manufacturer"` ManufacturerDate string `json:"manufacturerDate"` AppVersion string `json:"appVersion"` BootVersion string `json:"bootVersion"` ProductID string `json:"productID"` ProductRevLevel string `json:"productRevLevel"` SerialNumber string `json:"serialNumber"` BoardID string `json:"boardID"` CacheMemorySize int `json:"cacheMemorySize"` ProcessorMemorySize int `json:"processorMemorySize"` Reserved1 string `json:"reserved1"` Reserved2 string `json:"reserved2"` HostBoardID string `json:"hostBoardID"` PhysicalCacheMemorySize int `json:"physicalCacheMemorySize"` ReadyToRemove bool `json:"readyToRemove"` BoardSubmodelID string `json:"boardSubmodelID"` SubmodelSupported bool `json:"submodelSupported"` OemPartNumber string `json:"oemPartNumber"` PartNumber string `json:"partNumber"` BootTime string `json:"bootTime"` ModelName string `json:"modelName"` FlashCacheMemorySize int `json:"flashCacheMemorySize"` LocateInProgress bool `json:"locateInProgress"` HasTrayIdentityIndicator bool `json:"hasTrayIdentityIndicator"` ControllerErrorMode string `json:"controllerErrorMode"` ID string `json:"id"` }
type DriverConfig ¶
type DriverConfig struct { // Web Proxy Services Info WebProxyHostname string WebProxyPort string WebProxyUseHTTP bool WebProxyVerifyTLS bool Username string Password string // Array Info ControllerA string ControllerB string PasswordArray string // Options PoolNameSearchPattern string DebugTraceFlags map[string]bool // Host Connectivity HostDataIP string //for iSCSI with multipathing this can be either IP or host // Internal Config Variables ArrayID string // Unique ID for array once added to web proxy services CompiledPoolNameSearchPattern *regexp.Regexp // Storage protocol of the driver (iSCSI, FC, etc) Protocol string AccessGroup string HostType string DriverName string DriverVersion string ConfigVersion int }
DriverConfig holds configuration data for the API driver object.
type ESeriesAPIDriver ¶ added in v1.4.0
type ESeriesAPIDriver struct {
// contains filtered or unexported fields
}
Driver is the object to use for interacting with the E-series API.
func NewDriver ¶
func NewDriver(config DriverConfig) *ESeriesAPIDriver
NewDriver is a factory method for creating a new instance.
func (ESeriesAPIDriver) Connect ¶ added in v1.4.0
func (d ESeriesAPIDriver) Connect() (string, error)
Connect connects to the Web Services Proxy and registers the array with it.
func (ESeriesAPIDriver) CreateHost ¶ added in v1.4.0
func (d ESeriesAPIDriver) CreateHost(name string, iqn string, hostType string, hostGroup HostGroup) (HostEx, error)
CreateHost creates a Host on the array. If a HostGroup is specified, the Host is placed in that group.
func (ESeriesAPIDriver) CreateHostGroup ¶ added in v1.4.0
func (d ESeriesAPIDriver) CreateHostGroup(name string) (HostGroup, error)
CreateHostGroup creates an E-series HostGroup object with the specified name and returns the resulting HostGroup structure.
func (ESeriesAPIDriver) CreateVolume ¶ added in v1.4.0
func (d ESeriesAPIDriver) CreateVolume( name string, volumeGroupRef string, size uint64, mediaType, fstype string, ) (VolumeEx, error)
CreateVolume creates a volume (i.e. a LUN) on the array, and it returns the resulting VolumeEx structure.
func (ESeriesAPIDriver) DeleteVolume ¶ added in v1.4.0
func (d ESeriesAPIDriver) DeleteVolume(volume VolumeEx) error
DeleteVolume deletes a volume from the array.
func (ESeriesAPIDriver) EnsureHostForIQN ¶ added in v1.4.0
func (d ESeriesAPIDriver) EnsureHostForIQN(iqn string) (HostEx, error)
EnsureHostForIQN handles automatic E-series Host and Host Group creation. Given the IQN of a host, this method verifies whether a Host is already configured on the array. If so, the Host info is returned and no further action is taken. If not, this method chooses a unique name for the Host and creates it on the array. Once the Host is created, it is placed in the Host Group used for nDVP volumes.
func (ESeriesAPIDriver) EnsureHostGroup ¶ added in v1.4.0
func (d ESeriesAPIDriver) EnsureHostGroup() (HostGroup, error)
EnsureHostGroup ensures that an E-series HostGroup exists to contain all Host objects created by the nDVP E-series driver. The group name is taken from the config structure. If the group exists, the group structure is returned and no further action is taken. If not, this method creates the group and returns the resulting group structure.
func (ESeriesAPIDriver) GetControllers ¶
func (d ESeriesAPIDriver) GetControllers() ([]Controller, error)
GetControllers returns an array containing all the controllers in the storage system.
func (ESeriesAPIDriver) GetHostForIQN ¶ added in v1.4.0
func (d ESeriesAPIDriver) GetHostForIQN(iqn string) (HostEx, error)
GetHostForIQN queries the Host objects on the array an returns one matching the supplied IQN. An empty struct is returned if a matching host is not found, so the caller should check for empty values in the result.
func (ESeriesAPIDriver) GetHostGroup ¶ added in v1.4.0
func (d ESeriesAPIDriver) GetHostGroup(name string) (HostGroup, error)
GetHostGroup returns an E-series HostGroup structure with the specified name. If no matching group is found, an empty structure is returned, so the caller should check for empty values in the result.
func (*ESeriesAPIDriver) GetTargetIQN ¶ added in v1.4.0
func (d *ESeriesAPIDriver) GetTargetIQN() (string, error)
GetTargetIqn returns the IQN for the array.
func (ESeriesAPIDriver) GetVolume ¶ added in v1.4.0
func (d ESeriesAPIDriver) GetVolume(name string) (VolumeEx, error)
GetVolume returns a volume structure from the array whose label matches the specified name. Use this method sparingly, at most once per workflow, because the Web Services Proxy does not support server-side filtering so the only choice is to read all volumes to find the one of interest. Most methods in this module operate on the returned VolumeEx structure, not the volume name, to minimize the need for calling this method.
func (ESeriesAPIDriver) GetVolumePools ¶ added in v1.4.0
func (d ESeriesAPIDriver) GetVolumePools(mediaType string, minFreeSpaceBytes uint64, poolName string) ([]VolumeGroupEx, error)
GetVolumePools reads all pools on the array, including volume groups and dynamic disk pools. It then filters them based on several selection parameters and returns the ones that match.
func (ESeriesAPIDriver) GetVolumes ¶ added in v1.4.0
func (d ESeriesAPIDriver) GetVolumes() ([]VolumeEx, error)
GetVolumes returns an array containing all the volumes on the array.
func (ESeriesAPIDriver) InvokeAPI ¶ added in v1.4.0
func (d ESeriesAPIDriver) InvokeAPI(requestBody []byte, method string, resourcePath string) (*http.Response, []byte, error)
InvokeAPI makes a REST call to the Web Services Proxy. The body must be a marshaled JSON byte array (or nil). The method is the HTTP verb (i.e. GET, POST, ...). The resource path is appended to the base URL to identify the desired server resource; it should start with '/'.
func (ESeriesAPIDriver) IsRefValid ¶ added in v1.4.0
func (d ESeriesAPIDriver) IsRefValid(ref string) bool
isRefValid checks whether the supplied string is a valid E-series object reference as used by its REST API. Ref values are strings of all numerical digits that aren't all zeros (i.e. the null ref).
func (ESeriesAPIDriver) ListNodeSerialNumbers ¶
func (d ESeriesAPIDriver) ListNodeSerialNumbers() ([]string, error)
ListNodeSerialNumbers returns an array containing the controller serial numbers for this storage system.
func (ESeriesAPIDriver) ListVolumes ¶ added in v1.4.0
func (d ESeriesAPIDriver) ListVolumes() ([]string, error)
ListVolumes returns an array containing all the volume names on the array.
func (ESeriesAPIDriver) MapVolume ¶ added in v1.4.0
func (d ESeriesAPIDriver) MapVolume(volume VolumeEx, host HostEx) (LUNMapping, error)
MapVolume maps a volume to the specified host and returns the resulting LUN mapping. If the volume is already mapped to the specified host, either directly or to the containing host group, no action is taken. If the volume is mapped to a different host, the method returns an error. Note that if the host is in a group, the volume will actually be mapped to the group instead of the individual host.
func (ESeriesAPIDriver) UnmapVolume ¶ added in v1.4.0
func (d ESeriesAPIDriver) UnmapVolume(volume VolumeEx) error
UnmapVolume removes a mapping from the specified volume. If no map exists, no action is taken.
type HostCreateRequest ¶ added in v1.4.0
type HostEx ¶ added in v1.4.0
type HostEx struct { HostRef string `json:"hostRef"` ClusterRef string `json:"clusterRef"` Label string `json:"label"` HostTypeIndex int `json:"hostTypeIndex"` Initiators []HostExInitiator `json:"initiators"` }
type HostExInitiator ¶
type HostExInitiator struct { InitiatorRef string `json:"initiatorRef"` NodeName HostExScsiNodeName `json:"nodeName"` Label string `json:"label"` }
type HostExScsiNodeName ¶
type HostGroupCreateRequest ¶ added in v1.4.0
type IscsiTargetSettings ¶ added in v1.4.0
type IscsiTargetSettings struct { TargetRef string `json:"targetRef"` NodeName struct { IoInterfaceType string `json:"ioInterfaceType"` IscsiNodeName string `json:"iscsiNodeName"` RemoteNodeWWN interface{} `json:"remoteNodeWWN"` } `json:"nodeName"` Alias struct { IoInterfaceType string `json:"ioInterfaceType"` IscsiAlias string `json:"iscsiAlias"` } `json:"alias"` ConfiguredAuthMethods struct { AuthMethodData []struct { AuthMethod string `json:"authMethod"` ChapSecret interface{} `json:"chapSecret"` } `json:"authMethodData"` } `json:"configuredAuthMethods"` Portals []struct { GroupTag int `json:"groupTag"` IPAddress struct { AddressType string `json:"addressType"` Ipv4Address string `json:"ipv4Address"` Ipv6Address interface{} `json:"ipv6Address"` } `json:"ipAddress"` TCPListenPort int `json:"tcpListenPort"` } `json:"portals"` }
type LUNMapping ¶
type MsgConnect ¶
type MsgConnect struct { ControllerAddresses []string `json:"controllerAddresses"` Password string `json:"password,omitempty"` }
Add array to Web Services Proxy
type MsgConnectResponse ¶
type VolumeCreateRequest ¶ added in v1.4.0
type VolumeCreateRequest struct { VolumeGroupRef string `json:"poolId"` Name string `json:"name"` SizeUnit string `json:"sizeUnit"` //bytes, b, kb, mb, gb, tb, pb, eb, zb, yb Size int `json:"size"` SegmentSize int `json:"segSize"` DataAssurance bool `json:"dataAssuranceEnabled,omitempty"` OwningController string `json:"owningControllerId,omitempty"` VolumeTags []VolumeTag `json:"metaTags,omitempty"` }
type VolumeEx ¶ added in v1.4.0
type VolumeEx struct { IsOffline bool `json:"offline"` Label string `json:"label"` VolumeSize string `json:"capacity"` SegmentSize int `json:"segmentSize"` VolumeRef string `json:"volumeRef"` VolumeGroupRef string `json:"volumeGroupRef"` Mappings []LUNMapping `json:"listOfMappings"` IsMapped bool `json:"mapped"` VolumeTags []VolumeTag `json:"metadata"` }
type VolumeGroupEx ¶ added in v1.4.0
type VolumeGroupEx struct { IsOffline bool `json:"offline"` WorldWideName string `json:"worldWideName"` VolumeGroupRef string `json:"volumeGroupRef"` Label string `json:"label"` FreeSpace string `json:"freeSpace"` // Documentation says this is an int but really it is a string! DriveMediaType string `json:"driveMediaType"` // 'hdd', 'ssd' }