Documentation ¶
Overview ¶
This package is a general abstraction on top of the official rbd/rados libraries in order to make the creation of blockdevices simpler.
Index ¶
- Constants
- func RunCommand(name string, args ...string) (string, error)
- type Connection
- type Device
- func (d *Device) Format() error
- func (d *Device) GetFileSystemType() (string, error)
- func (d *Device) GetMountPoint() string
- func (d *Device) GetPath() string
- func (d *Device) IsAlreadyFormatted() bool
- func (d *Device) Mount(mountPoint string) (string, error)
- func (d *Device) UnMap() error
- func (d *Device) UnMount() error
- type Image
Constants ¶
const ( DefaultPoolName = "rbd" DefaultFileSystemType = "xfs" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶
This struct represents a connection to the ceph cluster
func NewConnection ¶
func NewConnection(username string, pool string, cluster string, configFile string) (*Connection, error)
Creates a new connection to a Ceph cluster, this connection could be shutdown by defering the `Shutdown` method.
func (*Connection) GetImageByName ¶
func (c *Connection) GetImageByName(name string) (*Image, error)
This method retrieves an image from the pool given the `name`
func (*Connection) GetMappedDevices ¶
func (c *Connection) GetMappedDevices() (map[string]string, error)
This method lists all the mapped devices available on the system as seen by the output of the 'rbd showmapped' command
func (*Connection) GetOrCreateImage ¶
func (c *Connection) GetOrCreateImage(name string, size uint64) (*Image, error)
This method tries to fetch the given `name` from the ceph pool, if is not found it creates a new one using the given `size` parameter.
func (*Connection) Shutdown ¶
func (c *Connection) Shutdown()
This method destroys the connection context and the connection itself.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
This structure represents a local device mapped on the system.
func (*Device) GetFileSystemType ¶
This method returns the filesystem type using blkid of a given device.
func (*Device) IsAlreadyFormatted ¶
This method checks if the current filesystem for a given device matches the expected fileSystemType.
func (*Device) Mount ¶
This method mounts a `Device` on the given Mountpoint, it returns and error if is already mounted or has been already formatted.
type Image ¶
type Image struct { *rbd.Image *rbd.ImageInfo *Connection // contains filtered or unexported fields }
This struct represents a RBD Image
func NewImage ¶
This is a constructor for `Image`, this also opens an image descriptor, and performs an Stat on it.
func (*Image) IsAlreadyMapped ¶
This methods returns the current device path of a given device is if mapped, otherwise it returns an empty string