sys

package
v1.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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.

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

View Source
const (
	DiskType   = "disk"
	SSDType    = "ssd"
	PartType   = "part"
	CryptType  = "crypt"
	LVMType    = "lvm"
	LinearType = "linear"
)

Variables

This section is empty.

Functions

func CheckIfDeviceAvailable added in v0.8.0

func CheckIfDeviceAvailable(executor exec.Executor, name string, pvcBacked bool) (int, 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. The return values are the number of partitions, whether Rook has created partitions on the device in the past possibly from the same or a previous cluster, the filesystem found, or an err if failed to retrieve the properties.

func CheckKernelModuleParam added in v0.5.0

func CheckKernelModuleParam(name, param string, executor pkgexec.Executor) (bool, error)

func CreatePartitions added in v0.3.0

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

func FormatDevice

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

func GetDeviceFilesystems

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

get the file systems available

func GetDeviceProperties

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

func GetDevicePropertiesFromPath added in v0.4.0

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

func GetDiskUUID

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

look up the UUID for a disk.

func GetPartitionLabel added in v0.5.0

func GetPartitionLabel(deviceName string, executor exec.Executor) (string, error)

func GetUdevInfo added in v0.8.0

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

func Grep added in v0.5.0

func Grep(input, searchFor string) string

grep finds the *first* line that matches, rather than multiple lines

func IsBuiltinKernelModule added in v0.9.0

func IsBuiltinKernelModule(name string, executor pkgexec.Executor) (bool, error)

func ListDevices

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

func LoadKernelModule added in v0.5.0

func LoadKernelModule(name string, options []string, executor pkgexec.Executor) error

func MountDevice

func MountDevice(devicePath, mountPath string, executor exec.Executor) error

func MountDeviceWithOptions

func MountDeviceWithOptions(devicePath, mountPath, fstype, options string, executor exec.Executor) error

comma-separated list of mount options passed directly to mount command

func RemovePartitions added in v0.3.0

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

func RookOwnsPartitions added in v0.8.0

func RookOwnsPartitions(partitions []Partition) bool

RookOwnsPartitions check if all partitions in list are owned by Rook

func UnmountDevice

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

Types

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"`
	// 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"`
}

LocalDevice contains information about an unformatted block device

type Partition added in v0.3.0

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

func GetDevicePartitions added in v0.3.0

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

Jump to

Keyboard shortcuts

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