mountmanager

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeMounter

type FakeMounter struct {
}

func CreateFakeMounter

func CreateFakeMounter() (*FakeMounter, error)

func (*FakeMounter) DoMount

func (m *FakeMounter) DoMount(source string, target string, fstype string, options []string) error

func (*FakeMounter) FormatAndMount

func (m *FakeMounter) FormatAndMount(source string, target string, fstype string, options []string) error

func (*FakeMounter) GetDiskByIdPaths

func (m *FakeMounter) GetDiskByIdPaths(pdName string, partition string) []string

func (*FakeMounter) IsLikelyNotMountPoint

func (m *FakeMounter) IsLikelyNotMountPoint(file string) (bool, error)

func (*FakeMounter) MkdirAll

func (m *FakeMounter) MkdirAll(path string, perm os.FileMode) error

func (*FakeMounter) Remove

func (m *FakeMounter) Remove(name string) error

func (*FakeMounter) UnmountVolume

func (m *FakeMounter) UnmountVolume(targetPath string) (string, error)

func (*FakeMounter) VerifyDevicePath

func (m *FakeMounter) VerifyDevicePath(devicePaths []string) (string, error)

type GCEMounter

type GCEMounter struct {
}

func CreateMounter

func CreateMounter() (*GCEMounter, error)

func (*GCEMounter) DoMount

func (m *GCEMounter) DoMount(source string, target string, fstype string, options []string) error

m.DoMount runs the mount command. mounterPath is the path to mounter binary if containerized mounter is used.

func (*GCEMounter) FormatAndMount

func (m *GCEMounter) FormatAndMount(source string, target string, fstype string, options []string) error

formatAndMount uses unix utils to format and mount the given disk

func (*GCEMounter) GetDiskByIdPaths

func (m *GCEMounter) GetDiskByIdPaths(pdName string, partition string) []string

Returns list of all /dev/disk/by-id/* paths for given PD.

func (*GCEMounter) IsLikelyNotMountPoint

func (m *GCEMounter) IsLikelyNotMountPoint(file string) (bool, error)

IsLikelyNotMountPoint determines if a directory is not a mountpoint. It is fast but not necessarily ALWAYS correct. If the path is in fact a bind mount from one part of a mount to another it will not be detected. mkdir /tmp/a /tmp/b; mount --bin /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b") will return true. When in fact /tmp/b is a mount point. If this situation if of interest to you, don't use this function...

func (*GCEMounter) MkdirAll

func (m *GCEMounter) MkdirAll(path string, perm os.FileMode) error

func (*GCEMounter) Remove

func (m *GCEMounter) Remove(name string) error

func (*GCEMounter) UnmountVolume

func (m *GCEMounter) UnmountVolume(targetPath string) (string, error)

func (*GCEMounter) VerifyDevicePath

func (m *GCEMounter) VerifyDevicePath(devicePaths []string) (string, error)

Returns the first path that exists, or empty string if none exist.

type Mounter

type Mounter interface {
	DoMount(source string, target string, fstype string, options []string) error
	FormatAndMount(source string, target string, fstype string, options []string) error
	IsLikelyNotMountPoint(file string) (bool, error)
	UnmountVolume(targetPath string) (string, error)
	GetDiskByIdPaths(pdName string, partition string) []string
	VerifyDevicePath(devicePaths []string) (string, error)
	MkdirAll(path string, perm os.FileMode) error
	Remove(name string) error
}

TODO(dyzz): Should be able to clean up this interface some more. Not everything here needs to be here

Jump to

Keyboard shortcuts

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