connector

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Copyright 2017 The Goock Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// Pattern to match the fibre channel device
	FibreChannelPathPattern = "/dev/disk/by-path/pci-%s-fc-%s-lun-%s"
)
View Source
const (
	ISCSIPathPattern = "/dev/disk/by-path/ip-%s-iscsi-%s-lun-%s"
)

Variables

This section is empty.

Functions

func FormatLuns added in v0.1.1

func FormatLuns(luns ...int) []string

Specific handling for LUN ID. For lun id < 256, the return should be as original For lun id >= 256, return "0x" prefixed string

func SetExecutor

func SetExecutor(e exec.Interface)

func SetLogger

func SetLogger(l *logrus.Logger)

Types

type ConnectionProperty

type ConnectionProperty struct {
	// Only for iscsi
	TargetIqns    []string
	TargetPortals []string
	TargetLuns    []int
	// Only for fibre channel
	TargetWwns []string
	TargetLun  int
	// Shared by fibre change and iscsi
	StorageProtocol StringEnum
	AccessMode      StringEnum
}

func (ConnectionProperty) IsEmpty

func (prop ConnectionProperty) IsEmpty() error

IsEmpty validates whether the ConnectionProperty is empty

type FibreChannelConnector added in v0.1.1

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

Connector for Fibre Channel

func (*FibreChannelConnector) ConnectVolume added in v0.1.1

func (fc *FibreChannelConnector) ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)

Connect/Discover a FC device

func (*FibreChannelConnector) DisconnectVolume added in v0.1.1

func (fc *FibreChannelConnector) DisconnectVolume(connectionProperty ConnectionProperty) error

DisconnectVolume disconnect/remove an already-connected FC device

func (*FibreChannelConnector) ExtendVolume added in v0.1.1

func (fc *FibreChannelConnector) ExtendVolume(connectionProperty ConnectionProperty) error

Extend the volume attributes when changes are made on storage side

func (*FibreChannelConnector) GetHostInfo added in v0.1.1

func (fc *FibreChannelConnector) GetHostInfo() (HostInfo, error)

Get Fibre Channel host information

type FibreChannelInterface added in v0.1.1

type FibreChannelInterface interface {
	GetHostInfo() (HostInfo, error)
	ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)
	DisconnectVolume(connectionProperty ConnectionProperty) error
	ExtendVolume(connectionProperty ConnectionProperty) error
}

func NewFibreChannelConnector added in v0.1.1

func NewFibreChannelConnector() FibreChannelInterface

Constructor for FibreChannelConnector

type HostInfo

type HostInfo struct {
	Initiator string
	// Wwnns: the node name of the host HBA
	Wwnns []string
	// Wwpns: the port name of the HOST HBA
	Wwpns []string
	// TargetWwnns: the node name of connected targets
	TargetWwnns []string
	// TargetWwpns: the port name of connected targets
	TargetWwpns []string
	// Connected target portals
	TargetPortals []string
	TargetIqns    []string
	Ip            string
	Hostname      string
	OSType        string
}

func GetHostInfo added in v0.1.1

func GetHostInfo() (HostInfo, error)

GetHostInfo returns host iscsi and fc related information

type ISCSIConnector

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

func (*ISCSIConnector) ConnectVolume

func (iscsi *ISCSIConnector) ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)

Attach the volume from the remote to the local

  1. Need to login/discover iscsi sessions from the ConnectionProperty
  2. Get all possible paths for the targets
  3. If multipath is enabled, return multipath_id as well, returned properties ScsiWwn: <scsi wwn> MultipathId: <multipath id> Path: single path device description

func (*ISCSIConnector) DisconnectVolume

func (iscsi *ISCSIConnector) DisconnectVolume(connectProperty ConnectionProperty) error

func (*ISCSIConnector) DiscoverPortal

func (iscsi *ISCSIConnector) DiscoverPortal(targetPortal ...string) []model.ISCSISession

Discover all target portals

func (*ISCSIConnector) ExtendVolume

func (iscsi *ISCSIConnector) ExtendVolume(connectionProperty ConnectionProperty) error

Update the local kernel's size information

func (*ISCSIConnector) GetHostInfo

func (iscsi *ISCSIConnector) GetHostInfo() (HostInfo, error)

Returns host information regarding iSCSI and FC

func (*ISCSIConnector) LoginPortal

func (iscsi *ISCSIConnector) LoginPortal(targetPortal string, targetIqn string) error

Login all target portals if needed TODO(peter) consider using goroutine to login concurrently?

func (*ISCSIConnector) SetNode2Auto

func (iscsi *ISCSIConnector) SetNode2Auto(targetPortal string, targetIqn string) error

Set the node to 'node.startup = automatic', it will login the portal automatically after reboot

type ISCSIInterface

type ISCSIInterface interface {
	GetHostInfo() (HostInfo, error)
	ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)
	DisconnectVolume(connectionProperty ConnectionProperty) error
	ExtendVolume(connectionProperty ConnectionProperty) error
	LoginPortal(targetPortal string, targetIqn string) error
	SetNode2Auto(targetPortal string, targetIqn string) error
	DiscoverPortal(targetPortal ...string) []model.ISCSISession
}

func NewISCSIConnector

func NewISCSIConnector() ISCSIInterface

type Interface

type Interface interface {
	GetHostInfo() (HostInfo, error)
	ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)
	DisconnectVolume(connectionProperty ConnectionProperty) error
	ExtendVolume(connectionProperty ConnectionProperty) error
}

type OPERATION_ENUM

type OPERATION_ENUM StringEnum
const (
	OperationNew           OPERATION_ENUM = "new"
	OperationDelete        OPERATION_ENUM = "new"
	OperationUpdate        OPERATION_ENUM = "update"
	OperationShow          OPERATION_ENUM = "show"
	OperationNonPersistent OPERATION_ENUM = "nonpersistent"
)

type StringEnum

type StringEnum string
const (
	ReadWrite StringEnum = "rw"
	ReadOnly  StringEnum = "ro"
)
const (
	IscsiProtocol StringEnum = "iscsi"
	FcProtocol    StringEnum = "fibre_channel"
)

type VolumeInfo

type VolumeInfo struct {
	MultipathId string
	Paths       []string
	Wwn         string
	Multipath   string
}

Jump to

Keyboard shortcuts

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