diskmetrics

package
v0.0.0-...-a6598b8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySnapshot

func ApplySnapshot(ctx context.Context, log *base.LogObject, diskfile, snapshotName string) error

ApplySnapshot applies snapshot to diskfile

func CheckResizeDisk

func CheckResizeDisk(log *base.LogObject, diskfile string, maxsizebytes uint64) (uint64, bool, error)

CheckResizeDisk returns size and indicates do we need to resize disk to be at least maxsizebytes

func CreateImg

func CreateImg(ctx context.Context, log *base.LogObject, diskfile string, format string, size uint64) error

CreateImg creates empty diskfile with defined format and size

func CreateSnapshot

func CreateSnapshot(ctx context.Context, log *base.LogObject, diskfile, snapshotName string) error

CreateSnapshot creates snapshot of diskfile with defined format and size

func DeleteSnapshot

func DeleteSnapshot(ctx context.Context, log *base.LogObject, diskfile, snapshotName string) error

DeleteSnapshot deletes snapshot with a given name created for a given diskfile

func DirUsage

func DirUsage(log *base.LogObject, dir string) (uint64, error)

DirUsage calculates usage of directory it checks if provided directory is zfs mountpoint and take usage from zfs in that case

func Dom0DiskReservedSize

func Dom0DiskReservedSize(log *base.LogObject, globalConfig *types.ConfigItemValueMap, deviceDiskSize uint64) uint64

Dom0DiskReservedSize returns reserved space for EVE-OS

func FindDisksPartitions

func FindDisksPartitions(log *base.LogObject) []string

FindDisksPartitions returns the names of all disks and all partitions Return an array of names like "sda", "sdb1"

func FindLargestDisk

func FindLargestDisk(log *base.LogObject) string

FindLargestDisk determines the name of the largest disk The assumption is that this is not a removalable disk like a USB disk with the installer image

func GetDiskActualSize

func GetDiskActualSize(log *base.LogObject, diskfile string) (uint64, error)

GetDiskActualSize - returns ActualSize of the image

func GetDiskVirtualSize

func GetDiskVirtualSize(log *base.LogObject, diskfile string) (uint64, error)

GetDiskVirtualSize - returns VirtualSize of the image

func GetImgInfo

func GetImgInfo(log *base.LogObject, diskfile string) (*types.ImgInfo, error)

func PartitionSize

func PartitionSize(log *base.LogObject, part string) (uint64, bool)

PartitionSize - Given "sdb1" return the size of the partition; "sdb" to size of disk. Returns size and a bool to indicate that it is a partition.

func PersistUsageStat

func PersistUsageStat(log *base.LogObject) (*types.UsageStat, error)

PersistUsageStat returns usage stat for persist We need to handle ZFS differently since the mounted /persist does not indicate usage of zvols and snapshots Note that we subtract usage of persist/reserved dataset (about 20% of persist capacity)

func ResizeImg

func ResizeImg(ctx context.Context, log *base.LogObject, diskfile string, newsize uint64) error

ResizeImg calls qemu-img to resize disk file to new size

func RolloutImgToBlock

func RolloutImgToBlock(ctx context.Context, log *base.LogObject, diskfile, outputFile, outputFormat string) error

RolloutImgToBlock do conversion of diskfile to outputFile with defined format

func SizeFromDir

func SizeFromDir(log *base.LogObject, dirname string) (uint64, error)

SizeFromDir performs a du -s equivalent operation. Didn't use os.ReadDir and filepath.Walk because they sort (quick_sort) all files per directory which is an unnecessary costly operation.

func StatAllocatedBytes

func StatAllocatedBytes(path string) (uint64, error)

StatAllocatedBytes returns the allocated size of a file in bytes This value will be less than fileInfo.Size() for thinly allocated files

Types

This section is empty.

Jump to

Keyboard shortcuts

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