zfs

package
v0.0.0-...-1d4c075 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2016 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDatasetBusyError

func IsDatasetBusyError(e error) bool

"dataset is busy" errors from ZFS typically indicate that there are open files in that dataset mount.

func IsDatasetHasChildrenError

func IsDatasetHasChildrenError(e error) bool

"has children" errors from ZFS occur when removing a volume that has snapshots. ZFS requires snapshots of a volume to be deleted first.

func NewProvider

func NewProvider(config *ProviderConfig) (volume.Provider, error)

Types

type Logger

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

func (*Logger) Log

func (l *Logger) Log(msg []string)

type MakeDev

type MakeDev struct {
	BackingFilename string `json:"filename"`
	Size            int64  `json:"size"`
}

Describes parameters for creating a zpool.

Currently this only supports file-type vdevs; be aware that these are convenient, but may have limited performance. Advanced users should consider configuring a zpool using block devices directly, and specifing use of datasets in those zpools those rather than this fallback mechanism.

type Provider

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

func (*Provider) CreateSnapshot

func (b *Provider) CreateSnapshot(vol volume.Volume) (volume.Volume, error)

func (*Provider) DestroyVolume

func (b *Provider) DestroyVolume(vol volume.Volume) error

func (*Provider) ForkVolume

func (b *Provider) ForkVolume(vol volume.Volume) (volume.Volume, error)

func (Provider) Kind

func (b Provider) Kind() string

func (*Provider) ListHaves

func (b *Provider) ListHaves(vol volume.Volume) ([]json.RawMessage, error)

Returns the set of snapshot UIDs available in this volume's backing dataset.

func (*Provider) MarshalGlobalState

func (b *Provider) MarshalGlobalState() (json.RawMessage, error)

func (*Provider) MarshalVolumeState

func (b *Provider) MarshalVolumeState(volumeID string) (json.RawMessage, error)

func (*Provider) NewVolume

func (b *Provider) NewVolume() (volume.Volume, error)

func (*Provider) ReceiveSnapshot

func (b *Provider) ReceiveSnapshot(vol volume.Volume, input io.Reader) (volume.Volume, error)

ReceiveSnapshot both accepts a snapshotted filesystem as a byte stream, and applies that state to the given `vol` (i.e., if this were git, it's like `git fetch && git pull` at the same time; regretably, it's pretty hard to get zfs to separate those operations). If there are local working changes in the volume, they will be overwritten.

In addition to the given volume being mutated on disk, a reference to the new snapshot will be returned (this can be used for cleanup, though be aware that with zfs, removing snapshots may impact the ability to use incremental deltas when receiving future snapshots).

Also note that ZFS is *extremely* picky about receiving snapshots; in addition to obvious failure modes like an incremental snapshot with insufficient data, the following complications apply: - Sending an incremental snapshot with too much history will fail. - Sending a full snapshot to a volume with any other snapshots will fail. In the former case, you can renegociate; in the latter, you will have to either *destroy snapshots* or make a new volume.

func (*Provider) RestoreVolumeState

func (b *Provider) RestoreVolumeState(volInfo *volume.Info, data json.RawMessage) (volume.Volume, error)

func (*Provider) SendSnapshot

func (b *Provider) SendSnapshot(vol volume.Volume, haves []json.RawMessage, output io.Writer) error

type ProviderConfig

type ProviderConfig struct {
	// DatasetName specifies the zfs dataset this provider will create volumes under.
	//
	// If it doesn't specify an existing dataset, and `MakeDev` parameters have
	// been provided, those will be followed to create a zpool; otherwise
	// provider creation will fail.
	DatasetName string `json:"dataset"`

	Make *MakeDev `json:"makedev,omitempty"`

	// WorkingDir specifies the working directory zfs will use to expose mounts.
	// A default will be chosen if left blank.
	WorkingDir string `json:"working_dir"`
}

Describes zfs config used at provider setup time.

`volume.ProviderSpec.Config` is deserialized to this for zfs.

Also is the output of `MarshalGlobalState`.

Jump to

Keyboard shortcuts

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