connector

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

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 (
	ISCSIPathPattern = "/dev/disk/by-path/ip-%s-iscsi-%s-lun-%d"
)

Variables

This section is empty.

Functions

func SetExecutor

func SetExecutor(e exec.Interface)

func SetLogger

func SetLogger(l *logrus.Logger)

Types

type ConnectionProperty

type ConnectionProperty struct {
	TargetIqns      []string
	TargetPortals   []string
	TargetLuns      []int
	StorageProtocol string
	AccessMode      StringEnum
}

func (ConnectionProperty) IsEmpty

func (prop ConnectionProperty) IsEmpty() error

Validate whether the ConnectionProperty is empty

type HostInfo

type HostInfo struct {
	Initiator string
	Ip        string
	Hostname  string
	OSType    string
}

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(args []string) (HostInfo, error)

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(args []string) (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(args []string) (HostInfo, error)
	ConnectVolume(connectionProperty ConnectionProperty) (VolumeInfo, error)
	DisconnectVolume(connectionProperty ConnectionProperty) error
	ExtendVolume(connectionProperty ConnectionProperty) error
}

type OPERATION_ENUM

type OPERATION_ENUM StringEnum
const (
	OPERATION_NEW            OPERATION_ENUM = "new"
	OPERATION_DELETE         OPERATION_ENUM = "new"
	OPERATION_UPDATE         OPERATION_ENUM = "update"
	OPERATION_SHOW           OPERATION_ENUM = "show"
	OPERATION_NON_PERSISTENT OPERATION_ENUM = "nonpersistent"
)

type StringEnum

type StringEnum string
const (
	READWRITE StringEnum = "rw"
	READONLY  StringEnum = "ro"
)
const (
	ISCSI_PROTOCOL StringEnum = "iscsi"
	FC_PROTOCOL    StringEnum = "fc"
)

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