sas

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2022 The Kubernetes 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 Attach

func Attach(ctx context.Context, c *Connector, io ioHandler) (string, error)

Attach attempts to attach a sas volume to a node using the provided Connector info

func Detach

func Detach(ctx context.Context, devicePath string, io ioHandler) error

Detach performs a detach operation on a volume

func FindDiskById added in v1.0.2

func FindDiskById(logger klog.Logger, wwn string, io ioHandler) (string, []string)

FindDiskById: given a wwn of the storage volume, find the multipath device and associated scsi devices

func FindLinkedDevicesOnMultipath added in v1.0.0

func FindLinkedDevicesOnMultipath(logger klog.Logger, dm string, io ioHandler) []string

FindLinkedDevicesOnMultipath: returns all slaves on the multipath device given the device path

func ResizeMultipathDevice

func ResizeMultipathDevice(ctx context.Context, devicePath string) error

ResizeMultipathDevice: resize a multipath device based on its underlying devices

Types

type Connector

type Connector struct {
	VolumeName    string    `json:"volume_name"`    // Passed In: A name given to the storage volume by the provisioner, for debugging.
	VolumeWWN     string    `json:"volume_wwn"`     // Passed In: 128 bit world wide name given to storage volume.
	Multipath     bool      `json:"multipath"`      // Discovered: True indicates that OSPathName is a multipath device (dm-#), otherwise it is a regular device (/dev/sdX)
	OSPathName    string    `json:"os_device_path"` // Discovered: The OS path to the storage volume WWN, for example /dev/sdb or /dev/dm-5
	OSDevicePaths []string  `json:"scsi_devices"`   // Discovered: The OS path(s) to the storage volume WWN, for example ["/dev/sdb"] or ["/dev/sdb", "/dev/sdc"]
	IoHandler     ioHandler // Passed In
}

Connector provides a struct to hold all of the needed parameters to make our SAS connection

func GetConnectorFromFile

func GetConnectorFromFile(filePath string) (*Connector, error)

GetConnectorFromFile attempts to create a Connector using the specified json file (ie /var/lib/pfile/myConnector.json)

func (*Connector) Persist

func (c *Connector) Persist(ctx context.Context, filePath string) error

Persist persists the Connector to the specified file (ie /var/lib/pfile/myConnector.json)

type OSioHandler

type OSioHandler struct{}

OSioHandler is a wrapper that includes all the necessary io functions used for (Should be used as default io handler)

func (handler *OSioHandler) EvalSymlinks(path string) (string, error)

EvalSymlinks calls EvalSymlinks from filepath package

func (*OSioHandler) Lstat

func (handler *OSioHandler) Lstat(name string) (os.FileInfo, error)

Lstat calls the Lstat function from os package

func (*OSioHandler) ReadDir

func (handler *OSioHandler) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir calls the ReadDir function from ioutil package

func (*OSioHandler) WriteFile

func (handler *OSioHandler) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile calls WriteFile from ioutil package

Jump to

Keyboard shortcuts

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