gobrick

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 20 Imported by: 9

README

GOBRICK

Library for iSCSI/FC volume connection

Example
connector := gobrick.NewISCSIConnector(gobrick.ISCSIConnectorParams{})
dev, err := connector.ConnectVolume(context.Background(),
		gobrick.ISCSIVolumeInfo{
			Lun:1,
			Targets: []gobrick.ISCSITargetInfo{
				{Portal: "1.1.1.1",
				 Target: "iqn.2015-10.com.dell:dellemc-array-fnm00185000782-b-5dc4fceb"}}})

err = connector.DisconnectVolumeByDeviceName(context.Background(), "dm-1")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(customLogger Logger)

SetLogger set custom logger for gobrick

func SetTracer

func SetTracer(customTracer Tracer)

SetTracer set custom tracer for gobrick

Types

type Device

type Device struct {
	WWN         string
	Name        string
	MultipathID string
}

type FCConnector

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

FCConnector connector for FC transport

func NewFCConnector

func NewFCConnector(params FCConnectorParams) *FCConnector

NewFCConnector create new FCConnector

func (*FCConnector) ConnectVolume

func (fc *FCConnector) ConnectVolume(ctx context.Context, info FCVolumeInfo) (Device, error)

ConnectVolume attach volume to a node

func (*FCConnector) DisconnectVolume

func (fc *FCConnector) DisconnectVolume(ctx context.Context, info FCVolumeInfo) error

DisconnectVolume disconnects volume from a node by full volume request

func (*FCConnector) DisconnectVolumeByDeviceName

func (fc *FCConnector) DisconnectVolumeByDeviceName(ctx context.Context, name string) error

DisconnectVolumeByDeviceName disconnects volume from a node by device name

func (*FCConnector) GetInitiatorPorts

func (fc *FCConnector) GetInitiatorPorts(ctx context.Context) ([]string, error)

GetInitiatorPorts return information about nodes local FC ports

type FCConnectorParams

type FCConnectorParams struct {
	// run commands inside chroot
	Chroot string

	// how long wait for DM appear
	WaitDeviceRegisterTimeout time.Duration
	// timeout for multipath flush command
	MultipathFlushTimeout time.Duration

	// how many parallel operations allowed
	MaxParallelOperations int
}

FCConnectorParams options for FCConnector

type FCHBA

type FCHBA struct {
	PortName   string
	NodeName   string
	HostDevice string
}

FCHBA holds information about host local FC ports

type FCTargetInfo

type FCTargetInfo struct {
	WWPN string
}

FCTargetInfo holds information about remote FC ports

type FCVolumeInfo

type FCVolumeInfo struct {
	Targets []FCTargetInfo
	Lun     int
}

FCVolumeInfo connection request for volume

type ISCSIConnector

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

func NewISCSIConnector

func NewISCSIConnector(params ISCSIConnectorParams) *ISCSIConnector

func (*ISCSIConnector) ConnectVolume

func (c *ISCSIConnector) ConnectVolume(ctx context.Context, info ISCSIVolumeInfo) (Device, error)

func (*ISCSIConnector) DisconnectVolume

func (c *ISCSIConnector) DisconnectVolume(ctx context.Context, info ISCSIVolumeInfo) error

func (*ISCSIConnector) DisconnectVolumeByDeviceName

func (c *ISCSIConnector) DisconnectVolumeByDeviceName(ctx context.Context, name string) error

func (*ISCSIConnector) GetInitiatorName

func (c *ISCSIConnector) GetInitiatorName(ctx context.Context) ([]string, error)

type ISCSIConnectorParams

type ISCSIConnectorParams struct {
	// iscsiLib command will run from this chroot
	Chroot string

	// chap
	ChapUser     string
	ChapPassword string
	ChapEnabled  bool

	// timeouts
	// how long to wait for iSCSI session to become active after login
	WaitDeviceTimeout                      time.Duration
	WaitDeviceRegisterTimeout              time.Duration
	FailedSessionMinimumLoginRetryInterval time.Duration
	MultipathFlushTimeout                  time.Duration

	MaxParallelOperations int
}

type ISCSITargetInfo

type ISCSITargetInfo struct {
	Portal string
	Target string
}

type ISCSIVolumeInfo

type ISCSIVolumeInfo struct {
	Targets []ISCSITargetInfo
	Lun     int
}

type Logger

type Logger = logger.Logger

type Tracer

type Tracer = tracer.Tracer

Directories

Path Synopsis
internal
multipath
Package multipath is a generated GoMock package.
Package multipath is a generated GoMock package.
scsi
Package scsi is a generated GoMock package.
Package scsi is a generated GoMock package.
wrappers
Package wrappers is a generated GoMock package.
Package wrappers is a generated GoMock package.
pkg

Jump to

Keyboard shortcuts

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