Documentation
¶
Index ¶
- Constants
- func FilesystemCreateWithArgs(l []string) funcopt.O
- func FilesystemCreateWithNode(s string) funcopt.O
- func FilesystemCreateWithQuota(size *int64) funcopt.O
- func FilesystemCreateWithRefQuota(size *int64) funcopt.O
- func FilesystemCreateWithRefReservation(size *int64) funcopt.O
- func FilesystemCreateWithReservation(size *int64) funcopt.O
- func FilesystemDestroyWithNode(s string) funcopt.O
- func FilesystemDestroyWithRecurse(v bool) funcopt.O
- func FilesystemDestroyWithRemoveSnapshots(v bool) funcopt.O
- func FilesystemDestroyWithTryImmediate(v bool) funcopt.O
- func FilesystemMountWithOverlay(v bool) funcopt.O
- func FilesystemRenameWithNode(s string) funcopt.O
- func FilesystemRenameWithRecurse(v bool) funcopt.O
- func FilesystemSnapshotWithArgs(l []string) funcopt.O
- func FilesystemSnapshotWithRecursive(v bool) funcopt.O
- func FilesystemUmountWithForce(v bool) funcopt.O
- func IsCapable() bool
- func ListWithLogger(l *plog.Logger) funcopt.O
- func ListWithNames(l ...string) funcopt.O
- func ListWithOrderBy(l ...string) funcopt.O
- func ListWithOrderReverse() funcopt.O
- func ListWithTypes(l ...DatasetType) funcopt.O
- func PoolCreateWithArgs(l []string) funcopt.O
- func PoolCreateWithVDevs(l []string) funcopt.O
- func PoolDestroyWithForce() funcopt.O
- func PoolExportWithForce() funcopt.O
- func PoolImportWithCacheFile(s string) funcopt.O
- func PoolImportWithDevice(s string) funcopt.O
- func PoolImportWithForce() funcopt.O
- func PoolImportWithOption(option, value string) funcopt.O
- func PoolImportWithQuiet() funcopt.O
- func PoolStatusWithVerbose() funcopt.O
- func VolCreateWithArgs(l []string) funcopt.O
- func VolCreateWithBlockSize(size uint64) funcopt.O
- func VolCreateWithSize(size uint64) funcopt.O
- func VolDestroyWithBusyRetries(count int) funcopt.O
- func VolDestroyWithForce() funcopt.O
- func VolDestroyWithRecursive() funcopt.O
- type Dataset
- type DatasetName
- type DatasetType
- type DatasetTypes
- type Filesystem
- func (t Filesystem) BaseName() string
- func (t *Filesystem) Create(fopts ...funcopt.O) error
- func (t *Filesystem) Destroy(fopts ...funcopt.O) error
- func (t *Filesystem) Exists() (bool, error)
- func (t Filesystem) GetLog() *plog.Logger
- func (t Filesystem) GetName() string
- func (t *Filesystem) GetProperty(prop string) (string, error)
- func (t *Filesystem) Mount(fopts ...funcopt.O) error
- func (t Filesystem) PoolName() string
- func (t *Filesystem) Rename(dst string, fopts ...funcopt.O) error
- func (t *Filesystem) SetProperty(prop, value string) error
- func (t *Filesystem) Snapshot(fopts ...funcopt.O) error
- func (t *Filesystem) SnapshotExists() (bool, error)
- func (t *Filesystem) Umount(fopts ...funcopt.O) error
- type Filesystems
- type ListDatasetsOpts
- type Mover
- type Pool
- func (t *Pool) Create(fopts ...funcopt.O) error
- func (t *Pool) Destroy(fopts ...funcopt.O) error
- func (t *Pool) Exists(ctx context.Context) (bool, error)
- func (t *Pool) ExpandDevice(ctx context.Context, devpath string) error
- func (t *Pool) Export(fopts ...funcopt.O) error
- func (t *Pool) GetProperty(prop string) (string, error)
- func (t *Pool) Import(fopts ...funcopt.O) error
- func (t *Pool) ListVolumes(ctx context.Context, fopts ...funcopt.O) (Vols, error)
- func (t *Pool) SetProperty(prop, value string) error
- func (t *Pool) Status(ctx context.Context, fopts ...funcopt.O) (PoolStatusData, error)
- func (t *Pool) Usage(ctx context.Context, fopts ...funcopt.O) (PoolUsage, error)
- func (t *Pool) VDevDevices(ctx context.Context) (device.L, error)
- func (t *Pool) VDevPaths(ctx context.Context) ([]string, error)
- type PoolStatusData
- type PoolUsage
- type Vol
- func (t Vol) BaseName() string
- func (t *Vol) Create(fopts ...funcopt.O) error
- func (t *Vol) Destroy(fopts ...funcopt.O) error
- func (t *Vol) Exists() (bool, error)
- func (t Vol) GetLog() *plog.Logger
- func (t Vol) GetName() string
- func (t *Vol) GetProperty(prop string) (string, error)
- func (t Vol) PoolName() string
- func (t *Vol) SetProperty(prop, value string) error
- type Vols
Constants ¶
const ( // DatasetTypeFilesystem - file system dataset DatasetTypeFilesystem DatasetType = (1 << 0) // DatasetTypeSnapshot - snapshot of dataset DatasetTypeSnapshot = (1 << 1) // DatasetTypeVolume - volume (virtual block device) dataset DatasetTypeVolume = (1 << 2) // DatasetTypePool - pool dataset DatasetTypePool = (1 << 3) // DatasetTypeBookmark - bookmark dataset DatasetTypeBookmark = (1 << 4) )
const MoveSnapshotPrefix = "osvc_move_"
MoveSnapshotPrefix begins the name of the snapshots a move sends. The snapshots of other names, those of a sync.zfs among them, are serving an increment as a base, and are never destroyed by a move.
Variables ¶
This section is empty.
Functions ¶
func FilesystemCreateWithArgs ¶
FilesystemCreateWithArgs defines the shlex split list of arguments to prepend to the command.
func FilesystemCreateWithQuota ¶
FilesystemCreateWithQuota Limits the amount of space a dataset and its descendents can consume. This property enforces a hard limit on the amount of space used. This includes all space consumed by descendents, including file systems and snapshots. Setting a quota on a descendent of a dataset that already has a quota does not override the ancestor's quota, but rather imposes an additional limit.
func FilesystemCreateWithRefQuota ¶
FilesystemCreateWithRefQuota Limits the amount of space a dataset can consume. This property enforces a hard limit on the amount of space used. This hard limit does not include space used by descendents, including file systems and snapshots.
func FilesystemCreateWithRefReservation ¶
FilesystemCreateWithRefReservation is the minimum amount of space guaranteed to a dataset, not including its descendents. When the amount of space used is below this value, the dataset is treated as if it were taking up the amount of space specified by refreservation. The refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations.
If refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset.
func FilesystemCreateWithReservation ¶
FilesystemCreateWithReservation is the minimum amount of space guaranteed to a dataset and its descendents. When the amount of space used is below this value, the dataset is treated as if it were taking up the amount of space specified by its reservation. Reservations are accounted for in the parent datasets' space used, and count against the parent datasets' quotas and reservations.
func FilesystemDestroyWithRecurse ¶
FilesystemDestroyWithRecurse recursively destroys all clones of these snapshots, including the clones, snapshots, and children. If this flag is specified, the FilesystemDestroyWithTryImmediate flag will have no effect.
func FilesystemDestroyWithRemoveSnapshots ¶
FilesystemDestroyWithRemoveSnapshots, destroying a snapshot, destroys the snapshots of the same name in the descendant datasets too (zfs destroy -r).
func FilesystemDestroyWithTryImmediate ¶
FilesystemDestroyWithTryImmediate destroys immediately. If a snapshot cannot be destroyed now, mark it for deferred destruction.
func FilesystemMountWithOverlay ¶
FilesystemMountWithOverlay performs an overlay mount. Allows mounting in non-empty mountpoint.
func FilesystemRenameWithRecurse ¶
FilesystemRenameWithRecurse recursively renames all datasets
func FilesystemSnapshotWithArgs ¶
FilesystemSnapshotWithArgs defines the shlex split list of arguments to prepend to the command.
func FilesystemUmountWithForce ¶
FilesystemUmountWithForce forcefully unmounts the file system, even if it is currently in use. This option is not supported on Linux.
func ListWithNames ¶
func ListWithOrderBy ¶
func ListWithOrderReverse ¶
func ListWithTypes ¶
func ListWithTypes(l ...DatasetType) funcopt.O
func PoolCreateWithArgs ¶
PoolCreateWithArgs defines the shlex split list of arguments to prepend to the command.
func PoolCreateWithVDevs ¶
PoolCreateWithVDevs defines the list of block devices paths to add to the pool.
func PoolDestroyWithForce ¶
PoolDestroyWithForce forces any active datasets contained within the pool to be unmounted.
func PoolExportWithForce ¶
PoolExportWithForce forcefully unmounts all datasets, using the unmount -f command. This option is not supported on Linux.
func PoolImportWithCacheFile ¶
PoolImportWithCacheFile reads configuration from the given cachefile that was created with the cachefile pool property. This cachefile is used instead of searching for devices.
func PoolImportWithDevice ¶
PoolImportWithDevice uses device or searches for devices or files in dir. PoolImportWithDevice can be specified multiple times. PoolImportWithDevice incompatible with PoolImportWithCacheFile.
func PoolImportWithForce ¶
PoolImportWithForce forcefully unmounts all datasets, using the unmount -f command. This option is not supported on Linux.
func PoolImportWithOption ¶
PoolImportWithOption is a mount option to use when mounting datasets within the pool.
func PoolImportWithQuiet ¶
PoolImportWithQuiet sets debug level for error and output logging
func PoolStatusWithVerbose ¶
PoolStatusWithVerbose displays verbose data error information, printing out a complete list of all data errors since the last complete pool scrub.
func VolCreateWithArgs ¶
VolCreateWithArgs defines the shlex split list of arguments to prepend to the command.
func VolCreateWithBlockSize ¶
VolCreateWithBlockSize defines the block size of the volume in bytes
func VolCreateWithSize ¶
VolCreateWithSize defines the size of the volume in bytes
func VolDestroyWithBusyRetries ¶
VolDestroyWithBusyRetries is the number of retries when the destroy command reports "busy".
func VolDestroyWithForce ¶
VolDestroyWithForce forces an unmount of any file systems using the unmount -f command. This option has no effect on non-file systems or unmounted file systems.
func VolDestroyWithRecursive ¶
VolDestroyWithRecursive destroys the snapshots of the volume too, which zfs refuses to destroy it from under. The clones of one still refuse it, those being other volumes.
Types ¶
type DatasetName ¶
type DatasetName string
func (DatasetName) BaseName ¶
func (t DatasetName) BaseName() string
BaseName returns the basename extracted from a <pool>/<basename> string.
func (DatasetName) PoolName ¶
func (t DatasetName) PoolName() string
PoolName returns the pool name extracted from a <pool>/<basename> string.
func (DatasetName) String ¶
func (t DatasetName) String() string
String implements the stringer interface.
type DatasetType ¶
type DatasetType int32
func (DatasetType) String ¶
func (t DatasetType) String() string
type DatasetTypes ¶
type DatasetTypes []DatasetType
func (DatasetTypes) String ¶
func (t DatasetTypes) String() string
type Filesystem ¶
func (Filesystem) BaseName ¶
func (t Filesystem) BaseName() string
func (*Filesystem) Exists ¶
func (t *Filesystem) Exists() (bool, error)
func (Filesystem) GetLog ¶
func (t Filesystem) GetLog() *plog.Logger
func (Filesystem) GetName ¶
func (t Filesystem) GetName() string
func (*Filesystem) GetProperty ¶
func (t *Filesystem) GetProperty(prop string) (string, error)
GetProperty returns a dataset property value
func (Filesystem) PoolName ¶
func (t Filesystem) PoolName() string
func (*Filesystem) SetProperty ¶
func (t *Filesystem) SetProperty(prop, value string) error
SetProperty sets a dataset property value
func (*Filesystem) SnapshotExists ¶
func (t *Filesystem) SnapshotExists() (bool, error)
type Filesystems ¶
type Filesystems []Filesystem
func ListFilesystems ¶
func ListFilesystems(fopts ...funcopt.O) (Filesystems, error)
type ListDatasetsOpts ¶
type Mover ¶
type Mover struct {
// Name is the dataset to copy, the same on both nodes.
Name string
// Node is the node to copy it to, which Client is connected to.
Node string
Client *ssh.Client
Log *plog.Logger
// contains filtered or unexported fields
}
Mover copies a dataset, a filesystem or a volume, to the node a container is moving to, so the files and devices the container opens exist there when its disks are mirrored to them.
The copy is a snapshot sent incrementally from the newest snapshot both nodes hold, the one a previous move or a sync.zfs left, and in full when there is none. The destination receives it unmounted.
func (*Mover) Prune ¶
Prune destroys the move snapshots of the dataset older than keep, here and on the destination. The one kept is the base of the next move.
type Pool ¶
func (*Pool) ExpandDevice ¶
ExpandDevice makes the pool take the space a device of it has gained.
A pool is not given a size: it is what its vdevs hold, less what zfs keeps for its labels and its reserve. So growing one is telling it to look at a device again, the way a filesystem is told to take up the device under it.
func (*Pool) GetProperty ¶
GetProperty returns a dataset property value
func (*Pool) ListVolumes ¶
func (*Pool) SetProperty ¶
func (*Pool) Usage ¶
Usage returns the size of the pool, and what is used and free of it as its datasets see it, which is the question its callers ask: can a volume of a size be created there.
What zpool get tells of them is another thing, the blocks written. A zvol reserves its whole size when created, and that reservation is no block of the pool until it is written: zpool says free the space no zfs create can have. The used of the root dataset counts the reservations, and available is what is left of them. Their sum is the size less what zfs keeps for itself, which is why Size stays what zpool says: a resize compares it to a device.
type PoolStatusData ¶
type Vol ¶
func (*Vol) Destroy ¶
Destroy destroys the volume, a volume already gone being destroyed.
A volume just released, as the zvol under a drbd device brought down, is reported busy by zfs for a moment: the destroy is tried again a second later, as many times as VolDestroyWithBusyRetries says. A destroy that fails is an error, the busy one once the retries are spent: the caller would otherwise report the volume unprovisioned and leave it behind.
func (*Vol) GetProperty ¶
GetProperty returns a dataset property value
func (*Vol) SetProperty ¶
SetProperty sets a dataset property value
Source Files
¶
- ds.go
- ds_property.go
- fs.go
- fs_create.go
- fs_destroy.go
- fs_exists.go
- fs_mount.go
- fs_property.go
- fs_rename.go
- fs_snapshot.go
- fs_umount.go
- main.go
- move.go
- name.go
- pool.go
- pool_create.go
- pool_destroy.go
- pool_export.go
- pool_import.go
- pool_list.go
- pool_property.go
- pool_status.go
- pool_usage.go
- ssh.go
- vol.go
- vol_create.go
- vol_destroy.go
- vol_exists.go
- vol_list.go
- vol_property.go