sys

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DiskType is a disk type
	DiskType = "disk"
	// SSDType is an sdd type
	SSDType = "ssd"
	// PartType is a partition type
	PartType = "part"
	// CryptType is an encrypted type
	CryptType = "crypt"
	// LVMType is an LVM type
	LVMType = "lvm"
	// MultiPath is for multipath devices
	MultiPath = "mpath"
	// LinearType is a linear type
	LinearType = "linear"

	LoopType = "loop"
)

Variables

This section is empty.

Functions

func CleanLoopbackPv

func CleanLoopbackPv(pvs []string, loops []string, files []string) error

func CleanLoopbackVG

func CleanLoopbackVG(name string, pvs []string, loops []string, files []string) error

CleanLoopbackVG deletes a VG made by MakeLoopbackVG

func CreatePhysicalVolume

func CreatePhysicalVolume(executor exec.Executor, diskName string) error

func CreateVolumeGroup

func CreateVolumeGroup(executor exec.Executor, disks []topolvmv1.Disk, volumeGroupName string) error

func ExpandVolumeGroup

func ExpandVolumeGroup(executor exec.Executor, vgName string, pvs []string) error

func GetAvailableDevices

func GetAvailableDevices(dcontext *cluster.Context) (map[string]*LocalDisk, error)

func GetDeviceFilesystems

func GetDeviceFilesystems(device string, executor exec.Executor) (string, error)

GetDeviceFilesystems get the file systems available

func GetDeviceProperties

func GetDeviceProperties(device string, executor exec.Executor) (map[string]string, error)

GetDeviceProperties gets device properties

func GetDevicePropertiesFromPath

func GetDevicePropertiesFromPath(devicePath string, executor exec.Executor) (map[string]string, error)

GetDevicePropertiesFromPath gets a device property from a path

func GetDiskUUID

func GetDiskUUID(device string, executor exec.Executor) (string, error)

GetDiskUUID look up the UUID for a disk.

func GetLVName

func GetLVName(executor exec.Executor, devicePath string) (string, error)

GetLVName returns the LV name of the device in the form of "VG/LV".

func GetUdevInfo

func GetUdevInfo(device string, executor exec.Executor) (map[string]string, error)

GetUdevInfo gets udev information

func GetVolumeGroupSize

func GetVolumeGroupSize(executor exec.Executor, vgname string) (uint64, error)

func IsLV

func IsLV(devicePath string, executor exec.Executor) (bool, error)

IsLV returns if a device is owned by LVM, is a logical volume

func ListDevices

func ListDevices(executor exec.Executor) ([]string, error)

ListDevices list all devices available on a machine

func ListDevicesChild

func ListDevicesChild(executor exec.Executor, device string) ([]string, error)

ListDevicesChild list all child available on a device

func MakeLoopbackDevice

func MakeLoopbackDevice(name string) (string, error)

func MakeLoopbackVG

func MakeLoopbackVG(name string, devices ...string) error

MakeLoopbackVG creates a VG made from loopback device by losetup

Types

type LVInfo

type LVInfo map[string]string

func GetPhysicalVolume

func GetPhysicalVolume(executor exec.Executor, vgname string) (LVInfo, error)

func GetVolumeGroups

func GetVolumeGroups(executor exec.Executor) (LVInfo, error)

type LocalDisk

type LocalDisk struct {
	// Name is the device name
	Name string `json:"name"`
	// Parent is the device parent's name
	Parent string `json:"parent"`
	// HasChildren is whether the device has a children device
	HasChildren bool `json:"hasChildren"`
	// DevLinks is the persistent device path on the host
	DevLinks string `json:"devLinks"`
	// Size is the device capacity in byte
	Size uint64 `json:"size"`
	// UUID is used by /dev/disk/by-uuid
	UUID string `json:"uuid"`
	// Serial is the disk serial used by /dev/disk/by-id
	Serial string `json:"serial"`
	// Type is disk type
	Type string `json:"type"`
	// Rotational is the boolean whether the device is rotational: true for hdd, false for ssd and nvme
	Rotational bool `json:"rotational"`
	// ReadOnly is the boolean whether the device is readonly
	Readonly bool `json:"readOnly"`
	// Partitions is a partition slice
	Partitions []Partition
	// Filesystem is the filesystem currently on the device
	Filesystem string `json:"filesystem"`
	// Vendor is the device vendor
	Vendor string `json:"vendor"`
	// Model is the device model
	Model string `json:"model"`
	// WWN is the world wide name of the device
	WWN string `json:"wwn"`
	// WWNVendorExtension is the WWN_VENDOR_EXTENSION from udev info
	WWNVendorExtension string `json:"wwnVendorExtension"`
	// Empty checks whether the device is completely empty
	Empty bool `json:"empty"`
	// RealPath is the device pathname behind the PVC, behind /mnt/<pvc>/name
	RealPath string `json:"real-path,omitempty"`
	// KernelName is the kernel name of the device
	KernelName string `json:"kernel-name,omitempty"`
	// Whether this device should be encrypted
	Encrypted bool `json:"encrypted,omitempty"`
}

LocalDisk contains information about an unformatted block device

type Partition

type Partition struct {
	Name       string
	Size       uint64
	Label      string
	Filesystem string
}

Partition represents a partition metadata

func GetDevicePartitions

func GetDevicePartitions(device string, executor exec.Executor) (partitions []Partition, unusedSpace uint64, err error)

GetDevicePartitions gets partitions on a given device

type PhysicalVolume

type PhysicalVolume struct {
	Name            string
	VolumeGroupName string
}

type VolumeGroup

type VolumeGroup struct {
	Name    string
	Size    uint64
	PvCount uint
	Pvs     []PhysicalVolume
}

Jump to

Keyboard shortcuts

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