zfs

package
v0.0.0-...-c283e9f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: BSD-3-Clause Imports: 18 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultDatasetName = "flynn-default"

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 specifying use of datasets in those zpools those rather than this fallback mechanism.

func DefaultMakeDev

func DefaultMakeDev(volPath string, log log15.Logger) *MakeDev

type Provider

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

func (*Provider) CreateSnapshot

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

func (*Provider) DestroyVolume

func (p *Provider) DestroyVolume(v volume.Volume) error

func (*Provider) ForkVolume

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

func (*Provider) ImportFilesystem

func (p *Provider) ImportFilesystem(fs *volume.Filesystem) (volume.Volume, error)

func (*Provider) Kind

func (p *Provider) Kind() string

func (*Provider) ListHaves

func (p *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 (p *Provider) MarshalGlobalState() (json.RawMessage, error)

func (*Provider) MarshalVolumeState

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

func (*Provider) NewVolume

func (p *Provider) NewVolume(info *volume.Info) (volume.Volume, error)

func (*Provider) ReceiveSnapshot

func (p *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 (p *Provider) RestoreVolumeState(volInfo *volume.Info, data json.RawMessage) (volume.Volume, error)

func (*Provider) SendSnapshot

func (p *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