nfs

package
v1.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUID = 1000
)

Variables

This section is empty.

Functions

func VolumeJoin

func VolumeJoin(op trace.Operation, handle *exec.Handle, volume *storage.Volume, mountPath string, diskOpts map[string]string) (*exec.Handle, error)

Types

type MountServer

type MountServer interface {
	// Mount executes the mount program on the Target.
	Mount(op trace.Operation) (Target, error)

	// Unmount terminates the Mount on the Target.
	Unmount(op trace.Operation) error

	URL() (*url.URL, error)
}

MountServer is an interface used to communicate with network attached storage.

type NfsMount

type NfsMount struct {
	// Hostname is the name to authenticate with to the target as
	Hostname string

	// UID and GID are the user id and group id to authenticate with the target
	UID, GID uint32

	// The URL (host + path) of the NFS server and target path
	TargetURL *url.URL
	// contains filtered or unexported fields
}

NfsMount is used to wrap a MountServer to do the Mount()/Unmount() and Close()

func NewMount

func NewMount(t *url.URL, hostname string, uid, gid uint32) *NfsMount

func (*NfsMount) Mount

func (m *NfsMount) Mount(op trace.Operation) (Target, error)

func (*NfsMount) URL

func (m *NfsMount) URL() (*url.URL, error)

func (*NfsMount) Unmount

func (m *NfsMount) Unmount(op trace.Operation) error

type Target

type Target interface {
	// Open opens a file on the Target in RD_ONLY
	Open(path string) (io.ReadCloser, error)

	// OpenFile opens a file on the Target with the given mode
	OpenFile(path string, perm os.FileMode) (io.ReadWriteCloser, error)

	// Mkdir creates a directory at the given path
	Mkdir(path string, perm os.FileMode) ([]byte, error)

	// RemoveAll deletes Directory recursively
	RemoveAll(Path string) error

	// ReadDir reads the dirents in the given directory
	ReadDir(path string) ([]os.FileInfo, error)

	// Lookup reads os.FileInfo for the given path
	Lookup(path string) (os.FileInfo, []byte, error)
}

Target is the filesystem interface for performing actions against attached storage.

type Volume

type Volume struct {

	// VS Host + Path to the actual volume
	Host *url.URL

	// Path of the volume from the volumestore target
	Path string
}

Volume identifies an NFS based volume

func NewVolume

func NewVolume(host *url.URL, NFSPath string) Volume

func (Volume) DiskPath

func (v Volume) DiskPath() url.URL

DiskPath includes the url to the nfs directory for the container to mount,

func (Volume) MountPath

func (v Volume) MountPath() (string, error)

type VolumeStore

type VolumeStore struct {
	// volume store name
	Name string

	// Service is the interface to the nfs target.
	Service MountServer

	// Service selflink to volume store.
	SelfLink *url.URL

	// Archiver defines WriteArchive and Export interface methods
	archive.Archiver
}

VolumeStore this is nfs related volume store definition

func NewVolumeStore

func NewVolumeStore(op trace.Operation, storeName string, mount MountServer) (*VolumeStore, error)

func (*VolumeStore) Export

func (v *VolumeStore) Export(op trace.Operation, id, ancestor string, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

Export creates and returns a tar archive containing data found between an nfs layer one or all of its ancestors

func (*VolumeStore) Import

func (v *VolumeStore) Import(op trace.Operation, id string, spec *archive.FilterSpec, tarStream io.ReadCloser) error

Import takes a tar archive stream and extracts it into the target volume

func (*VolumeStore) NewDataSink

func (v *VolumeStore) NewDataSink(op trace.Operation, id string) (storage.DataSink, error)

func (*VolumeStore) NewDataSource

func (v *VolumeStore) NewDataSource(op trace.Operation, id string) (storage.DataSource, error)

func (*VolumeStore) Owners

func (v *VolumeStore) Owners(op trace.Operation, url *url.URL, filter func(vm *mo.VirtualMachine) bool) ([]*vm.VirtualMachine, error)

func (*VolumeStore) URL

func (v *VolumeStore) URL(op trace.Operation, id string) (*url.URL, error)

func (*VolumeStore) VolumeCreate

func (v *VolumeStore) VolumeCreate(op trace.Operation, ID string, store *url.URL, capacityKB uint64, info map[string][]byte) (*storage.Volume, error)

Creates a volume directory and volume object for NFS based volumes

func (*VolumeStore) VolumeDestroy

func (v *VolumeStore) VolumeDestroy(op trace.Operation, vol *storage.Volume) error

VolumeDestroy Removes a volume and all of its contents from the nfs store. We already know via the cache if it is in use.

func (*VolumeStore) VolumesList

func (v *VolumeStore) VolumesList(op trace.Operation) ([]*storage.Volume, error)

Jump to

Keyboard shortcuts

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