nbd

package
v2.0.0-...-da0b90c Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

nbd provides methods for working with Network Block Devices. This relies on the nbd kernel module which can be checked for using the Ready() function.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDeviceAvailable = errors.New("no available nbds found")
)
View Source
var ExternalDependencies = []string{
	"lsmod",
	"modprobe",
	"qemu-nbd",
}

Functions

func ConnectImage

func ConnectImage(image string) (string, error)

ConnectImage exports a image using the NBD protocol using the qemu-nbd. If successful, returns the NBD device.

func DisconnectDevice

func DisconnectDevice(dev string) error

DisconnectDevice disconnects a given NBD using qemu-nbd.

func GetDevice

func GetDevice() (string, error)

GetDevice returns the first available NBD. If there are no devices available, returns ErrNoDeviceAvailable.

func Modprobe

func Modprobe() error

func Ready

func Ready() error

Ready checks to see if the NBD kernel module has been loaded. If it does not find the module, it returns an error. NBD functions should only be used after this function returns no error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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