volume

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusSuccess represents the successful completion of command.
	StatusSuccess = "Success"
	// StatusFailed represents that the command failed.
	StatusFailure = "Failed"
	// StatusNotSupported represents that the command is not supported.
	StatusNotSupported = "Not supported"
)
View Source
const (
	CapabilityAttach = "attach"
)

Variables

This section is empty.

Functions

func PathExists

func PathExists(path string) (bool, error)

PathExists returns true if the specified path exists.

func UnmountPath

func UnmountPath(mountPath string, mounter mount.Interface) error

UnmountPath is a common unmount routine that unmounts the given path and deletes the remaining directory if successful.

Types

type AliyunDriver

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

func (*AliyunDriver) AddDiskTag added in v1.2.0

func (d *AliyunDriver) AddDiskTag(diskId string, volumeName string) error

func (*AliyunDriver) Attach

func (d *AliyunDriver) Attach(options Options, node string) *DriverStatus

func (*AliyunDriver) Detach

func (d *AliyunDriver) Detach(device string, node string) *DriverStatus

func (*AliyunDriver) GetVolumeName

func (d *AliyunDriver) GetVolumeName(options Options) *DriverStatus

func (*AliyunDriver) Init

func (d *AliyunDriver) Init() *DriverStatus

func (*AliyunDriver) IsAttached

func (d *AliyunDriver) IsAttached(options Options, node string) *DriverStatus

func (*AliyunDriver) Mount

func (d *AliyunDriver) Mount(dir string, options Options) *DriverStatus

func (*AliyunDriver) MountDevice

func (d *AliyunDriver) MountDevice(dir string, device string, options Options) *DriverStatus

func (*AliyunDriver) Unmount

func (d *AliyunDriver) Unmount(dir string) *DriverStatus

func (*AliyunDriver) UnmountDevice

func (d *AliyunDriver) UnmountDevice(dir string) *DriverStatus

func (*AliyunDriver) WaitForAttach

func (d *AliyunDriver) WaitForAttach(device string, options Options) *DriverStatus

type Driver

type Driver interface {
	Init() *DriverStatus
	GetVolumeName(options Options) *DriverStatus
	Attach(options Options, node string) *DriverStatus
	Detach(device string, node string) *DriverStatus
	WaitForAttach(device string, options Options) *DriverStatus
	IsAttached(options Options, node string) *DriverStatus
	MountDevice(dir string, device string, options Options) *DriverStatus
	UnmountDevice(dir string) *DriverStatus
	Mount(dir string, options Options) *DriverStatus
	Unmount(dir string) *DriverStatus
}

func NewDriver

func NewDriver(c *DriverConfig) Driver

func NewFakeDriver

func NewFakeDriver() Driver

type DriverCapabilities added in v1.2.0

type DriverCapabilities map[string]bool

type DriverConfig added in v1.2.0

type DriverConfig struct {
	Region    string `json:"region"`
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Cluster   string `json:"cluster"`
}

func (*DriverConfig) HasAliyunCredentials added in v1.2.0

func (c *DriverConfig) HasAliyunCredentials() bool

type DriverStatus

type DriverStatus struct {
	// Status of the callout. One of "Success", "Failure" or "Not supported".
	Status string `json:"status"`
	// Reason for success/failure.
	Message string `json:"message,omitempty"`
	// Path to the device attached. This field is valid only for attach calls.
	// ie: /dev/sdx
	DevicePath string `json:"device,omitempty"`
	// Cluster wide unique name of the volume.
	VolumeName string `json:"volumeName,omitempty"`
	// Represents volume is attached on the node
	Attached bool `json:"attached,omitempty"`
	// Driver capabilities
	Capabilities DriverCapabilities `json:"capabilities,omitempty"`
}

DriverStatus represents the return value of the driver callout.

func NewDriverError

func NewDriverError(err error) *DriverStatus

func NewDriverNotSupported

func NewDriverNotSupported(err error) *DriverStatus

type FakeDriver

type FakeDriver struct{}

func (*FakeDriver) Attach

func (d *FakeDriver) Attach(options Options, node string) *DriverStatus

func (*FakeDriver) Detach

func (d *FakeDriver) Detach(device string, node string) *DriverStatus

func (*FakeDriver) GetVolumeName

func (d *FakeDriver) GetVolumeName(options Options) *DriverStatus

func (*FakeDriver) Init

func (d *FakeDriver) Init() *DriverStatus

func (*FakeDriver) IsAttached

func (d *FakeDriver) IsAttached(options Options, node string) *DriverStatus

func (*FakeDriver) Mount

func (d *FakeDriver) Mount(dir string, options Options) *DriverStatus

func (*FakeDriver) MountDevice

func (d *FakeDriver) MountDevice(dir string, device string, options Options) *DriverStatus

func (*FakeDriver) Unmount

func (d *FakeDriver) Unmount(dir string) *DriverStatus

func (*FakeDriver) UnmountDevice

func (d *FakeDriver) UnmountDevice(dir string) *DriverStatus

func (*FakeDriver) WaitForAttach

func (d *FakeDriver) WaitForAttach(device string, options Options) *DriverStatus

type Options

type Options map[string]interface{}

func ParseOptions

func ParseOptions(s string) (Options, error)

func (Options) Check added in v1.2.0

func (o Options) Check() error

func (Options) DiskId

func (o Options) DiskId() string

Jump to

Keyboard shortcuts

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