zfs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpenEBSNamespaceKey is the environment variable to get openebs namespace
	//
	// This environment variable is set via kubernetes downward API
	OpenEBSNamespaceKey string = "OPENEBS_NAMESPACE"
	// GoogleAnalyticsKey This environment variable is set via env
	GoogleAnalyticsKey string = "OPENEBS_IO_ENABLE_ANALYTICS"
	// ZFSFinalizer for the ZfsVolume CR
	ZFSFinalizer string = "zfs.openebs.io/finalizer"
	// ZFSVolKey for the ZfsSnapshot CR to store Persistence Volume name
	ZFSVolKey string = "openebs.io/persistent-volume"
	// PoolNameKey is key for ZFS pool name
	PoolNameKey string = "openebs.io/poolname"
	// ZFSNodeKey will be used to insert Label in ZfsVolume CR
	ZFSNodeKey string = "kubernetes.io/nodename"
	// ZFSTopologyKey is supported topology key for the zfs driver
	ZFSTopologyKey string = "openebs.io/nodename"
	// ZFSStatusPending shows object has not handled yet
	ZFSStatusPending string = "Pending"
	// ZFSStatusFailed shows object operation has failed
	ZFSStatusFailed string = "Failed"
	// ZFSStatusReady shows object has been processed
	ZFSStatusReady string = "Ready"
)
View Source
const (
	ZFSDevPath = "/dev/zvol/"
	FSTypeZFS  = "zfs"
)

zfs related constants

View Source
const (
	ZFSVolCmd      = "zfs"
	ZFSCreateArg   = "create"
	ZFSCloneArg    = "clone"
	ZFSDestroyArg  = "destroy"
	ZFSSetArg      = "set"
	ZFSGetArg      = "get"
	ZFSListArg     = "list"
	ZFSSnapshotArg = "snapshot"
	ZFSSendArg     = "send"
	ZFSRecvArg     = "recv"
)

zfs command related constants

View Source
const (
	VolTypeDataset = "DATASET"
	VolTypeZVol    = "ZVOL"
)

constants to define volume type

Variables

View Source
var (
	// OpenEBSNamespace is openebs system namespace
	OpenEBSNamespace string

	// NodeID is the NodeID of the node on which the pod is present
	NodeID string

	// GoogleAnalyticsEnabled should send google analytics or not
	GoogleAnalyticsEnabled string
)

Functions

func CreateBackup added in v1.0.0

func CreateBackup(bkp *apis.ZFSBackup) error

CreateBackup creates the backup

func CreateClone

func CreateClone(vol *apis.ZFSVolume) error

CreateClone creates clone for the zvol/dataset as per info provided in ZFSVolume object

func CreateRestore added in v1.0.0

func CreateRestore(rstr *apis.ZFSRestore) error

CreateRestore creates the restore

func CreateSnapshot

func CreateSnapshot(snap *apis.ZFSSnapshot) error

CreateSnapshot creates the zfs volume snapshot

func CreateVolume

func CreateVolume(vol *apis.ZFSVolume) error

CreateVolume creates the zvol/dataset as per info provided in ZFSVolume object

func DeleteSnapshot

func DeleteSnapshot(snapname string) (err error)

DeleteSnapshot deletes the corresponding ZFSSnapshot CR

func DeleteVolume

func DeleteVolume(volumeID string) (err error)

DeleteVolume deletes the corresponding ZFSVol CR

func DestoryBackup added in v1.0.0

func DestoryBackup(bkp *apis.ZFSBackup) error

DestoryBackup deletes the snapshot created

func DestroySnapshot

func DestroySnapshot(snap *apis.ZFSSnapshot) error

DestroySnapshot deletes the zfs volume snapshot

func DestroyVolume

func DestroyVolume(vol *apis.ZFSVolume) error

DestroyVolume deletes the zfs volume

func FormatAndMountZvol

func FormatAndMountZvol(devicePath string, mountInfo *apis.MountInfo) error

FormatAndMountZvol formats and mounts the created volume to the desired mount path

func GetMounts

func GetMounts(dev string) ([]string, error)

GetMounts gets mountpoints for the specified volume

func GetVolList

func GetVolList(volumeID string) (*apis.ZFSVolumeList, error)

GetVolList fetches the current Published Volume list

func GetVolume

func GetVolume(volumeID string) (*apis.ZFSVolume, error)

GetVolume the corresponding ZFSVolume CR

func GetVolumeDevPath

func GetVolumeDevPath(vol *apis.ZFSVolume) (string, error)

GetVolumeDevPath returns devpath for the given volume

func GetVolumeProperty

func GetVolumeProperty(vol *apis.ZFSVolume, prop string) (string, error)

GetVolumeProperty gets zfs properties for the volume

func GetVolumeType

func GetVolumeType(fstype string) string

GetVolumeType returns the volume type whether it is a zvol or dataset

func GetZFSSnapshot

func GetZFSSnapshot(snapID string) (*apis.ZFSSnapshot, error)

GetZFSSnapshot fetches the given ZFSSnapshot

func GetZFSSnapshotStatus

func GetZFSSnapshotStatus(snapID string) (string, error)

GetZFSSnapshotStatus returns ZFSSnapshot status

func GetZFSVolume

func GetZFSVolume(volumeID string) (*apis.ZFSVolume, error)

GetZFSVolume fetches the given ZFSVolume

func GetZFSVolumeState added in v0.8.0

func GetZFSVolumeState(volID string) (string, string, error)

GetZFSVolumeState returns ZFSVolume OwnerNode and State for the given volume. CreateVolume request may call it again and again until volume is "Ready".

func IsMountPath

func IsMountPath(path string) bool

IsMountPath returns true if path is a mount path

func MountBlock

func MountBlock(vol *apis.ZFSVolume, mountinfo *apis.MountInfo) error

MountBlock mounts the block disk to the specified path

func MountDataset

func MountDataset(vol *apis.ZFSVolume, mount *apis.MountInfo) error

MountDataset mounts the zfs dataset to the specified path

func MountFilesystem

func MountFilesystem(vol *apis.ZFSVolume, mount *apis.MountInfo) error

MountFilesystem mounts the disk to the specified path

func MountZFSDataset

func MountZFSDataset(vol *apis.ZFSVolume, mountpath string) error

MountZFSDataset mounts the dataset to the given mountpoint

func MountZvol

func MountZvol(vol *apis.ZFSVolume, mount *apis.MountInfo) error

MountZvol mounts the disk to the specified path

func PropertyChanged

func PropertyChanged(oldVol *apis.ZFSVolume, newVol *apis.ZFSVolume) bool

PropertyChanged return whether volume property is changed

func ProvisionSnapshot

func ProvisionSnapshot(
	snap *apis.ZFSSnapshot,
) error

ProvisionSnapshot creates a ZFSSnapshot CR, watcher for zvc is present in CSI agent

func ProvisionVolume

func ProvisionVolume(
	vol *apis.ZFSVolume,
) error

ProvisionVolume creates a ZFSVolume(zv) CR, watcher for zvc is present in CSI agent

func RemoveBkpFinalizer added in v1.0.0

func RemoveBkpFinalizer(bkp *apis.ZFSBackup) error

RemoveBkpFinalizer removes finalizer from ZFSBackup CR

func RemoveSnapFinalizer

func RemoveSnapFinalizer(snap *apis.ZFSSnapshot) error

RemoveSnapFinalizer adds finalizer to ZFSSnapshot CR

func RemoveZvolFinalizer

func RemoveZvolFinalizer(vol *apis.ZFSVolume) error

RemoveZvolFinalizer adds finalizer to ZFSVolume CR

func ResizeExtn

func ResizeExtn(devpath string) error

ResizeExtn can be used to run a resize command on the ext2/3/4 filesystem to expand the filesystem to the actual size of the device

func ResizeVolume

func ResizeVolume(vol *apis.ZFSVolume, newSize int64) error

ResizeVolume resizes the zfs volume

func ResizeXFS

func ResizeXFS(path string) error

ResizeXFS can be used to run a resize command on the xfs filesystem to expand the filesystem to the actual size of the device

func ResizeZFSVolume

func ResizeZFSVolume(vol *apis.ZFSVolume, mountpath string) error

ResizeZFSVolume resize volume

func SetDatasetLegacyMount added in v0.8.0

func SetDatasetLegacyMount(vol *apis.ZFSVolume) error

SetDatasetLegacyMount sets the dataset mountpoint to legacy if not set

func SetDatasetMountProp

func SetDatasetMountProp(volume string, mountpath string) error

SetDatasetMountProp sets mountpoint for the volume

func SetVolumeProp

func SetVolumeProp(vol *apis.ZFSVolume) error

SetVolumeProp sets the volume property

func UmountVolume

func UmountVolume(vol *apis.ZFSVolume, targetPath string,
) error

UmountVolume unmounts the volume and the corresponding mount path is removed

func UpdateBkpInfo added in v1.0.0

func UpdateBkpInfo(bkp *apis.ZFSBackup, status apis.ZFSBackupStatus) error

UpdateBkpInfo updates the backup info with the status

func UpdateRestoreInfo added in v1.0.0

func UpdateRestoreInfo(rstr *apis.ZFSRestore, status apis.ZFSRestoreStatus) error

UpdateRestoreInfo updates the rstr info with the status

func UpdateSnapInfo

func UpdateSnapInfo(snap *apis.ZFSSnapshot) error

UpdateSnapInfo updates ZFSSnapshot CR with node id and finalizer

func UpdateZvolInfo

func UpdateZvolInfo(vol *apis.ZFSVolume) error

UpdateZvolInfo updates ZFSVolume CR with node id and finalizer

Types

This section is empty.

Jump to

Keyboard shortcuts

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