linux

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: 9 Imported by: 2

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.

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.

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

This section is empty.

Variables

This section is empty.

Functions

func CheckDevice

func CheckDevice(path string) bool

Check if the path is a multipath device

func CheckReadWrite

func CheckReadWrite(path string, wwn string) bool

NAME RO sdb 0 └─36006016003b03a00da41ad58e6ab1cc0 0 sdd 0 └─36006016015e03a00bea7c7588c91d581 0 sde 0 sdf 0 └─36006016003b03a00da41ad58e6ab1cc0 0 sdg 0 └─36006016015e03a00bea7c7588c91d581 0 sr0 0 vda 0 └─vda1 0

func ExtendDevice

func ExtendDevice(path string) (int, error)

Commands example: echo 1 > /sys/bus/scsi/drivers/sd/9:0:0:6/rescan

func FindMpathByPath

func FindMpathByPath(path string) string

Use multipath -l <path> to discover multipath device Valid <path> could be WWN or /dev/sdb like path

func FindMpathByWwn

func FindMpathByWwn(wwn string) string

Return the multipath by wwn 1) When multipath friendly names are ON: a device file will show up in /dev/disk/by-id/dm-uuid-mpath-<WWN> /dev/disk/by-id/dm-name-mpath<N> /dev/disk/by-id/scsi-mpath<N> /dev/mapper/mpath<N>

2) When multipath friendly names are OFF: /dev/disk/by-id/dm-uuid-mpath-<WWN> /dev/disk/by-id/scsi-<WWN> /dev/mapper/<WWN>

func FindMultipathByWwn

func FindMultipathByWwn(wwn string) model.Multipath

func FlushDeviceIO

func FlushDeviceIO(path string) error

path = "/dev/sdb" or " "/dev/disk/by-path/ip-10.244.213.177:3260-iscsi-iqn.1992-04.com.emc:cx.fnm00150600267.a0-lun-10"

func FlushPath

func FlushPath(path string) error

Flush device(s) via multipath -f <device>/-F

func GetDeviceInfo

func GetDeviceInfo(path string) (model.DeviceInfo, error)

output: sudo sg_scan /dev/disk/by-path/pci-0000:05:00.1-fc-0x5006016d09200925-lun-0 /dev/disk/by-path/pci-0000:05:00.1-fc-0x5006016d09200925-lun-0: scsi9 channel=0 id=0 lun=0 [em]

func GetDeviceSize

func GetDeviceSize(path string) int

Get block device size

func GetFCHBA

func GetFCHBA() []model.HBA

func GetFcWwnn added in v0.1.1

func GetFcWwnn() []string

func GetFcWwpn added in v0.1.1

func GetFcWwpn() []string

func GetWWN

func GetWWN(path string) string

func IsFCDevice

func IsFCDevice(device string) bool

func IsFCSupport

func IsFCSupport() bool

func IsMultipathEnabled

func IsMultipathEnabled() bool

func Reconfigure

func Reconfigure() error

Reconfigure multipath

func Reload

func Reload() error

Force multipath reloads devices via multipath -r

func RemoveSCSIDevice

func RemoveSCSIDevice(path string)

path = "/dev/sdb" or "sdb" Use echo 1 > /sys/block/%s/device/delete to force delete the device

func RescanHosts

func RescanHosts(allHct [][]int, lunID int)

Do a more specific scan instead of a wildcard

func ResizeMpath

func ResizeMpath(mpathId string) error

func ScanSCSIBus

func ScanSCSIBus(path string, content string) error

use echo "c t l" > to /sys/class/scsi_host/%s/scan

func SetExecutor

func SetExecutor(e exec.Interface)

func SetLogger

func SetLogger(l *logrus.Logger)

Types

This section is empty.

Jump to

Keyboard shortcuts

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