eseries

package
v17.10.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

This package provides a high-level interface to the E-series Web Services Proxy REST API.

Index

Constants

View Source
const DEFAULT_POOL_SEARCH_PATTERN = ".+"
View Source
const HOST_GROUP_MAPPING_TYPE = "cluster"
View Source
const HOST_MAPPING_TYPE = "host"
View Source
const HTTP_TIMEOUT_SECONDS = 10
View Source
const HTTP_UNPROCESSABLE_ENTITY int = 422 // Not defined in net/http package
View Source
const MAX_NAME_LENGTH int = 30
View Source
const NULL_REF string = "0000000000000000000000000000000000000000"

Variables

View Source
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 HostCreateRequest struct {
	Name     string `json:"name"`
	HostType `json:"hostType"`
	GroupID  string     `json:"groupId,omitempty"`
	Ports    []HostPort `json:"ports"`
}

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 HostExScsiNodeName struct {
	IoInterfaceType string `json:"ioInterfaceType"`
	IscsiNodeName   string `json:"iscsiNodeName"`
}

type HostGroup added in v1.4.0

type HostGroup struct {
	ClusterRef string `json:"clusterRef"`
	Label      string `json:"label"`
}

type HostGroupCreateRequest added in v1.4.0

type HostGroupCreateRequest struct {
	Name  string   `json:"name"`
	Hosts []string `json:"hosts"`
}

type HostPort added in v1.4.0

type HostPort struct {
	Type  string `json:"type"`
	Port  string `json:"port"`
	Label string `json:"label"`
}

type HostType added in v1.4.0

type HostType struct {
	Name  string `json:"name,omitempty"`
	Index int    `json:"index"`
	Code  string `json:"code,omitempty"`
}

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 LUNMapping struct {
	LunMappingRef string `json:"lunMappingRef"`
	LunNumber     int    `json:"lun"`
	VolumeRef     string `json:"volumeRef"`
	MapRef        string `json:"mapRef"`
	Type          string `json:"type"`
}

type MsgConnect

type MsgConnect struct {
	ControllerAddresses []string `json:"controllerAddresses"`
	Password            string   `json:"password,omitempty"`
}

Add array to Web Services Proxy

type MsgConnectResponse

type MsgConnectResponse struct {
	ArrayID       string `json:"id"`
	AlreadyExists bool   `json:"alreadyExists"`
}

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'
}

type VolumeMappingCreateRequest

type VolumeMappingCreateRequest struct {
	MappableObjectID string `json:"mappableObjectId"`
	TargetID         string `json:"targetId"`
	LunNumber        int    `json:"lun,omitempty"`
}

type VolumeTag added in v1.3.1

type VolumeTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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