Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBackup(bkp *apis.ZFSBackup) error
- func CreateClone(vol *apis.ZFSVolume) error
- func CreateRestore(rstr *apis.ZFSRestore) error
- func CreateSnapshot(snap *apis.ZFSSnapshot) error
- func CreateVolume(vol *apis.ZFSVolume) error
- func DeleteSnapshot(snapname string) (err error)
- func DeleteVolume(volumeID string) (err error)
- func DestoryBackup(bkp *apis.ZFSBackup) error
- func DestroySnapshot(snap *apis.ZFSSnapshot) error
- func DestroyVolume(vol *apis.ZFSVolume) error
- func FormatAndMountZvol(devicePath string, mountInfo *MountInfo) error
- func GetVolList(volumeID string) (*apis.ZFSVolumeList, error)
- func GetVolume(volumeID string) (*apis.ZFSVolume, error)
- func GetVolumeDevPath(vol *apis.ZFSVolume) (string, error)
- func GetVolumeProperty(vol *apis.ZFSVolume, prop string) (string, error)
- func GetVolumeType(fstype string) string
- func GetZFSSnapshot(snapID string) (*apis.ZFSSnapshot, error)
- func GetZFSSnapshotStatus(snapID string) (string, error)
- func GetZFSVolume(volumeID string) (*apis.ZFSVolume, error)
- func GetZFSVolumeState(volID string) (string, string, error)
- func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error
- func MountDataset(vol *apis.ZFSVolume, mount *MountInfo) error
- func MountFilesystem(vol *apis.ZFSVolume, mount *MountInfo) error
- func MountZFSDataset(vol *apis.ZFSVolume, mountpath string) error
- func MountZvol(vol *apis.ZFSVolume, mount *MountInfo) error
- func PropertyChanged(oldVol *apis.ZFSVolume, newVol *apis.ZFSVolume) bool
- func ProvisionSnapshot(snap *apis.ZFSSnapshot) error
- func ProvisionVolume(vol *apis.ZFSVolume) error
- func RemoveBkpFinalizer(bkp *apis.ZFSBackup) error
- func RemoveSnapFinalizer(snap *apis.ZFSSnapshot) error
- func RemoveZvolFinalizer(vol *apis.ZFSVolume) error
- func ResizeExtn(devpath string) error
- func ResizeVolume(vol *apis.ZFSVolume, newSize int64) error
- func ResizeXFS(path string) error
- func ResizeZFSVolume(vol *apis.ZFSVolume, mountpath string) error
- func SetDatasetLegacyMount(vol *apis.ZFSVolume) error
- func SetDatasetMountProp(volume string, mountpath string) error
- func SetVolumeProp(vol *apis.ZFSVolume) error
- func UmountVolume(vol *apis.ZFSVolume, targetPath string) error
- func UpdateBkpInfo(bkp *apis.ZFSBackup, status apis.ZFSBackupStatus) error
- func UpdateRestoreInfo(rstr *apis.ZFSRestore, status apis.ZFSRestoreStatus) error
- func UpdateSnapInfo(snap *apis.ZFSSnapshot) error
- func UpdateZvolInfo(vol *apis.ZFSVolume) error
- type MountInfo
Constants ¶
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" // ZFSSrcVolKey key for the source Volume name ZFSSrcVolKey string = "openebs.io/source-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" )
const ( ZFSDevPath = "/dev/zvol/" FSTypeZFS = "zfs" )
zfs related constants
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
const ( VolTypeDataset = "DATASET" VolTypeZVol = "ZVOL" )
constants to define volume type
Variables ¶
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
CreateBackup creates the backup
func CreateClone ¶
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 ¶
CreateVolume creates the zvol/dataset as per info provided in ZFSVolume object
func DeleteSnapshot ¶
DeleteSnapshot deletes the corresponding ZFSSnapshot CR
func DeleteVolume ¶
DeleteVolume deletes the corresponding ZFSVol CR
func DestoryBackup ¶ added in v1.0.0
DestoryBackup deletes the snapshot created
func DestroySnapshot ¶
func DestroySnapshot(snap *apis.ZFSSnapshot) error
DestroySnapshot deletes the zfs volume snapshot
func DestroyVolume ¶
DestroyVolume deletes the zfs volume
func FormatAndMountZvol ¶
FormatAndMountZvol formats and mounts the created volume to the desired mount path
func GetVolList ¶
func GetVolList(volumeID string) (*apis.ZFSVolumeList, error)
GetVolList fetches the current Published Volume list
func GetVolumeDevPath ¶
GetVolumeDevPath returns devpath for the given volume
func GetVolumeProperty ¶
GetVolumeProperty gets zfs properties for the volume
func GetVolumeType ¶
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 ¶
GetZFSSnapshotStatus returns ZFSSnapshot status
func GetZFSVolume ¶
GetZFSVolume fetches the given ZFSVolume
func GetZFSVolumeState ¶ added in v0.8.0
GetZFSVolumeState returns ZFSVolume OwnerNode and State for the given volume. CreateVolume request may call it again and again until volume is "Ready".
func MountBlock ¶
MountBlock mounts the block disk to the specified path
func MountDataset ¶
MountDataset mounts the zfs dataset to the specified path
func MountFilesystem ¶
MountFilesystem mounts the disk to the specified path
func MountZFSDataset ¶
MountZFSDataset mounts the dataset to the given mountpoint
func PropertyChanged ¶
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 ¶
ProvisionVolume creates a ZFSVolume(zv) CR, watcher for zvc is present in CSI agent
func RemoveBkpFinalizer ¶ added in v1.0.0
RemoveBkpFinalizer removes finalizer from ZFSBackup CR
func RemoveSnapFinalizer ¶
func RemoveSnapFinalizer(snap *apis.ZFSSnapshot) error
RemoveSnapFinalizer adds finalizer to ZFSSnapshot CR
func RemoveZvolFinalizer ¶
RemoveZvolFinalizer adds finalizer to ZFSVolume CR
func ResizeExtn ¶
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 ¶
ResizeVolume resizes the zfs volume
func ResizeXFS ¶
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 ¶
ResizeZFSVolume resize volume
func SetDatasetLegacyMount ¶ added in v0.8.0
SetDatasetLegacyMount sets the dataset mountpoint to legacy if not set
func SetDatasetMountProp ¶
SetDatasetMountProp sets mountpoint for the volume
func SetVolumeProp ¶
SetVolumeProp sets the volume property
func UmountVolume ¶
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 ¶
UpdateZvolInfo updates ZFSVolume CR with node id and finalizer
Types ¶
type MountInfo ¶ added in v1.1.0
type MountInfo struct { // FSType of a volume will specify the // format type - ext4(default), xfs of PV FSType string `json:"fsType"` // AccessMode of a volume will hold the // access mode of the volume AccessModes []string `json:"accessModes"` // MountPath of the volume will hold the // path on which the volume is mounted // on that node MountPath string `json:"mountPath"` // MountOptions specifies the options with // which mount needs to be attempted MountOptions []string `json:"mountOptions"` }
MountInfo contains the volume related info for all types of volumes in ZFSVolume