buse

package
v0.0.0-...-6e535ca Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

README

What is BUSE?

BUSE is a block driver in user space. It leverages NBD to provide block volume access to a container. In the back, it writes data out to a local file.

Using BUSE

Declare buse as a driver in your OSD config file as such:

---
osd:
  cluster:
    nodeid: "1"
    clusterid: "deadbeeef"
  drivers:
    buse:

BUSE relies on NBD to export block devices. Therefore, remember to modprobe nbd.

Roadmap

BUSE will add support for the Docker Graph driver. You will be able to store Docker images on a distributed multi host Docker cluster and have updates made available from within the local cluster.

Future revs of BUSE will include replication to a host based on the cluster API. It will log transactions to a local database and synchronously replicate blocks to a peer BUSE driver.

With this version of BUSE you should be able to use Docker in a multi host - shared nothing storage cluster.

Documentation

Overview

Package buse uses the Linux NBD layer to emulate a block device in user space

Index

Constants

View Source
const (
	Name          = "buse"
	Type          = api.Block
	BuseDBKey     = "OpenStorageBuseKey"
	BuseMountPath = "/var/lib/openstorage/buse/"
)
View Source
const (
	// Defined in <linux/fs.h>:
	BLKROSET = 4701
	// Defined in <linux/nbd.h>:
	NBD_SET_SOCK        = 43776
	NBD_SET_BLKSIZE     = 43777
	NBD_SET_SIZE        = 43778
	NBD_CONNECT         = 43779
	NBD_CLEAR_SOCK      = 43780
	NBD_CLEAR_QUE       = 43781
	NBD_PRINT_DEBUG     = 43782
	NBD_SET_SIZE_BLOCKS = 43783
	NBD_DISCONNECT      = 43784
	NBD_SET_TIMEOUT     = 43785
	NBD_SET_FLAGS       = 43786
	// enum
	NBD_CMD_READ  = 0
	NBD_CMD_WRITE = 1
	NBD_CMD_DISC  = 2
	NBD_CMD_FLUSH = 3
	NBD_CMD_TRIM  = 4
	// values for flags field
	NBD_FLAG_HAS_FLAGS  = (1 << 0) // nbd-server supports flags
	NBD_FLAG_READ_ONLY  = (1 << 1) // device is read-only
	NBD_FLAG_SEND_FLUSH = (1 << 2) // can flush writeback cache
	NBD_FLAG_SEND_FUA   = (1 << 3) // Send FUA (Force Unit Access)
	NBD_FLAG_ROTATIONAL = (1 << 4) // Use elevator algorithm - rotational media
	NBD_FLAG_SEND_TRIM  = (1 << 5) // Send TRIM (discard)

	// These are sent over the network in the request/reply magic fields
	NBD_REQUEST_MAGIC = 0x25609513
	NBD_REPLY_MAGIC   = 0x67446698
)

Variables

This section is empty.

Functions

func Init

Types

type Device

type Device interface {
	ReadAt(b []byte, off int64) (n int, err error)
	WriteAt(b []byte, off int64) (n int, err error)
}

Device interface is a subset of os.File.

type NBD

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

func Create

func Create(device Device, size int64) *NBD

func (*NBD) Connect

func (nbd *NBD) Connect() (dev string, err error)

Connect the network block device.

func (*NBD) Disconnect

func (nbd *NBD) Disconnect()

func (*NBD) GetSize

func (nbd *NBD) GetSize() int64

Get the size of the NBD.

func (*NBD) IsConnected

func (nbd *NBD) IsConnected() bool

Return true if connected.

func (*NBD) Size

func (nbd *NBD) Size(size int64) (err error)

Set the size of the NBD.

Jump to

Keyboard shortcuts

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