storage

package
v0.0.0-...-194264a Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoDevice is returned from a driver
	ErrNoDevice = errors.New("Not able to create device")
)

Functions

This section is empty.

Types

type BlockDevice

type BlockDevice struct {
	ID        string `json:"id"`         // device UUID
	Bootable  bool   `json:"bootable"`   // hypervisor hint, Cinder relic
	BootIndex int    `json:"boot_index"` // boot order 0..N
	Ephemeral bool   `json:"ephemeral"`  // delete on termination
	Local     bool   `json:"local"`      // local (ephemeral) or volume service backed
	Swap      bool   `json:"swap"`       // linux swap device (attempt swapon via cloudinit)
	Tag       string `json:"-"`          // arbitrary text identifier
	Size      int    `json:"size"`       // size in GiB
}

BlockDevice contains information about a block device

type BlockDriver

type BlockDriver interface {
	CreateBlockDevice(volumeUUID string, image string, sizeGB int) (BlockDevice, error)
	CreateBlockDeviceFromSnapshot(volumeUUID string, snapshotID string) (BlockDevice, error)
	CreateBlockDeviceSnapshot(volumeUUID string, snapshotID string) error
	DeleteBlockDevice(string) error
	DeleteBlockDeviceSnapshot(volumeUUID string, snapshotID string) error
	MapVolumeToNode(volumeUUID string) (string, error)
	UnmapVolumeFromNode(volumeUUID string) error
	GetVolumeMapping() (map[string][]string, error)
	CopyBlockDevice(string) (BlockDevice, error)
	GetBlockDeviceSize(volumeUUID string) (uint64, error)
	IsValidSnapshotUUID(string) error
	Resize(volumeUUID string, sizeGiB int) (int, error)
}

BlockDriver is the interface that all block drivers must implement.

type CephDriver

type CephDriver struct {
	// ID is the cephx user ID to use
	ID string
}

CephDriver maintains context for the ceph driver interface.

func (CephDriver) CopyBlockDevice

func (d CephDriver) CopyBlockDevice(volumeUUID string) (BlockDevice, error)

CopyBlockDevice will copy an existing volume

func (CephDriver) CreateBlockDevice

func (d CephDriver) CreateBlockDevice(volumeUUID string, imagePath string, size int) (BlockDevice, error)

CreateBlockDevice will create a rbd image in the ceph cluster.

func (CephDriver) CreateBlockDeviceFromSnapshot

func (d CephDriver) CreateBlockDeviceFromSnapshot(volumeUUID string, snapshotID string) (BlockDevice, error)

CreateBlockDeviceFromSnapshot will create a block device derived from the previously created snapshot.

func (CephDriver) CreateBlockDeviceSnapshot

func (d CephDriver) CreateBlockDeviceSnapshot(volumeUUID string, snapshotID string) error

CreateBlockDeviceSnapshot creates and protects the snapshot with the provided name

func (CephDriver) DeleteBlockDevice

func (d CephDriver) DeleteBlockDevice(volumeUUID string) error

DeleteBlockDevice will remove a rbd image from the ceph cluster.

func (CephDriver) DeleteBlockDeviceSnapshot

func (d CephDriver) DeleteBlockDeviceSnapshot(volumeUUID string, snapshotID string) error

DeleteBlockDeviceSnapshot unprotects and deletes the snapshot with the provided name

func (CephDriver) GetBlockDeviceSize

func (d CephDriver) GetBlockDeviceSize(volumeUUID string) (uint64, error)

GetBlockDeviceSize returns the number of bytes used by the block device

func (CephDriver) GetVolumeMapping

func (d CephDriver) GetVolumeMapping() (map[string][]string, error)

GetVolumeMapping returns a map of volumeUUID to mapped devices.

func (CephDriver) IsValidSnapshotUUID

func (d CephDriver) IsValidSnapshotUUID(snapshotUUID string) error

IsValidSnapshotUUID returns true if the uuid matches the ciao/ceph expected form of {UUID}@{UUID}

func (CephDriver) MapVolumeToNode

func (d CephDriver) MapVolumeToNode(volumeUUID string) (string, error)

MapVolumeToNode maps a ceph volume to a rbd device on a node. The path to the new device is returned if the mapping succeeds.

func (CephDriver) Resize

func (d CephDriver) Resize(volumeUUID string, sizeGiB int) (int, error)

Resize the underlying rbd image. Only extending is permitted. Returns the new size in GiB.

func (CephDriver) UnmapVolumeFromNode

func (d CephDriver) UnmapVolumeFromNode(volumeUUID string) error

UnmapVolumeFromNode unmaps a ceph volume from a local device on a node.

type NoopDriver

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

NoopDriver is a driver which does nothing.

func (*NoopDriver) CopyBlockDevice

func (d *NoopDriver) CopyBlockDevice(string) (BlockDevice, error)

CopyBlockDevice pretends to copy an existing block device

func (*NoopDriver) CreateBlockDevice

func (d *NoopDriver) CreateBlockDevice(volumeUUID string, image string, size int) (BlockDevice, error)

CreateBlockDevice pretends to create a block device.

func (*NoopDriver) CreateBlockDeviceFromSnapshot

func (d *NoopDriver) CreateBlockDeviceFromSnapshot(volumeUUID string, snapshotID string) (BlockDevice, error)

CreateBlockDeviceFromSnapshot pretends to create a block device snapshot

func (*NoopDriver) CreateBlockDeviceSnapshot

func (d *NoopDriver) CreateBlockDeviceSnapshot(volumeUUID string, snapshotID string) error

CreateBlockDeviceSnapshot pretends to create a block device snapshot

func (*NoopDriver) DeleteBlockDevice

func (d *NoopDriver) DeleteBlockDevice(string) error

DeleteBlockDevice pretends to delete a block device.

func (*NoopDriver) DeleteBlockDeviceSnapshot

func (d *NoopDriver) DeleteBlockDeviceSnapshot(volumeUUID string, snapshotID string) error

DeleteBlockDeviceSnapshot pretends to create a block device snapshot

func (*NoopDriver) GetBlockDeviceSize

func (d *NoopDriver) GetBlockDeviceSize(volumeUUID string) (uint64, error)

GetBlockDeviceSize pretends to return the number of bytes used by the block device

func (*NoopDriver) GetVolumeMapping

func (d *NoopDriver) GetVolumeMapping() (map[string][]string, error)

GetVolumeMapping returns an empty slice, indicating no devices are mapped to the specified volume.

func (*NoopDriver) IsValidSnapshotUUID

func (d *NoopDriver) IsValidSnapshotUUID(snapshotUUID string) error

IsValidSnapshotUUID checks for the Ciao standard snapshot uuid form of {UUID}@{UUID}

func (*NoopDriver) MapVolumeToNode

func (d *NoopDriver) MapVolumeToNode(volumeUUID string) (string, error)

MapVolumeToNode pretends to map a volume to a local device on a node.

func (*NoopDriver) Resize

func (d *NoopDriver) Resize(volumeUUID string, sizeGiB int) (int, error)

Resize the underlying rbd image. Only extending is permitted.

func (*NoopDriver) UnmapVolumeFromNode

func (d *NoopDriver) UnmapVolumeFromNode(volumeUUID string) error

UnmapVolumeFromNode pretends to unmap a volume from a local device on a node.

Jump to

Keyboard shortcuts

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