Documentation ¶
Index ¶
- Constants
- func AddVDev(log *base.LogObject, pool, vdev string) (string, error)
- func AttachVDev(log *base.LogObject, pool, vdev, newVdev string) (string, error)
- func CreateDataset(datasetName string) error
- func CreateDatasets(log *base.LogObject, datasetName string) error
- func CreateSnapshot(datasetName string) (snapshotName string, err error)
- func CreateVaultDataset(datasetName, zfsKeyFile string) error
- func CreateVaultVolumeDataset(log *base.LogObject, datasetName string, zfsKeyFile string, encrypted bool, ...) error
- func CreateVolumeDataset(log *base.LogObject, datasetName string, sizeBytes uint64, compression string, ...) error
- func DatasetExist(log *base.LogObject, datasetPath string) bool
- func DestroyDataset(datasetName string) error
- func GetDatasetAvailableBytes(datasetName string) (uint64, error)
- func GetDatasetByDevice(device string) string
- func GetDatasetKeyStatus(datasetName string) (string, error)
- func GetDatasetUsageStat(datasetName string) (*types.UsageStat, error)
- func GetRaidTypeFromStr(raidName string) types.StorageRaidType
- func GetVDevAuxMsgStr(state types.VDevAux) string
- func GetVolumesFromDataset(datasetName string) ([]string, error)
- func GetZFSVolumeInfo(device string) (*types.ImgInfo, error)
- func GetZVolDeviceByDataset(dataset string) string
- func GetZVolSectorSize(zVolName string) (uint64, error)
- func GetZfsCompressratio(zpoolName string) (float64, error)
- func GetZfsCountVolume(datasetName string) (uint32, error)
- func GetZfsDeviceStatusFromStr(statusStr string) types.StorageStatus
- func GetZfsDiskAndStatus(disk libzfs.VDevTree) (*types.StorageDiskState, error)
- func GetZfsVDevMetrics(zStat libzfs.VDevStat, diskName string, fromZfs bool) *types.ZFSVDevMetrics
- func GetZfsVersion() (string, error)
- func GetZpoolMetrics(vdev libzfs.VDevTree) *types.ZFSPoolMetrics
- func GetZpoolRaidType(vdevs libzfs.VDevTree) types.StorageRaidType
- func GetZpoolStatusMsgStr(status types.PoolStatus) string
- func GetZvolMetrics(status types.VolumeStatus, poolName string) (*types.StorageZVolMetrics, error)
- func GetZvolPath(datasetName string) string
- func IsDatasetTypeZvol(datasetName string) (bool, error)
- func MountDataset(datasetName string) error
- func RemoveVDev(log *base.LogObject, pool, vdev string) (string, error)
- func ReplaceVDev(log *base.LogObject, pool, oldVdev, newVdev string) (string, error)
- func RollbackToSnapshot(datasetName, snapshotName string) error
- func SetReserved(datasetName string, percentage uint64) error
- func UnmountDataset(datasetName string) error
Constants ¶
const VolBlockSizeBytes = uint64(16 * 1024)
VolBlockSizeBytes is the default dataset block size in bytes
Variables ¶
This section is empty.
Functions ¶
func AttachVDev ¶
AttachVDev attach newVdev to existing vdev
func CreateDataset ¶
CreateDataset create and mount an empty dataset
func CreateDatasets ¶
CreateDatasets - creates all the non-existing parent datasets. Datasets created in this manner are automatically mounted according to the mountpoint property inherited from their parent. Analogue of the "zfs create -p ..." command
func CreateSnapshot ¶
CreateSnapshot creates a snapshot of the dataset Returns the name of the created snapshot that can be used to rollback
func CreateVaultDataset ¶
CreateVaultDataset create and mount an empty vault dataset
func CreateVaultVolumeDataset ¶
func CreateVaultVolumeDataset(log *base.LogObject, datasetName string, zfsKeyFile string, encrypted bool, sizeBytes uint64, compressionType string, blockSizeBytes uint64) error
CreateVaultVolumeDataset Create an empty vault zvol
func CreateVolumeDataset ¶
func CreateVolumeDataset(log *base.LogObject, datasetName string, sizeBytes uint64, compression string, blockSizeBytes uint64) error
CreateVolumeDataset creates dataset of zvol type in zfs
func DatasetExist ¶
DatasetExist return true if dataset exists or false when it does not exist
func DestroyDataset ¶
DestroyDataset removes dataset from zfs it runs 3 times in case of errors (we can hit dataset is busy)
func GetDatasetAvailableBytes ¶
GetDatasetAvailableBytes Read Zfs dataset 'available' space property, parse as uint64
func GetDatasetByDevice ¶
GetDatasetByDevice returns dataset for provided device path
func GetDatasetKeyStatus ¶
GetDatasetKeyStatus returns status of dataset key or error
func GetDatasetUsageStat ¶
GetDatasetUsageStat returns UsageStat for provided datasetName for dataset with RefReservation it will return dataset.RefReservation as UsageStat.Total and UsageStat.Used for dataset without RefReservation it will calculate UsageStat.Total as sum of dataset.Used and dataset.Available and use dataset.LogicalUsed as UsageStat.Used to not count empty blocks of child zvols
func GetRaidTypeFromStr ¶
func GetRaidTypeFromStr(raidName string) types.StorageRaidType
GetRaidTypeFromStr takes a RAID name as input and returns current RAID type
func GetVDevAuxMsgStr ¶
GetVDevAuxMsgStr returns a verbose VDev aux message The state messages were taken as a basis from zfs/include/sys/fs/zfs.h
func GetVolumesFromDataset ¶
GetVolumesFromDataset obtains volumes list from dataset
func GetZFSVolumeInfo ¶
GetZFSVolumeInfo provides information for zfs device
func GetZVolDeviceByDataset ¶
GetZVolDeviceByDataset return path to device for provided dataset
func GetZVolSectorSize ¶
GetZVolSectorSize return hw_sector_size for zvol
func GetZfsCompressratio ¶
GetZfsCompressratio takes a zpool name as input and returns compressratio property for zpool
func GetZfsCountVolume ¶
GetZfsCountVolume takes a datasetName name as input and returns the number of zvols. Returns 0 if there are no zvols or an have error.
func GetZfsDeviceStatusFromStr ¶
func GetZfsDeviceStatusFromStr(statusStr string) types.StorageStatus
GetZfsDeviceStatusFromStr takes a string with status as input and returns status
func GetZfsDiskAndStatus ¶
func GetZfsDiskAndStatus(disk libzfs.VDevTree) (*types.StorageDiskState, error)
GetZfsDiskAndStatus takes a libzfs.VDevTree as input and returns *info.StorageDiskState.
func GetZfsVDevMetrics ¶
GetZfsVDevMetrics read libzfs.VDevStat or /proc/diskstats and return metrics (*types.DiskMetrics) for only one device in zfs pool.
func GetZfsVersion ¶
GetZfsVersion return zfs kernel module version
func GetZpoolMetrics ¶
func GetZpoolMetrics(vdev libzfs.VDevTree) *types.ZFSPoolMetrics
GetZpoolMetrics returns metrics for provided zpool
func GetZpoolRaidType ¶
func GetZpoolRaidType(vdevs libzfs.VDevTree) types.StorageRaidType
GetZpoolRaidType takes a libzfs.VDevTree as input and returns current RAID type. return RAID0 in case of mixed topology as we can mix nested topology into the stripe
func GetZpoolStatusMsgStr ¶
func GetZpoolStatusMsgStr(status types.PoolStatus) string
GetZpoolStatusMsgStr returns a verbose zpool status message The state messages were taken as a basis from the zfs/cmd/zpool/zpool_main.c file
func GetZvolMetrics ¶
func GetZvolMetrics(status types.VolumeStatus, poolName string) (*types.StorageZVolMetrics, error)
GetZvolMetrics returns metrics for a zvol.
func GetZvolPath ¶
GetZvolPath Helper to build the /dev/zvol/<dataset> path
func IsDatasetTypeZvol ¶
IsDatasetTypeZvol returns true if dataset is a zvol
func RemoveVDev ¶
RemoveVDev removes vdev from the pool
func ReplaceVDev ¶
ReplaceVDev replaces vdev from the pool
func RollbackToSnapshot ¶
RollbackToSnapshot rolls back the dataset to the snapshot
func SetReserved ¶
SetReserved sets the reserved percentage. The datasetName is the parent (e.g., "persist").
func UnmountDataset ¶
UnmountDataset unmount this filesystem and any children inheriting the mountpoint property.
Types ¶
This section is empty.