scbe

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	OptionNameForServiceName = "profile"
	OptionNameForVolumeSize  = "size"

	AttachedToNothing   = "" // during provisioning the volume is not attached to any host
	EmptyHost           = ""
	ComposeVolumeName   = volumeNamePrefix + "%s_%s" // e.g u_instance1_volName
	MaxVolumeNameLength = 63                         // IBM block storage max volume name cannot exceed this length

	GetVolumeConfigExtraParams = 3 // number of extra params added to the VolumeConfig beyond the scbe volume struct
)
View Source
const (
	DefaultScbePort          = 8440
	UrlScbeReferer           = "https://%s:%d/"
	UrlScbeBaseSuffix        = "api/v1"
	UrlScbeResourceGetAuth   = "users/get-auth-token"
	ScbeContainersGroupParam = "containers"
	UrlScbeResourceService   = "services"
	UrlScbeResourceVolume    = "volumes"
	UrlScbeResourceMapping   = "mappings"
	UrlScbeResourceHost      = "hosts"
	DefaultSizeUnit          = "gib"
	LunNumberNoMapping       = -1
)
View Source
const (
	HTTP_SUCCEED         = 200
	HTTP_SUCCEED_POST    = 201
	HTTP_SUCCEED_DELETED = 204
	HTTP_AUTH_KEY        = "Authorization"
	KEY_VERIFY_SCBE_CERT = "UBIQUITY_SERVER_VERIFY_SCBE_CERT"
)
View Source
const (
	ScName = "Spectrum Connect"
)
View Source
const VolumeNotFoundOnArrayErrorMsg = "volume was not found on the " + ScName + " interface."

Variables

View Source
var (
	SupportedFSTypes = []string{"ext4", "xfs"}
)

Functions

func InitScbeRestClientGen added in v1.0.0

func InitScbeRestClientGen(gen ScbeRestClientGen) func()

init global generator, used by tests

func NewScbeLocalClient

func NewScbeLocalClient(config resources.ScbeConfig) (resources.StorageClient, error)

func NewScbeLocalClientWithNewScbeRestClientAndDataModel

func NewScbeLocalClientWithNewScbeRestClientAndDataModel(config resources.ScbeConfig, dataModel ScbeDataModelWrapper, scbeRestClient ScbeRestClient) (resources.StorageClient, error)

Types

type BadHttpStatusCodeError added in v1.2.0

type BadHttpStatusCodeError struct {
	HttpStatusCode         int
	HttpExpectedStatusCode int
	HttpDataStr            string
	HttpAction             string
	HttpUrl                string
}

func (*BadHttpStatusCodeError) Error added in v1.2.0

func (e *BadHttpStatusCodeError) Error() string

type CannotDeleteVolWhichAttachedToHostError

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

func (*CannotDeleteVolWhichAttachedToHostError) Error

type ConfigDefaultFilesystemTypeNotSupported

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

func (*ConfigDefaultFilesystemTypeNotSupported) Error

type ConfigDefaultSizeNotNumError

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

func (*ConfigDefaultSizeNotNumError) Error

type ConfigScbeUbiquityInstanceNameWrongSize

type ConfigScbeUbiquityInstanceNameWrongSize struct {
}

func (*ConfigScbeUbiquityInstanceNameWrongSize) Error

type FsTypeNotSupportedError

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

func (*FsTypeNotSupportedError) Error

func (e *FsTypeNotSupportedError) Error() string

type InValidRequestError

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

func (*InValidRequestError) Error

func (e *InValidRequestError) Error() string

type InvalidMappingsForVolume added in v1.0.0

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

func (*InvalidMappingsForVolume) Error added in v1.0.0

func (e *InvalidMappingsForVolume) Error() string

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type ScbeCreateVolumePostParams

type ScbeCreateVolumePostParams struct {
	Service  string `json:"service"`
	Name     string `json:"name"`
	Size     int    `json:"size"`
	SizeUnit string `json:"size_unit"`
}

type ScbeDataModel

type ScbeDataModel interface {
	DeleteVolume(name string) error
	InsertVolume(volumeName string, wwn string, fstype string) error
	GetVolume(name string) (ScbeVolume, bool, error)
	ListVolumes() ([]ScbeVolume, error)
}

func NewScbeDataModel

func NewScbeDataModel(db *gorm.DB) ScbeDataModel

type ScbeDataModelWrapper added in v1.0.0

type ScbeDataModelWrapper interface {
	GetVolume(name string, mustExist bool) (ScbeVolume, error)
	DeleteVolume(name string) error
	InsertVolume(volumeName string, wwn string, fstype string) error
	ListVolumes() ([]ScbeVolume, error)
	UpdateDatabaseVolume(newVolume *ScbeVolume)
}

func NewScbeDataModelWrapper added in v1.0.0

func NewScbeDataModelWrapper() ScbeDataModelWrapper

type ScbeMapVolumePostParams

type ScbeMapVolumePostParams struct {
	VolumeId string `json:"volume_id"`
	HostId   int    `json:"host_id"`
}

type ScbeResponseHost

type ScbeResponseHost struct {
	Id             int    `json:"id"`
	ArrayType      string `json:"array_type"`
	Array          string `json:"array"`
	HostId         string `json:"host_id"`
	Name           string `json:"name"`
	StorageCluster int    `json:"storage_cluster"`
	PhysicalHost   int    `json:"physical_host"`
}

type ScbeResponseMapping

type ScbeResponseMapping struct {
	Id        int    `json:"id"`
	Volume    string `json:"volume"`
	Host      int    `json:"host"`
	LunNumber int    `json:"lun_number"`
}

type ScbeResponseMappings

type ScbeResponseMappings struct {
	Mappings []ScbeResponseMapping `json:"mappings"`
}

type ScbeResponseVolume

type ScbeResponseVolume struct {
	ScsiIdentifier     string `json:"scsi_identifier"`
	ArrayType          string `json:"array_type"`
	Array              string `json:"array"`
	ArrayName          string `json:"array_name"`
	Id                 string `json:"id"`
	PoolName           string `json:"pool_name"`
	MaxExtendable_size int    `json:"max_extendable_size"`
	ServiceCompliance  string `json:"service_compliance"`
	DomainName         string `json:"domain_name"`
	ServiceName        string `json:"service_name"`
	ContainerName      string `json:"container_name"`
	ServiceId          string `json:"service_id"`
	ContainerId        string `json:"container_id"`
	StorageModel       string `json:""`
	VolumeId           string `json:"volume_id"`
	Name               string `json:"name"`
	LogicalCapacity    int    `json:"logical_capacity"`
	PhysicalCapacity   int    `json:"physical_capacity"`
	UsedCapacity       int    `json:"used_capacity"`
	LastUpdateTime     string `json:"last_update_time"`
	IsPendingDeletion  bool   `json:"is_pending_deletion"`
	Pool               int    `json:"pool"`

	// A9000 related attrs
	Serial        string `json:"serial"`
	CgId          string `json:"cg_id"`
	Snapshot_time string `json:"snapshot_time"` //not sure about the type
	Compressed    bool   `json:"compressed"`
	//Ratio                   int `json:"ratio"` // for A9000 its int but for v9000 its string "N/A", so comment out to avoid marshaling issue
	Saving                  int    `json:"cg_id"`
	ThinProvisioningSavings string `json:"thin_provisioning_savings"`
	EstCompressionFactor    string `json:"est_compression_factor"`
	PerfClass               string `json:"perf_class"`

	// V9000 related attrs
	Status           string `json:"status"`
	CopyCount        int    `json:"copy_count"`
	FcMapCount       int    `json:"fc_map_count"`
	FastWriteState   string `json:"fast_write_state"`
	OwnerType        string `json:"owner_type"`
	FlashcopyTime    string `json:"flashcopy_time"`
	ThrottleId       string `json:"throttle_id"`
	IOPsLimit        string `json:"IOPs_limit"`
	BandwidthLimitMB string `json:"bandwidth_limit_MB"`
	IoGrp            int    `json:"io_grp"`
}

type ScbeRestClient

type ScbeRestClient interface {
	Login() error
	CreateVolume(volName string, serviceName string, size int) (ScbeVolumeInfo, error)
	GetVolumes(wwn string) ([]ScbeVolumeInfo, error)
	DeleteVolume(wwn string) error
	MapVolume(wwn string, host string) (ScbeResponseMapping, error)
	UnmapVolume(wwn string, host string) error
	GetVolMapping(wwn string) (ScbeVolumeMapInfo, error)
	ServiceExist(serviceName string) (bool, error)
}

func NewScbeRestClient

func NewScbeRestClient(conInfo resources.ConnectionInfo) (ScbeRestClient, error)

func NewScbeRestClientWithSimpleRestClient

func NewScbeRestClientWithSimpleRestClient(conInfo resources.ConnectionInfo, simpleClient SimpleRestClient) (ScbeRestClient, error)

NewScbeRestClientWithNewRestClient for mocking during test # TODO consider to remove it to test file

type ScbeRestClientGen added in v1.0.0

type ScbeRestClientGen func(resources.ConnectionInfo) (ScbeRestClient, error)

type for generation of new ScbeRestClient

type ScbeStorageService

type ScbeStorageService struct {
	Id                                 string `json:"id"`
	UniqueIdentifier                   string `json:"unique_identifier"`
	Name                               string `json:"name"`
	Description                        string `json:"description"`
	Container                          string `json:"container"`
	CapabilityValues                   string `json:"capability_values"`
	Type                               string `json:"type"`
	PhysicalSize                       int    `json:""`
	LogicalSize                        int    `json:"logical_size"`
	PhysicalFree                       int    `json:"physical_free"`
	LogicalFree                        int    `json:"logical_free"`
	TotalCapacity                      int    `json:"total_capacity"`
	UsedCapacity                       int    `json:"used_capacity"`
	MaxResourceLogicalFree             int    `json:"max_resource_logical_free"`
	MaxResourceFreeSizeForProvisioning int    `json:"max_resource_free_size_for_provisioning"`
	NumVolumes                         int    `json:"num_volumes"`
	HasAdmin                           bool   `json:"has_admin"`
	QosMaxIops                         int    `json:"qos_max_iops"`
	QosMaxMbps                         int    `json:"qos_max_mbps"`
}

type ScbeUnMapVolumePostParams

type ScbeUnMapVolumePostParams struct {
	VolumeId string `json:"volume_id"`
	HostId   int    `json:"host_id"`
}

Its the same as ScbeMapVolumePostParams but later on we may add more attr to the map struct

type ScbeVolume

type ScbeVolume struct {
	ID       uint
	Volume   resources.Volume
	VolumeID uint
	WWN      string
	FSType   string
}

type ScbeVolumeInfo

type ScbeVolumeInfo struct {
	Name             string
	Wwn              string
	Profile          string
	StorageType      string
	StorageName      string
	PoolName         string
	LogicalCapacity  string
	PhysicalCapacity string
	UsedCapacity     string
}

func NewScbeVolumeInfo

func NewScbeVolumeInfo(volume *ScbeResponseVolume) ScbeVolumeInfo

type ScbeVolumeMapInfo

type ScbeVolumeMapInfo struct {
	Host      string
	LunNumber int
}

type SimpleRestClient

type SimpleRestClient interface {
	// Authenticate the server, prepare headers and save the token
	Login() error

	// send POST request with optional payload and check expected status of response
	Post(resource_url string, payload []byte, exitStatus int, v interface{}) error

	// send GET request with optional params and check expected status of response
	Get(resource_url string, params map[string]string, exitStatus int, v interface{}) error

	// send DELETE request with optional payload and check expected status of response
	Delete(resource_url string, payload []byte, exitStatus int) error
}

SimpleRestClient is an interface that wrapper the http requests to provide easy REST API operations,

func NewSimpleRestClient

func NewSimpleRestClient(conInfo resources.ConnectionInfo, baseURL string, referrer string) (SimpleRestClient, error)

type SslModeFullVerifyWithoutCAfile added in v1.0.0

type SslModeFullVerifyWithoutCAfile struct {
	VerifyCaEnvName string
}

func (*SslModeFullVerifyWithoutCAfile) Error added in v1.0.0

type SslModeValueInvalid added in v1.0.0

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

func (*SslModeValueInvalid) Error added in v1.0.0

func (e *SslModeValueInvalid) Error() string

type VolumeNameExceededMaxLengthError

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

func (*VolumeNameExceededMaxLengthError) Error

type VolumeNotFoundOnArrayError added in v1.2.0

type VolumeNotFoundOnArrayError struct {
	VolName string
}

func (*VolumeNotFoundOnArrayError) Error added in v1.2.0

Jump to

Keyboard shortcuts

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