scbe

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

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 = 1 // 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"
	ScbeFlockerGroupParam  = "flocker"
	UrlScbeResourceService = "services"
	UrlScbeResourceVolume  = "volumes"
	UrlScbeResourceMapping = "mappings"
	UrlScbeResourceHost    = "hosts"
	DefaultSizeUnit        = "gb"
)
View Source
const (
	HTTP_SUCCEED         = 200
	HTTP_SUCCEED_POST    = 201
	HTTP_SUCCEED_DELETED = 204
	HTTP_AUTH_KEY        = "Authorization"
)

Variables

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

Functions

func NewScbeLocalClient

func NewScbeLocalClient(config resources.ScbeConfig, database *gorm.DB) (resources.StorageClient, error)

func NewScbeLocalClientWithNewScbeRestClientAndDataModel

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

Types

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 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 {
	CreateVolumeTable() error
	DeleteVolume(name string) error
	InsertVolume(volumeName string, wwn string, attachTo string, fstype string) error
	GetVolume(name string) (ScbeVolume, bool, error)
	ListVolumes() ([]ScbeVolume, error)
	UpdateVolumeAttachTo(volumeName string, scbeVolume ScbeVolume, host2attach string) error
}

func NewScbeDataModel

func NewScbeDataModel(db *gorm.DB, backend string) ScbeDataModel

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 string `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) (string, error)
	ServiceExist(serviceName string) (bool, error)
}

func NewScbeRestClient

func NewScbeRestClient(conInfo resources.ConnectionInfo) ScbeRestClient

func NewScbeRestClientWithSimpleRestClient

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

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

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
	AttachTo 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 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, authURL string, referrer string) SimpleRestClient

type VolumeNameExceededMaxLengthError

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

func (*VolumeNameExceededMaxLengthError) Error

Jump to

Keyboard shortcuts

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