Documentation ¶
Overview ¶
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CheckIfDeviceAvailable(executor exec.Executor, devicePath string, pvcBacked bool) (bool, string, error)
- func CheckKernelModuleParam(name, param string, executor pkgexec.Executor) (bool, error)
- func GetDeviceFilesystems(device string, executor exec.Executor) (string, error)
- func GetDeviceProperties(device string, executor exec.Executor) (map[string]string, error)
- func GetDevicePropertiesFromPath(devicePath string, executor exec.Executor) (map[string]string, error)
- func GetDiskDeviceClass(crushDeviceClassVarName, deviceType string) string
- func GetDiskDeviceType(disk *LocalDisk) string
- func GetDiskUUID(device string, executor exec.Executor) (string, error)
- func GetLVName(executor exec.Executor, devicePath string) (string, error)
- func GetUdevInfo(device string, executor exec.Executor) (map[string]string, error)
- func Grep(input, searchFor string) string
- func IsBuiltinKernelModule(name string, executor pkgexec.Executor) (bool, error)
- func IsDeviceEncrypted(executor exec.Executor, device string) (bool, error)
- func IsLV(devicePath string, executor exec.Executor) (bool, error)
- func ListDevices(executor exec.Executor) ([]string, error)
- func ListDevicesChild(executor exec.Executor, device string) ([]string, error)
- func LoadKernelModule(name string, options []string, executor pkgexec.Executor) error
- type CephVolumeInventory
- type CephVolumeLVMList
- type LocalDisk
- type Partition
Constants ¶
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 is a loop device type LoopType = "loop" // CephLVPrefix is the prefix of a LV owned by ceph-volume CephLVPrefix = "ceph--" // DeviceMapperPrefix is the prefix of a LV from the device mapper interface DeviceMapperPrefix = "dm-" )
Variables ¶
This section is empty.
Functions ¶
func CheckIfDeviceAvailable ¶ added in v0.8.0
func CheckIfDeviceAvailable(executor exec.Executor, devicePath string, pvcBacked bool) (bool, string, error)
CheckIfDeviceAvailable checks if a device is available for consumption. The caller needs to decide based on the return values whether it is available.
func CheckKernelModuleParam ¶ added in v0.5.0
func GetDeviceFilesystems ¶
GetDeviceFilesystems get the file systems available
func GetDeviceProperties ¶
GetDeviceProperties gets device properties
func GetDevicePropertiesFromPath ¶ added in v0.4.0
func GetDevicePropertiesFromPath(devicePath string, executor exec.Executor) (map[string]string, error)
GetDevicePropertiesFromPath gets a device property from a path
func GetDiskDeviceClass ¶ added in v1.6.6
func GetDiskDeviceType ¶ added in v1.15.7
func GetDiskUUID ¶
GetDiskUUID look up the UUID for a disk.
func GetLVName ¶ added in v1.3.0
GetLVName returns the LV name of the device in the form of "VG/LV".
func GetUdevInfo ¶ added in v0.8.0
GetUdevInfo gets udev information
func IsBuiltinKernelModule ¶ added in v0.9.0
func IsDeviceEncrypted ¶ added in v1.8.2
IsDeviceEncrypted returns whether the disk has a "crypt" label on it
func ListDevices ¶
ListDevices list all devices available on a machine
func ListDevicesChild ¶ added in v1.2.3
ListDevicesChild list all child available on a device For an encrypted device, it will return the encrypted device like so: lsblk --noheadings --output NAME --path --list /dev/sdd /dev/sdd /dev/mapper/ocs-deviceset-thin-1-data-0hmfgp-block-dmcrypt
Types ¶
type CephVolumeInventory ¶ added in v1.3.0
type CephVolumeInventory struct { Path string `json:"path"` Available bool `json:"available"` RejectedReasons json.RawMessage `json:"rejected_reasons"` SysAPI json.RawMessage `json:"sys_api"` LVS json.RawMessage `json:"lvs"` }
CephVolumeInventory represents the output of the ceph-volume inventory command
type CephVolumeLVMList ¶ added in v1.3.0
CephVolumeLVMList represents the output of the ceph-volume lvm list command
type LocalDisk ¶ added in v0.8.0
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"` // Mountpoint is the mountpoint of the filesystem's on the device Mountpoint string `json:"mountpoint"` // 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"` // Information provided by Ceph Volume Inventory CephVolumeData string `json:"cephVolumeData,omitempty"` // 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