blockdev

package
v0.0.0-...-273f5df Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VirtletLogicalDevicePrefix denotes the required prefix for
	// the virtual block devices created by Virtlet.
	VirtletLogicalDevicePrefix = "virtlet-dm-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogicalDeviceHandler

type LogicalDeviceHandler struct {
	// contains filtered or unexported fields
}

LogicalDeviceHandler makes it possible to store metadata in the first sector of a block device, making the rest of the device available as another logical device managed by the device mapper.

func NewLogicalDeviceHandler

func NewLogicalDeviceHandler(commander utils.Commander, devPath, sysfsPath string) *LogicalDeviceHandler

NewLogicalDeviceHandler creates a new LogicalDeviceHandler using the specified commander and paths that should be used in place of /dev and /sys directories (empty string to use /dev and /sys, respectively)

func (*LogicalDeviceHandler) EnsureDevHeaderMatches

func (ldh *LogicalDeviceHandler) EnsureDevHeaderMatches(devPath string, imageHash [sha256.Size]byte) (bool, error)

EnsureDevHeaderMatches returns true if the specified block device has proper Virtlet header that matches the specified image hash

func (*LogicalDeviceHandler) ListVirtletLogicalDevices

func (ldh *LogicalDeviceHandler) ListVirtletLogicalDevices() ([]string, error)

ListVirtletLogicalDevices returns a list of logical devices managed by Virtlet

func (*LogicalDeviceHandler) Map

func (ldh *LogicalDeviceHandler) Map(devPath, dmName string, imageSize uint64) error

Map maps the device sectors starting from 1 to a new virtual block device. dmName specifies the name of the new device.

func (*LogicalDeviceHandler) Unmap

func (ldh *LogicalDeviceHandler) Unmap(dmName string) error

Unmap unmaps the virtual block device

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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