gobrick

package module
v1.99.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

README

GOBRICK

Library for iSCSI/FC/NVMe 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

Overview

Package gobrick is a generated GoMock package.

Index

Constants

View Source
const (
	// NVMeWaitDeviceTimeoutDefault - NVMe default device time out
	NVMeWaitDeviceTimeoutDefault = time.Second * 30

	// NVMeWaitDeviceRegisterTimeoutDefault - NVMe default device register timeout
	NVMeWaitDeviceRegisterTimeoutDefault = time.Second * 10

	// NVMeMaxParallelOperationsDefault - max parallen NVMe operations
	NVMeMaxParallelOperationsDefault = 5

	// NVMePortDefault - NVMe TCP port
	NVMePortDefault = ":4420"
)

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
	PowerpathID string
}

Device defines device info

type DevicePathResult

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

DevicePathResult - placeholder for nvme devicepaths

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) ConnectRDMVolume

func (fc *FCConnector) ConnectRDMVolume(ctx context.Context, info RDMVolumeInfo) (Device, error)

ConnectRDMVolume attach RDM to a VM

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
	// timeout for each multipath flush retry
	MultipathFlushRetryTimeout time.Duration
	// how many retries for multipath flush
	MultipathFlushRetries int

	// 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 FCHBAInfo

type FCHBAInfo struct {
	PortName string
	NodeName string
}

FCHBAInfo holds information about host NVMe/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
}

ISCSIConnector defines iscsi connector info

func NewISCSIConnector

func NewISCSIConnector(params ISCSIConnectorParams) *ISCSIConnector

NewISCSIConnector creates an ISCSI client and returns it

func (*ISCSIConnector) ConnectVolume

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

ConnectVolume connects to the iscsi volume and returns device info

func (*ISCSIConnector) DisconnectVolume

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

DisconnectVolume disconnects from iscsi volume

func (*ISCSIConnector) DisconnectVolumeByDeviceName

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

DisconnectVolumeByDeviceName disconnects from volume specified by WWN name

func (*ISCSIConnector) GetInitiatorName

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

GetInitiatorName gets iscsi initiators and returns it

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
	MultipathFlushRetryTimeout             time.Duration

	MultipathFlushRetries int
	MaxParallelOperations int
}

ISCSIConnectorParams defines ISCSI connector parameters

type ISCSITargetInfo

type ISCSITargetInfo struct {
	Portal string
	Target string
}

ISCSITargetInfo defines iscsi target info

type ISCSIVolumeInfo

type ISCSIVolumeInfo struct {
	Targets []ISCSITargetInfo
	Lun     int
}

ISCSIVolumeInfo defines iscsi volume info

type Logger

type Logger = logger.Logger

Logger defines logger interface used

type NVMeConnector

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

NVMeConnector - type defenition for NVMe connector

func NewNVMeConnector

func NewNVMeConnector(params NVMeConnectorParams) *NVMeConnector

NewNVMeConnector - get new NVMeConnector

func (*NVMeConnector) ConnectVolume

func (c *NVMeConnector) ConnectVolume(ctx context.Context, info NVMeVolumeInfo, useFC bool) (Device, error)

ConnectVolume - connect to nvme volume

func (*NVMeConnector) DisconnectVolume

func (c *NVMeConnector) DisconnectVolume(ctx context.Context, info NVMeVolumeInfo) error

DisconnectVolume - disconnect a given nvme volume

func (*NVMeConnector) DisconnectVolumeByDeviceName

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

DisconnectVolumeByDeviceName - disconnect from a given device

func (*NVMeConnector) GetInitiatorName

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

GetInitiatorName - returns nqn

type NVMeConnectorParams

type NVMeConnectorParams struct {
	// nvmeLib command will run from this chroot
	Chroot string

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

	MultipathFlushRetries int
	MaxParallelOperations int
}

NVMeConnectorParams - type definition for NVMe connector params

type NVMeTargetInfo

type NVMeTargetInfo struct {
	Portal string
	Target string
}

NVMeTargetInfo - Placeholder for NVMe targets

type NVMeVolumeInfo

type NVMeVolumeInfo struct {
	Targets []NVMeTargetInfo
	WWN     string
}

NVMeVolumeInfo - placeholder for NVMe volume

type RDMVolumeInfo

type RDMVolumeInfo struct {
	Targets []FCTargetInfo
	Lun     int
	WWN     string
}

RDMVolumeInfo has request info for RDM device

type Tracer

type Tracer = tracer.Tracer

Tracer defines tracing interface used

Directories

Path Synopsis
internal
logger
Package logger is a generated GoMock package.
Package logger is a generated GoMock package.
mockhelper
Package mockhelper is a generated GoMock package.
Package mockhelper is a generated GoMock package.
multipath
Package multipath is a generated GoMock package.
Package multipath is a generated GoMock package.
powerpath
Package powerpath is a generated GoMock package.
Package powerpath is a generated GoMock package.
scsi
Package scsi is a generated GoMock package.
Package scsi is a generated GoMock package.
tracer
Package tracer is a generated GoMock package.
Package tracer 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