iscsi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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

This section is empty.

Variables

This section is empty.

Functions

func AttachISCSIVolume

func AttachISCSIVolume(name, mountpoint string, publishInfo *VolumePublishInfo, logger *logrus.Entry) error

Attach the volume to the local host. This method must be able to accomplish its task using only the data passed in. It may be assumed that this method always runs on the host to which the volume will be attached. If the mountpoint parameter is specified, the volume will be mounted. The device path is set on the in-out publishInfo parameter so that it may be mounted later instead.

func ConsistentRead

func ConsistentRead(filename string, attempts int) ([]byte, error)

ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc that are larger than page size and kernel may modify them between individual read() syscalls.

func EnsureISCSISession

func EnsureISCSISession(hostDataIP string) error

func EnsureISCSISessions

func EnsureISCSISessions(hostDataIPs []string) error

func GetDeviceNameFromMount

func GetDeviceNameFromMount(mountpath string) (string, int, error)

func GetInitiatorIqns

func GetInitiatorIqns() ([]string, error)

GetInitiatorIqns returns parsed contents of /etc/iscsi/initiatorname.iscsi

func ISCSIDisableDelete

func ISCSIDisableDelete(targetIQN, targetPortal string) error

ISCSIDisableDelete logs out from the supplied target and removes the iSCSI device.

func ISCSISupported

func ISCSISupported() bool

ISCSISupported returns true if iscsiadm is installed and in the PATH.

func ISCSITargetHasMountedDevice

func ISCSITargetHasMountedDevice(targetIQN string) (bool, error)

ISCSITargetHasMountedDevice returns true if this host has any mounted devices on the specified target.

func IsLikelyNotMountPoint

func IsLikelyNotMountPoint(mountpoint string) (bool, error)

IsLikelyNotMountPoint determines if a directory is not a mountpoint.

func MountDevice

func MountDevice(device, mountpoint, options string) (err error)

MountDevice attaches the supplied device at the supplied location. Use this for iSCSI devices.

func PathExists

func PathExists(path string) bool

PathExists returns true if the file/directory at the specified path exists, false otherwise or if an error occurs.

func PrepareDeviceAtMountPathForRemoval

func PrepareDeviceAtMountPathForRemoval(mountpoint string, unmount bool, logger *logrus.Entry) error

PrepareDeviceAtMountPathForRemoval informs Linux that a device will be removed.

func PrepareDeviceForRemoval

func PrepareDeviceForRemoval(lunID int, iSCSINodeName string)

PrepareDeviceForRemoval informs Linux that a device will be removed.

func Umount

func Umount(mountpoint string) (err error)

Umount detaches from the supplied location.

Types

type ControllerServer

type ControllerServer struct {
	Logger *logrus.Entry
}

func (*ControllerServer) ControllerExpandVolume

func (*ControllerServer) ControllerGetCapabilities

ControllerGetCapabilities - controller capabilities

func (*ControllerServer) ControllerPublishVolume

func (*ControllerServer) CreateSnapshot

func (*ControllerServer) CreateVolume

func (*ControllerServer) DeleteSnapshot

func (*ControllerServer) DeleteVolume

func (*ControllerServer) GetCapacity

GetCapacity - not implemented

func (*ControllerServer) ListSnapshots

func (*ControllerServer) ListVolumes

type DFInfo

type DFInfo struct {
	Target string
	Source string
}

DFInfo data structure for wrapping the parsed output from the 'df' command

func GetDFOutput

func GetDFOutput() ([]DFInfo, error)

GetDFOutput returns parsed DF output

type ISCSIDiscoveryInfo

type ISCSIDiscoveryInfo struct {
	Portal     string
	PortalIP   string
	TargetName string
}

ISCSIDiscoveryInfo contains information about discovered iSCSI targets.

type ISCSISessionInfo

type ISCSISessionInfo struct {
	SID        string
	Portal     string
	PortalIP   string
	TargetName string
}

ISCSISessionInfo contains information about iSCSI sessions.

type IscsiAccessInfo

type IscsiAccessInfo struct {
	IscsiTargetPortal    string   `json:"iscsiTargetPortal,omitempty"`
	IscsiPortals         []string `json:"iscsiPortals,omitempty"`
	IscsiTargetIQN       string   `json:"iscsiTargetIqn,omitempty"`
	IscsiLunNumber       int32    `json:"iscsiLunNumber,omitempty"`
	IscsiInterface       string   `json:"iscsiInterface,omitempty"`
	IscsiIgroup          string   `json:"iscsiIgroup,omitempty"`
	IscsiVAGs            []int64  `json:"iscsiVags,omitempty"`
	IscsiUsername        string   `json:"iscsiUsername,omitempty"`
	IscsiInitiatorSecret string   `json:"iscsiInitiatorSecret,omitempty"`
	IscsiTargetSecret    string   `json:"iscsiTargetSecret,omitempty"`
}

type MountPoint

type MountPoint struct {
	Device string
	Path   string
	Type   string
	Opts   []string
	Freq   int
	Pass   int
}

This represents a single line in /proc/mounts or /etc/fstab.

type NodeServer

type NodeServer struct {
	NodeID string
	Logger *logrus.Entry
}

func (*NodeServer) NodeExpandVolume

func (*NodeServer) NodeGetCapabilities

func (*NodeServer) NodeGetInfo

func (*NodeServer) NodeGetVolumeStats

func (*NodeServer) NodePublishVolume

func (*NodeServer) NodeStageVolume

func (*NodeServer) NodeUnpublishVolume

func (*NodeServer) NodeUnstageVolume

type ScsiDeviceInfo

type ScsiDeviceInfo struct {
	Host            string
	Channel         string
	Target          string
	LUN             string
	Devices         []string
	MultipathDevice string
	Filesystem      string
	IQN             string
	HostSessionMap  map[int]int
}

ScsiDeviceInfo contains information about SCSI devices

func GetDeviceInfoForMountPath

func GetDeviceInfoForMountPath(mountpath string) (*ScsiDeviceInfo, error)

getDeviceInfoForMountPath discovers the device that is currently mounted at the specified mount path. It uses the ScsiDeviceInfo struct so that it may return a multipath device (if any) plus one or more underlying physical devices.

func GetISCSIDevices

func GetISCSIDevices() ([]*ScsiDeviceInfo, error)

GetISCSIDevices returns a list of iSCSI devices that are attached to (but not necessarily mounted on) this host.

func GetMountedISCSIDevices

func GetMountedISCSIDevices() ([]*ScsiDeviceInfo, error)

GetMountedISCSIDevices returns a list of iSCSI devices that are *mounted* on this host.

type VolumeAccessInfo

type VolumeAccessInfo struct {
	IscsiAccessInfo
	MountOptions string `json:"mountOptions,omitempty"`
}

type VolumePublishInfo

type VolumePublishInfo struct {
	Localhost      bool     `json:"localhost,omitempty"`
	HostIQN        []string `json:"hostIQN,omitempty"`
	HostIP         []string `json:"hostIP,omitempty"`
	HostName       string   `json:"hostName,omitempty"`
	FilesystemType string   `json:"fstype,omitempty"`
	UseCHAP        bool     `json:"useCHAP,omitempty"`
	SharedTarget   bool     `json:"sharedTarget,omitempty"`
	DevicePath     string   `json:"devicePath,omitempty"`
	VolumeAccessInfo
}

Jump to

Keyboard shortcuts

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