rbd

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 12 Imported by: 40

Documentation

Overview

Package rbd contains a set of wrappers around Ceph's librbd API.

Index

Constants

View Source
const (
	// ExcludeParent will exclude the parent from the diff.
	ExcludeParent = DiffIncludeParent(0)
	// IncludeParent will include the parent in the diff.
	IncludeParent = DiffIncludeParent(1)

	// DisableWholeObject will not use the whole object in the diff.
	DisableWholeObject = DiffWholeObject(0)
	// EnableWholeObject will use the whole object in the diff.
	EnableWholeObject = DiffWholeObject(1)
)
View Source
const (
	EncryptionAlgorithmAES128 = EncryptionAlgorithm(C.RBD_ENCRYPTION_ALGORITHM_AES128)
	EncryptionAlgorithmAES256 = EncryptionAlgorithm(C.RBD_ENCRYPTION_ALGORITHM_AES256)
)

Possible values for EncryptionAlgorithm: EncryptionAlgorithmAES128: AES 128bits EncryptionAlgorithmAES256: AES 256bits

View Source
const (

	// FeatureLayering is the representation of RBD_FEATURE_LAYERING from
	// librbd
	FeatureLayering = uint64(C.RBD_FEATURE_LAYERING)

	// FeatureStripingV2 is the representation of RBD_FEATURE_STRIPINGV2
	// from librbd
	FeatureStripingV2 = uint64(C.RBD_FEATURE_STRIPINGV2)

	// FeatureExclusiveLock is the representation of
	// RBD_FEATURE_EXCLUSIVE_LOCK from librbd
	FeatureExclusiveLock = uint64(C.RBD_FEATURE_EXCLUSIVE_LOCK)

	// FeatureObjectMap is the representation of RBD_FEATURE_OBJECT_MAP
	// from librbd
	FeatureObjectMap = uint64(C.RBD_FEATURE_OBJECT_MAP)

	// FeatureFastDiff is the representation of RBD_FEATURE_FAST_DIFF from
	// librbd
	FeatureFastDiff = uint64(C.RBD_FEATURE_FAST_DIFF)

	// FeatureDeepFlatten is the representation of RBD_FEATURE_DEEP_FLATTEN
	// from librbd
	FeatureDeepFlatten = uint64(C.RBD_FEATURE_DEEP_FLATTEN)

	// FeatureJournaling is the representation of RBD_FEATURE_JOURNALING
	// from librbd
	FeatureJournaling = uint64(C.RBD_FEATURE_JOURNALING)

	// FeatureDataPool is the representation of RBD_FEATURE_DATA_POOL from
	// librbd
	FeatureDataPool = uint64(C.RBD_FEATURE_DATA_POOL)

	// FeatureOperations is the representation of RBD_FEATURE_OPERATIONS
	// from librbd
	FeatureOperations = uint64(C.RBD_FEATURE_OPERATIONS)

	// FeatureNameLayering is the representation of
	// RBD_FEATURE_NAME_LAYERING from librbd
	FeatureNameLayering = C.RBD_FEATURE_NAME_LAYERING

	// FeatureNameStripingV2 is the representation of
	// RBD_FEATURE_NAME_STRIPINGV2 from librbd
	FeatureNameStripingV2 = C.RBD_FEATURE_NAME_STRIPINGV2

	// FeatureNameExclusiveLock is the representation of
	// RBD_FEATURE_NAME_EXCLUSIVE_LOCK from librbd
	FeatureNameExclusiveLock = C.RBD_FEATURE_NAME_EXCLUSIVE_LOCK

	// FeatureNameObjectMap is the representation of
	// RBD_FEATURE_NAME_OBJECT_MAP from librbd
	FeatureNameObjectMap = C.RBD_FEATURE_NAME_OBJECT_MAP

	// FeatureNameFastDiff is the representation of
	// RBD_FEATURE_NAME_FAST_DIFF from librbd
	FeatureNameFastDiff = C.RBD_FEATURE_NAME_FAST_DIFF

	// FeatureNameDeepFlatten is the representation of
	// RBD_FEATURE_NAME_DEEP_FLATTEN from librbd
	FeatureNameDeepFlatten = C.RBD_FEATURE_NAME_DEEP_FLATTEN

	// FeatureNameJournaling is the representation of
	// RBD_FEATURE_NAME_JOURNALING from librbd
	FeatureNameJournaling = C.RBD_FEATURE_NAME_JOURNALING

	// FeatureNameDataPool is the representation of
	// RBD_FEATURE_NAME_DATA_POOL from librbd
	FeatureNameDataPool = C.RBD_FEATURE_NAME_DATA_POOL

	// FeatureNameOperations is the representation of
	// RBD_FEATURE_NAME_OPERATIONS from librbd
	FeatureNameOperations = C.RBD_FEATURE_NAME_OPERATIONS

	// RbdFeatureLayering deprecated alias for FeatureLayering
	RbdFeatureLayering = FeatureLayering
	// RbdFeatureStripingV2 deprecated alias for FeatureStripingV2
	RbdFeatureStripingV2 = FeatureStripingV2
	// RbdFeatureExclusiveLock deprecated alias for FeatureExclusiveLock
	RbdFeatureExclusiveLock = FeatureExclusiveLock
	// RbdFeatureObjectMap deprecated alias for FeatureObjectMap
	RbdFeatureObjectMap = FeatureObjectMap
	// RbdFeatureFastDiff deprecated alias for FeatureFastDiff
	RbdFeatureFastDiff = FeatureFastDiff
	// RbdFeatureDeepFlatten deprecated alias for FeatureDeepFlatten
	RbdFeatureDeepFlatten = FeatureDeepFlatten
	// RbdFeatureJournaling deprecated alias for FeatureJournaling
	RbdFeatureJournaling = FeatureJournaling
	// RbdFeatureDataPool deprecated alias for FeatureDataPool
	RbdFeatureDataPool = FeatureDataPool

	// revive:disable:exported Maybe unused
	// the following are probably really unused?
	RbdFeaturesDefault        = uint64(C.RBD_FEATURES_DEFAULT)
	RbdFeaturesIncompatible   = uint64(C.RBD_FEATURES_INCOMPATIBLE)
	RbdFeaturesRwIncompatible = uint64(C.RBD_FEATURES_RW_INCOMPATIBLE)
	RbdFeaturesMutable        = uint64(C.RBD_FEATURES_MUTABLE)
	RbdFeaturesSingleClient   = uint64(C.RBD_FEATURES_SINGLE_CLIENT)
)
View Source
const (
	// FeatureMigrating is the representation of RBD_FEATURE_MIGRATING from
	// librbd
	FeatureMigrating = uint64(C.RBD_FEATURE_MIGRATING)

	// FeatureNameMigrating is the representation of
	// RBD_FEATURE_NAME_MIGRATING from librbd
	FeatureNameMigrating = C.RBD_FEATURE_NAME_MIGRATING
)
View Source
const (
	// GroupImageStateAttached is equivalent to RBD_GROUP_IMAGE_STATE_ATTACHED
	GroupImageStateAttached = GroupImageState(C.RBD_GROUP_IMAGE_STATE_ATTACHED)
	// GroupImageStateIncomplete is equivalent to RBD_GROUP_IMAGE_STATE_INCOMPLETE
	GroupImageStateIncomplete = GroupImageState(C.RBD_GROUP_IMAGE_STATE_INCOMPLETE)
)
View Source
const (
	// GroupSnapStateIncomplete is equivalent to RBD_GROUP_SNAP_STATE_INCOMPLETE.
	GroupSnapStateIncomplete = GroupSnapState(C.RBD_GROUP_SNAP_STATE_INCOMPLETE)
	// GroupSnapStateComplete is equivalent to RBD_GROUP_SNAP_STATE_COMPLETE.
	GroupSnapStateComplete = GroupSnapState(C.RBD_GROUP_SNAP_STATE_COMPLETE)
)
View Source
const (
	// MirrorModeDisabled disables mirroring.
	MirrorModeDisabled = MirrorMode(C.RBD_MIRROR_MODE_DISABLED)
	// MirrorModeImage enables mirroring on a per-image basis.
	MirrorModeImage = MirrorMode(C.RBD_MIRROR_MODE_IMAGE)
	// MirrorModePool enables mirroring on all journaled images.
	MirrorModePool = MirrorMode(C.RBD_MIRROR_MODE_POOL)
)
View Source
const (
	// ImageMirrorModeJournal uses journaling to propagate RBD images between
	// ceph clusters.
	ImageMirrorModeJournal = ImageMirrorMode(C.RBD_MIRROR_IMAGE_MODE_JOURNAL)
	// ImageMirrorModeSnapshot uses snapshots to propagate RBD images between
	// ceph clusters.
	ImageMirrorModeSnapshot = ImageMirrorMode(C.RBD_MIRROR_IMAGE_MODE_SNAPSHOT)
)
View Source
const (
	// MirrorImageDisabling is the representation of
	// RBD_MIRROR_IMAGE_DISABLING from librbd.
	MirrorImageDisabling = MirrorImageState(C.RBD_MIRROR_IMAGE_DISABLING)
	// MirrorImageEnabled is the representation of
	// RBD_MIRROR_IMAGE_ENABLED from librbd.
	MirrorImageEnabled = MirrorImageState(C.RBD_MIRROR_IMAGE_ENABLED)
	// MirrorImageDisabled is the representation of
	// RBD_MIRROR_IMAGE_DISABLED from librbd.
	MirrorImageDisabled = MirrorImageState(C.RBD_MIRROR_IMAGE_DISABLED)
)
View Source
const (
	// MirrorImageStatusStateUnknown is equivalent to MIRROR_IMAGE_STATUS_STATE_UNKNOWN
	MirrorImageStatusStateUnknown = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_UNKNOWN)
	// MirrorImageStatusStateError is equivalent to MIRROR_IMAGE_STATUS_STATE_ERROR
	MirrorImageStatusStateError = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_ERROR)
	// MirrorImageStatusStateSyncing is equivalent to MIRROR_IMAGE_STATUS_STATE_SYNCING
	MirrorImageStatusStateSyncing = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_SYNCING)
	// MirrorImageStatusStateStartingReplay is equivalent to MIRROR_IMAGE_STATUS_STATE_STARTING_REPLAY
	MirrorImageStatusStateStartingReplay = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_STARTING_REPLAY)
	// MirrorImageStatusStateReplaying is equivalent to MIRROR_IMAGE_STATUS_STATE_REPLAYING
	MirrorImageStatusStateReplaying = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_REPLAYING)
	// MirrorImageStatusStateStoppingReplay is equivalent to MIRROR_IMAGE_STATUS_STATE_STOPPING_REPLAY
	MirrorImageStatusStateStoppingReplay = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_STOPPING_REPLAY)
	// MirrorImageStatusStateStopped is equivalent to MIRROR_IMAGE_STATUS_STATE_STOPPED
	MirrorImageStatusStateStopped = MirrorImageStatusState(C.MIRROR_IMAGE_STATUS_STATE_STOPPED)
)
View Source
const (
	// MirrorPeerDirectionRx is equivalent to RBD_MIRROR_PEER_DIRECTION_RX
	MirrorPeerDirectionRx = MirrorPeerDirection(C.RBD_MIRROR_PEER_DIRECTION_RX)
	// MirrorPeerDirectionTx is equivalent to RBD_MIRROR_PEER_DIRECTION_TX
	MirrorPeerDirectionTx = MirrorPeerDirection(C.RBD_MIRROR_PEER_DIRECTION_TX)
	// MirrorPeerDirectionRxTx is equivalent to RBD_MIRROR_PEER_DIRECTION_RX_TX
	MirrorPeerDirectionRxTx = MirrorPeerDirection(C.RBD_MIRROR_PEER_DIRECTION_RX_TX)
)
View Source
const (

	// ImageOptionFormat is the representation of RBD_IMAGE_OPTION_FORMAT from
	// librbd
	ImageOptionFormat = C.RBD_IMAGE_OPTION_FORMAT
	// ImageOptionFeatures is the representation of RBD_IMAGE_OPTION_FEATURES
	// from librbd
	ImageOptionFeatures = C.RBD_IMAGE_OPTION_FEATURES
	// ImageOptionOrder is the representation of RBD_IMAGE_OPTION_ORDER from
	// librbd
	ImageOptionOrder = C.RBD_IMAGE_OPTION_ORDER
	// ImageOptionStripeUnit is the representation of
	// RBD_IMAGE_OPTION_STRIPE_UNIT from librbd
	ImageOptionStripeUnit = C.RBD_IMAGE_OPTION_STRIPE_UNIT
	// ImageOptionStripeCount is the representation of
	// RBD_IMAGE_OPTION_STRIPE_COUNT from librbd
	ImageOptionStripeCount = C.RBD_IMAGE_OPTION_STRIPE_COUNT
	// ImageOptionJournalOrder is the representation of
	// RBD_IMAGE_OPTION_JOURNAL_ORDER from librbd
	ImageOptionJournalOrder = C.RBD_IMAGE_OPTION_JOURNAL_ORDER
	// ImageOptionJournalSplayWidth is the representation of
	// RBD_IMAGE_OPTION_JOURNAL_SPLAY_WIDTH from librbd
	ImageOptionJournalSplayWidth = C.RBD_IMAGE_OPTION_JOURNAL_SPLAY_WIDTH
	// ImageOptionJournalPool is the representation of
	// RBD_IMAGE_OPTION_JOURNAL_POOL from librbd
	ImageOptionJournalPool = C.RBD_IMAGE_OPTION_JOURNAL_POOL
	// ImageOptionFeaturesSet is the representation of
	// RBD_IMAGE_OPTION_FEATURES_SET from librbd
	ImageOptionFeaturesSet = C.RBD_IMAGE_OPTION_FEATURES_SET
	// ImageOptionFeaturesClear is the representation of
	// RBD_IMAGE_OPTION_FEATURES_CLEAR from librbd
	ImageOptionFeaturesClear = C.RBD_IMAGE_OPTION_FEATURES_CLEAR
	// ImageOptionDataPool is the representation of RBD_IMAGE_OPTION_DATA_POOL
	// from librbd
	ImageOptionDataPool = C.RBD_IMAGE_OPTION_DATA_POOL
	// ImageOptionFlatten is the representation of RBD_IMAGE_OPTION_FLATTEN
	// from librbd
	ImageOptionFlatten = C.RBD_IMAGE_OPTION_FLATTEN
	// ImageOptionCloneFormat is the representation of
	// RBD_IMAGE_OPTION_CLONE_FORMAT from librbd
	ImageOptionCloneFormat = C.RBD_IMAGE_OPTION_CLONE_FORMAT

	// RbdImageOptionFormat deprecated alias for ImageOptionFormat
	RbdImageOptionFormat = ImageOptionFormat
	// RbdImageOptionFeatures deprecated alias for ImageOptionFeatures
	RbdImageOptionFeatures = ImageOptionFeatures
	// RbdImageOptionOrder deprecated alias for ImageOptionOrder
	RbdImageOptionOrder = ImageOptionOrder
	// RbdImageOptionStripeUnit deprecated alias for ImageOptionStripeUnit
	RbdImageOptionStripeUnit = ImageOptionStripeUnit
	// RbdImageOptionStripeCount deprecated alias for ImageOptionStripeCount
	RbdImageOptionStripeCount = ImageOptionStripeCount
	// RbdImageOptionJournalOrder deprecated alias for ImageOptionJournalOrder
	RbdImageOptionJournalOrder = ImageOptionJournalOrder
	// RbdImageOptionJournalSplayWidth deprecated alias for
	RbdImageOptionJournalSplayWidth = ImageOptionJournalSplayWidth
	// RbdImageOptionJournalPool deprecated alias for ImageOptionJournalPool
	RbdImageOptionJournalPool = ImageOptionJournalPool
	// RbdImageOptionFeaturesSet deprecated alias for ImageOptionFeaturesSet
	RbdImageOptionFeaturesSet = ImageOptionFeaturesSet
	// RbdImageOptionFeaturesClear deprecated alias for ImageOptionFeaturesClear
	RbdImageOptionFeaturesClear = ImageOptionFeaturesClear
	// RbdImageOptionDataPool deprecated alias for ImageOptionDataPool
	RbdImageOptionDataPool = ImageOptionDataPool
)
View Source
const (
	// PoolStatOptionImages is the representation of
	// RBD_POOL_STAT_OPTION_IMAGES from librbd.
	PoolStatOptionImages = PoolStatOption(C.RBD_POOL_STAT_OPTION_IMAGES)
	// PoolStatOptionImageProvisionedBytes is the representation of
	// RBD_POOL_STAT_OPTION_IMAGE_PROVISIONED_BYTES from librbd.
	PoolStatOptionImageProvisionedBytes = PoolStatOption(C.RBD_POOL_STAT_OPTION_IMAGE_PROVISIONED_BYTES)
	// PoolStatOptionImageMaxProvisionedBytes is the representation of
	// RBD_POOL_STAT_OPTION_IMAGE_MAX_PROVISIONED_BYTES from librbd.
	PoolStatOptionImageMaxProvisionedBytes = PoolStatOption(C.RBD_POOL_STAT_OPTION_IMAGE_MAX_PROVISIONED_BYTES)
	// PoolStatOptionImageSnapshots is the representation of
	// RBD_POOL_STAT_OPTION_IMAGE_SNAPSHOTS from librbd.
	PoolStatOptionImageSnapshots = PoolStatOption(C.RBD_POOL_STAT_OPTION_IMAGE_SNAPSHOTS)
	// PoolStatOptionTrashImages is the representation of
	// RBD_POOL_STAT_OPTION_TRASH_IMAGES from librbd.
	PoolStatOptionTrashImages = PoolStatOption(C.RBD_POOL_STAT_OPTION_TRASH_IMAGES)
	// PoolStatOptionTrashProvisionedBytes is the representation of
	// RBD_POOL_STAT_OPTION_TRASH_PROVISIONED_BYTES from librbd.
	PoolStatOptionTrashProvisionedBytes = PoolStatOption(C.RBD_POOL_STAT_OPTION_TRASH_PROVISIONED_BYTES)
	// PoolStatOptionTrashMaxProvisionedBytes is the representation of
	// RBD_POOL_STAT_OPTION_TRASH_MAX_PROVISIONED_BYTES from librbd.
	PoolStatOptionTrashMaxProvisionedBytes = PoolStatOption(C.RBD_POOL_STAT_OPTION_TRASH_MAX_PROVISIONED_BYTES)
	// PoolStatOptionTrashSnapshots is the representation of
	// RBD_POOL_STAT_OPTION_TRASH_SNAPSHOTS from librbd.
	PoolStatOptionTrashSnapshots = PoolStatOption(C.RBD_POOL_STAT_OPTION_TRASH_SNAPSHOTS)
)
View Source
const (

	// SeekSet is used with Seek to absolutely position the file.
	SeekSet = int(C.SEEK_SET)
	// SeekCur is used with Seek to position the file relatively to the current
	// position.
	SeekCur = int(C.SEEK_CUR)
	// SeekEnd is used with Seek to position the file relatively to the end.
	SeekEnd = int(C.SEEK_END)
)
View Source
const (
	// SnapNamespaceTypeUser indicates that the snapshot belongs to user namespace.
	SnapNamespaceTypeUser = SnapNamespaceType(C.RBD_SNAP_NAMESPACE_TYPE_USER)

	// SnapNamespaceTypeGroup indicates that the snapshot belongs to group namespace.
	// Such snapshots will have associated group information.
	SnapNamespaceTypeGroup = SnapNamespaceType(C.RBD_SNAP_NAMESPACE_TYPE_GROUP)

	// SnapNamespaceTypeTrash indicates that the snapshot belongs to trash namespace.
	SnapNamespaceTypeTrash = SnapNamespaceType(C.RBD_SNAP_NAMESPACE_TYPE_TRASH)
)
View Source
const (
	// ErrNotExist indicates a non-specific missing resource.
	ErrNotExist = rbdError(-C.ENOENT)
)

Public general error

View Source
const (
	// ImageOptionMirrorImageMode is the representation of
	// RBD_IMAGE_OPTION_MIRROR_IMAGE_MODE from librbd
	ImageOptionMirrorImageMode = C.RBD_IMAGE_OPTION_MIRROR_IMAGE_MODE
)
View Source
const (

	// NoSnapshot indicates that no snapshot name is in use (see OpenImage)
	NoSnapshot = ""
)

bits for Image.validate() and Snapshot.validate()

Variables

View Source
var (
	// ErrNoIOContext may be returned if an api call requires an IOContext and
	// it is not provided.
	ErrNoIOContext = errors.New("IOContext is missing")
	// ErrNoName may be returned if an api call requires a name and it is
	// not provided.
	ErrNoName = errors.New("RBD image does not have a name")
	// ErrSnapshotNoName may be returned if an api call requires a snapshot
	// name and it is not provided.
	ErrSnapshotNoName = errors.New("RBD snapshot does not have a name")
	// ErrImageNotOpen may be returned if an api call requires an open image handle and one is not provided.
	ErrImageNotOpen = errors.New("RBD image not open")
	// ErrImageIsOpen may be returned if an api call requires a closed image handle and one is not provided.
	ErrImageIsOpen = errors.New("RBD image is open")
	// ErrNotFound may be returned from an api call when the requested item is
	// missing.
	ErrNotFound = errors.New("RBD image not found")
	// ErrNoNamespaceName maye be returned if an api call requires a namespace
	// name and it is not provided.
	ErrNoNamespaceName = errors.New("Namespace value is missing")

	// revive:disable:exported for compatibility with old versions
	RbdErrorImageNotOpen = ErrImageNotOpen
	RbdErrorNotFound     = ErrNotFound
)

Functions

func CloneFromImage

func CloneFromImage(parent *Image, snapName string,
	destctx *rados.IOContext, name string, rio *ImageOptions) error

CloneFromImage creates a clone of the image from the named snapshot in the provided io-context with the given name and image options. This function is a convenience wrapper around CloneImage to support cloning from an existing Image.

func CloneImage

func CloneImage(ioctx *rados.IOContext, parentName, snapName string,
	destctx *rados.IOContext, name string, rio *ImageOptions) error

CloneImage creates a clone of the image from the named snapshot in the provided io-context with the given name and image options.

Implements:

int rbd_clone3(rados_ioctx_t p_ioctx, const char *p_name,
               const char *p_snapname, rados_ioctx_t c_ioctx,
               const char *c_name, rbd_image_options_t c_opts);

func CreateImage

func CreateImage(ioctx *rados.IOContext, name string, size uint64, rio *ImageOptions) error

CreateImage creates a new rbd image using provided image options.

Implements:

int rbd_create4(rados_ioctx_t io, const char *name, uint64_t size,
               rbd_image_options_t opts);

func CreateMirrorPeerBootstrapToken added in v0.10.0

func CreateMirrorPeerBootstrapToken(ioctx *rados.IOContext) (string, error)

CreateMirrorPeerBootstrapToken returns a token value, representing the cluster and pool associated with the given IO context, that can be provided to ImportMirrorPeerBootstrapToken in order to set up mirroring between pools.

Implements:

int rbd_mirror_peer_bootstrap_create(
  rados_ioctx_t io_ctx, char *token, size_t *max_len);

func GetAllPoolStats added in v0.5.0

func GetAllPoolStats(ioctx *rados.IOContext) (map[PoolStatOption]uint64, error)

GetAllPoolStats returns a map of all PoolStatOption(s) to their respective values.

Implements:

int rbd_pool_stats_get(rados_ioctx_t io, rbd_pool_stats_t stats);

func GetImageNames

func GetImageNames(ioctx *rados.IOContext) ([]string, error)

GetImageNames returns the list of current RBD images.

func GetMirrorSiteName added in v0.10.0

func GetMirrorSiteName(conn *rados.Conn) (string, error)

GetMirrorSiteName gets the site name, used for rbd mirroring, for the ceph cluster associated with the provided rados connection.

Implements: int rbd_mirror_site_name_get(rados_t cluster,

char *name, size_t *max_len);

func GetMirrorUUID added in v0.10.0

func GetMirrorUUID(ioctx *rados.IOContext) (string, error)

GetMirrorUUID returns a string naming the mirroring uuid for the pool associated with the ioctx.

Implements:

int rbd_mirror_uuid_get(rados_ioctx_t io_ctx, char *uuid, size_t
                        *max_len);

func GetPoolMetadata added in v0.4.0

func GetPoolMetadata(ioctx *rados.IOContext, key string) (string, error)

GetPoolMetadata returns pool metadata associated with the given key.

Implements:

int rbd_pool_metadata_get(rados_ioctx_t io_ctx, const char *key, char *value, size_t *val_len);

func GroupCreate added in v0.8.0

func GroupCreate(ioctx *rados.IOContext, name string) error

GroupCreate is used to create an image group.

Implements:

int rbd_group_create(rados_ioctx_t p, const char *name);

func GroupImageAdd added in v0.8.0

func GroupImageAdd(groupIoctx *rados.IOContext, groupName string,
	imageIoctx *rados.IOContext, imageName string) error

GroupImageAdd will add the specified image to the named group. An io context must be supplied for both the group and image.

Implements:

int rbd_group_image_add(rados_ioctx_t group_p,
                        const char *group_name,
                        rados_ioctx_t image_p,
                        const char *image_name);

func GroupImageRemove added in v0.8.0

func GroupImageRemove(groupIoctx *rados.IOContext, groupName string,
	imageIoctx *rados.IOContext, imageName string) error

GroupImageRemove will remove the specified image from the named group. An io context must be supplied for both the group and image.

Implements:

int rbd_group_image_remove(rados_ioctx_t group_p,
                           const char *group_name,
                           rados_ioctx_t image_p,
                           const char *image_name);

func GroupImageRemoveByID added in v0.8.0

func GroupImageRemoveByID(groupIoctx *rados.IOContext, groupName string,
	imageIoctx *rados.IOContext, imageID string) error

GroupImageRemoveByID will remove the specified image from the named group. An io context must be supplied for both the group and image.

Implements:

CEPH_RBD_API int rbd_group_image_remove_by_id(rados_ioctx_t group_p,
                                             const char *group_name,
                                             rados_ioctx_t image_p,
                                             const char *image_id);

func GroupList added in v0.8.0

func GroupList(ioctx *rados.IOContext) ([]string, error)

GroupList returns a slice of image group names.

Implements:

int rbd_group_list(rados_ioctx_t p, char *names, size_t *size);

func GroupRemove added in v0.8.0

func GroupRemove(ioctx *rados.IOContext, name string) error

GroupRemove is used to remove an image group.

Implements:

int rbd_group_remove(rados_ioctx_t p, const char *name);

func GroupRename added in v0.8.0

func GroupRename(ioctx *rados.IOContext, src, dest string) error

GroupRename will rename an existing image group.

Implements:

int rbd_group_rename(rados_ioctx_t p, const char *src_name,
                     const char *dest_name);

func GroupSnapCreate added in v0.8.0

func GroupSnapCreate(ioctx *rados.IOContext, group, snap string) error

GroupSnapCreate will create a group snapshot.

Implements:

int rbd_group_snap_create(rados_ioctx_t group_p,
                          const char *group_name,
                          const char *snap_name);

func GroupSnapRemove added in v0.8.0

func GroupSnapRemove(ioctx *rados.IOContext, group, snap string) error

GroupSnapRemove removes an existing group snapshot.

Implements:

int rbd_group_snap_remove(rados_ioctx_t group_p,
                          const char *group_name,
                          const char *snap_name);

func GroupSnapRename added in v0.8.0

func GroupSnapRename(ioctx *rados.IOContext, group, src, dest string) error

GroupSnapRename will rename an existing group snapshot.

Implements:

int rbd_group_snap_rename(rados_ioctx_t group_p,
                          const char *group_name,
                          const char *old_snap_name,
                          const char *new_snap_name);

func GroupSnapRollback added in v0.8.0

func GroupSnapRollback(ioctx *rados.IOContext, group, snap string) error

GroupSnapRollback will roll back the images in the group to that of the given snapshot.

Implements:

int rbd_group_snap_rollback(rados_ioctx_t group_p,
                            const char *group_name,
                            const char *snap_name);

func GroupSnapRollbackWithProgress added in v0.8.0

func GroupSnapRollbackWithProgress(
	ioctx *rados.IOContext, group, snap string,
	cb GroupSnapRollbackCallback, data interface{}) error

GroupSnapRollbackWithProgress will roll back the images in the group to that of given snapshot. The given progress callback will be called to report on the progress of the snapshot rollback.

Implements:

int rbd_group_snap_rollback_with_progress(rados_ioctx_t group_p,
                                          const char *group_name,
                                          const char *snap_name,
                                          librbd_progress_fn_t cb,
                                          void *cbdata);

func ImportMirrorPeerBootstrapToken added in v0.10.0

func ImportMirrorPeerBootstrapToken(
	ioctx *rados.IOContext, direction MirrorPeerDirection, token string) error

ImportMirrorPeerBootstrapToken applies the provided bootstrap token to the pool associated with the IO context to create a mirroring relationship between pools. The direction parameter controls if data in the pool is a source, destination, or both.

Implements:

int rbd_mirror_peer_bootstrap_import(
  rados_ioctx_t io_ctx, rbd_mirror_peer_direction_t direction,
  const char *token);

func MirrorImageStatusSummary added in v0.10.0

func MirrorImageStatusSummary(
	ioctx *rados.IOContext) (map[MirrorImageStatusState]uint, error)

MirrorImageStatusSummary returns a map of images statuses and the count of images with said status.

Implements:

int rbd_mirror_image_status_summary(
  rados_ioctx_t io_ctx, rbd_mirror_image_status_state_t *states, int *counts,
  size_t *maxlen);

func NamespaceCreate added in v0.4.0

func NamespaceCreate(ioctx *rados.IOContext, namespaceName string) error

NamespaceCreate creates the namespace for a given Rados IOContext.

Implements:

int rbd_namespace_create(rados_ioctx_t io, const char *namespace_name);

func NamespaceExists added in v0.4.0

func NamespaceExists(ioctx *rados.IOContext, namespaceName string) (bool, error)

NamespaceExists checks whether a given namespace exists or not.

Implements:

int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name, bool *exists);

func NamespaceList added in v0.4.0

func NamespaceList(ioctx *rados.IOContext) (names []string, err error)

NamespaceList returns a slice containing the names of existing rbd namespaces.

Implements:

int rbd_namespace_list(rados_ioctx_t io, char *namespace_names, size_t *size);

func NamespaceRemove added in v0.4.0

func NamespaceRemove(ioctx *rados.IOContext, namespaceName string) error

NamespaceRemove removes a given namespace.

Implements:

int rbd_namespace_remove(rados_ioctx_t io, const char *namespace_name);

func PoolInit added in v0.5.0

func PoolInit(ioctx *rados.IOContext, force bool) error

PoolInit initializes a pool for use by rbd. This function does not create new pools, rather it prepares the pool to host rbd images.

Implements:

int rbd_pool_init(rados_ioctx_t io, bool force)

func RemoveImage

func RemoveImage(ioctx *rados.IOContext, name string) error

RemoveImage removes the specified rbd image.

Implements:

int rbd_remove(rados_ioctx_t io, const char *name);

func RemovePoolMetadata added in v0.4.0

func RemovePoolMetadata(ioctx *rados.IOContext, key string) error

RemovePoolMetadata removes the pool metadata value for a given pool metadata key.

Implements:

int rbd_pool_metadata_remove(rados_ioctx_t io_ctx, const char *key)

func SetMirrorMode added in v0.8.0

func SetMirrorMode(ioctx *rados.IOContext, mode MirrorMode) error

SetMirrorMode is used to enable or disable pool level mirroring with either an automatic or per-image behavior.

Implements:

int rbd_mirror_mode_set(rados_ioctx_t io_ctx,
                        rbd_mirror_mode_t mirror_mode);

func SetMirrorSiteName added in v0.10.0

func SetMirrorSiteName(conn *rados.Conn, name string) error

SetMirrorSiteName sets the site name, used for rbd mirroring, for the ceph cluster associated with the provided rados connection.

Implements:

int rbd_mirror_site_name_set(rados_t cluster,
                             const char *name);

func SetPoolMetadata added in v0.4.0

func SetPoolMetadata(ioctx *rados.IOContext, key, value string) error

SetPoolMetadata updates the pool metadata string associated with the given key.

Implements:

int rbd_pool_metadata_set(rados_ioctx_t io_ctx, const char *key, const char *value);

func TrashRemove

func TrashRemove(ioctx *rados.IOContext, id string, force bool) error

TrashRemove permanently deletes the trashed RBD with the specified id.

func TrashRestore

func TrashRestore(ioctx *rados.IOContext, id, name string) error

TrashRestore restores the trashed RBD with the specified id back to the pool from whence it came, with the specified new name.

func Version

func Version() (int, int, int)

Version returns the major, minor, and patch level of the librbd library.

Types

type DiffIncludeParent added in v0.3.0

type DiffIncludeParent uint8

DiffIncludeParent values control if the difference should include the parent image.

type DiffIterateCallback added in v0.3.0

type DiffIterateCallback func(uint64, uint64, int, interface{}) int

DiffIterateCallback defines the function signature needed for the DiffIterate callback.

The function will be called with the arguments: offset, length, exists, and data. The offset and length correspond to the changed region of the image. The exists value is set to zero if the region is known to be zeros, otherwise it is set to 1. The data value is the extra data parameter that was set on the DiffIterateConfig and is meant to be used for passing arbitrary user-defined items to the callback function.

The callback can trigger the iteration to terminate early by returning a non-zero error code.

type DiffIterateConfig added in v0.3.0

type DiffIterateConfig struct {
	SnapName      string
	Offset        uint64
	Length        uint64
	IncludeParent DiffIncludeParent
	WholeObject   DiffWholeObject
	Callback      DiffIterateCallback
	Data          interface{}
}

DiffIterateConfig is used to define the parameters of a DiffIterate call. Callback, Offset, and Length should always be specified when passed to DiffIterate. The other values are optional.

type DiffWholeObject added in v0.3.0

type DiffWholeObject uint8

DiffWholeObject values control if the diff extents should cover the whole object.

type EncryptionAlgorithm added in v0.11.0

type EncryptionAlgorithm C.rbd_encryption_algorithm_t

EncryptionAlgorithm is the encryption algorithm

type EncryptionOptions added in v0.11.0

type EncryptionOptions interface {
	// contains filtered or unexported methods
}

EncryptionOptions interface is used to encapsulate the different encryption formats options and enable converting them from go to C structures.

type EncryptionOptionsLUKS1 added in v0.11.0

type EncryptionOptionsLUKS1 struct {
	Alg        EncryptionAlgorithm
	Passphrase []byte
}

EncryptionOptionsLUKS1 options required for LUKS v1

type EncryptionOptionsLUKS2 added in v0.11.0

type EncryptionOptionsLUKS2 struct {
	Alg        EncryptionAlgorithm
	Passphrase []byte
}

EncryptionOptionsLUKS2 options required for LUKS v2

type FeatureSet added in v0.3.0

type FeatureSet uint64

FeatureSet is a combination of the bit value for multiple features.

func FeatureSetFromNames added in v0.3.0

func FeatureSetFromNames(names []string) FeatureSet

FeatureSetFromNames returns a FeatureSet built from flag bits corresponding to the provided feature names.

func (*FeatureSet) Names added in v0.3.0

func (fs *FeatureSet) Names() []string

Names converts all of the enabled feature bits in the FeatureSet to a slice of strings corresponding to the names for each feature.

type GlobalMirrorImageIDAndStatus added in v0.10.0

type GlobalMirrorImageIDAndStatus struct {
	ID     string
	Status GlobalMirrorImageStatus
}

GlobalMirrorImageIDAndStatus values contain an ID string for a RBD image and that image's GlobalMirrorImageStatus.

func MirrorImageGlobalStatusList added in v0.11.0

func MirrorImageGlobalStatusList(
	ioctx *rados.IOContext, start string, max int) ([]GlobalMirrorImageIDAndStatus, error)

MirrorImageGlobalStatusList returns a slice of GlobalMirrorImageIDAndStatus. If the length of the returned slice equals max, the next chunk of the list can be obtained by setting start to the ID of the last item of the returned slice. If max is 0 a slice of all items is returned.

Implements: int rbd_mirror_image_status_list(rados_ioctx_t p,

const char *start_id, size_t max, char **image_ids,
rbd_mirror_image_status_t *images, size_t *len)

type GlobalMirrorImageStatus added in v0.9.0

type GlobalMirrorImageStatus struct {
	Name         string
	Info         MirrorImageInfo
	SiteStatuses []SiteMirrorImageStatus
}

GlobalMirrorImageStatus contains information pertaining to the global status of a mirrored image. It contains general information as well as per-site information stored in the SiteStatuses slice.

func (GlobalMirrorImageStatus) LocalStatus added in v0.9.0

func (gmis GlobalMirrorImageStatus) LocalStatus() (SiteMirrorImageStatus, error)

LocalStatus returns one SiteMirrorImageStatus item from the SiteStatuses slice that corresponds to the local site's status. If the local status is not found than the error ErrNotExist will be returned.

type GroupImageInfo added in v0.8.0

type GroupImageInfo struct {
	Name   string
	PoolID int64
	State  GroupImageState
}

GroupImageInfo reports on images within a group.

func GroupImageList added in v0.8.0

func GroupImageList(ioctx *rados.IOContext, name string) ([]GroupImageInfo, error)

GroupImageList returns a slice of GroupImageInfo types based on the images that are part of the named group.

Implements:

int rbd_group_image_list(rados_ioctx_t group_p,
                         const char *group_name,
                         rbd_group_image_info_t *images,
                         size_t group_image_info_size,
                         size_t *num_entries);

type GroupImageState added in v0.8.0

type GroupImageState int

GroupImageState indicates an image's state in a group.

type GroupInfo added in v0.8.0

type GroupInfo struct {
	Name   string
	PoolID int64
}

GroupInfo contains the name and pool id of a RBD group.

type GroupSnapInfo added in v0.8.0

type GroupSnapInfo struct {
	Name  string
	State GroupSnapState
}

GroupSnapInfo values are returned by GroupSnapList, representing the snapshots that are part of an rbd group.

func GroupSnapList added in v0.8.0

func GroupSnapList(ioctx *rados.IOContext, group string) ([]GroupSnapInfo, error)

GroupSnapList returns a slice of snapshots in a group.

Implements:

int rbd_group_snap_list(rados_ioctx_t group_p,
                        const char *group_name,
                        rbd_group_snap_info_t *snaps,
                        size_t group_snap_info_size,
                        size_t *num_entries);

type GroupSnapRollbackCallback added in v0.8.0

type GroupSnapRollbackCallback func(uint64, uint64, interface{}) int

GroupSnapRollbackCallback defines the function signature needed for the GroupSnapRollbackWithProgress callback.

This callback will be called by GroupSnapRollbackWithProgress when it wishes to report progress rolling back a group snapshot.

type GroupSnapState added in v0.8.0

type GroupSnapState int

GroupSnapState represents the state of a group snapshot in GroupSnapInfo.

type Image

type Image struct {
	io.Reader
	io.Writer
	io.Seeker
	io.ReaderAt
	io.WriterAt
	// contains filtered or unexported fields
}

Image is a handle for an RBD image.

func Create

func Create(ioctx *rados.IOContext, name string, size uint64, order int,
	args ...uint64) (image *Image, err error)

Create a new rbd image.

Implements:

int rbd_create(rados_ioctx_t io, const char *name, uint64_t size, int *order);

Also implements (for backward compatibility):

int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
        uint64_t features, int *order);
int rbd_create3(rados_ioctx_t io, const char *name, uint64_t size,
      uint64_t features, int *order,
      uint64_t stripe_unit, uint64_t stripe_count);

func Create2

func Create2(ioctx *rados.IOContext, name string, size uint64, features uint64,
	order int) (image *Image, err error)

Create2 creates a new rbd image using provided features.

Implements:

int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
        uint64_t features, int *order);

func Create3

func Create3(ioctx *rados.IOContext, name string, size uint64, features uint64,
	order int, stripeUnit uint64, stripeCount uint64) (image *Image, err error)

Create3 creates a new rbd image using provided features and stripe parameters.

Implements:

int rbd_create3(rados_ioctx_t io, const char *name, uint64_t size,
      uint64_t features, int *order,
      uint64_t stripe_unit, uint64_t stripe_count);

func GetImage

func GetImage(ioctx *rados.IOContext, name string) *Image

GetImage gets a reference to a previously created rbd image.

func OpenImage

func OpenImage(ioctx *rados.IOContext, name, snapName string) (*Image, error)

OpenImage will open an existing rbd image by name and snapshot name, returning a new opened image. Pass the NoSnapshot sentinel value as the snapName to explicitly indicate that no snapshot name is being provided.

Implements:

int rbd_open(rados_ioctx_t io, const char *name,
             rbd_image_t *image, const char *snap_name);

func OpenImageById

func OpenImageById(ioctx *rados.IOContext, id, snapName string) (*Image, error)

OpenImageById will open an existing rbd image by ID and snapshot name, returning a new opened image. Pass the NoSnapshot sentinel value as the snapName to explicitly indicate that no snapshot name is being provided. Error handling will fail & segfault unless compiled with a version of ceph that fixes https://tracker.ceph.com/issues/43178

Implements:

int rbd_open_by_id(rados_ioctx_t io, const char *id,
                   rbd_image_t *image, const char *snap_name);

func OpenImageByIdReadOnly

func OpenImageByIdReadOnly(ioctx *rados.IOContext, id, snapName string) (*Image, error)

OpenImageByIdReadOnly will open an existing rbd image by ID and snapshot name, returning a new opened-for-read image. Pass the NoSnapshot sentinel value as the snapName to explicitly indicate that no snapshot name is being provided. Error handling will fail & segfault unless compiled with a version of ceph that fixes https://tracker.ceph.com/issues/43178

Implements:

int rbd_open_by_id_read_only(rados_ioctx_t io, const char *id,
                             rbd_image_t *image, const char *snap_name);

func OpenImageReadOnly

func OpenImageReadOnly(ioctx *rados.IOContext, name, snapName string) (*Image, error)

OpenImageReadOnly will open an existing rbd image by name and snapshot name, returning a new opened-for-read image. Pass the NoSnapshot sentinel value as the snapName to explicitly indicate that no snapshot name is being provided.

Implements:

int rbd_open_read_only(rados_ioctx_t io, const char *name,
                       rbd_image_t *image, const char *snap_name);

func (*Image) BreakLock

func (image *Image) BreakLock(client string, cookie string) error

BreakLock forces the release of a lock held by another client.

Implements:

int rbd_break_lock(rbd_image_t image, const char *client, const char *cookie);

func (*Image) Clone

func (image *Image) Clone(snapname string, cIoctx *rados.IOContext, cName string, features uint64, order int) (*Image, error)

Clone a new rbd image from a snapshot.

Implements:

int rbd_clone(rados_ioctx_t p_ioctx, const char *p_name,
         const char *p_snapname, rados_ioctx_t c_ioctx,
         const char *c_name, uint64_t features, int *c_order);

func (*Image) Close

func (image *Image) Close() error

Close an open rbd image.

Implements:

int rbd_close(rbd_image_t image);

func (*Image) Copy

func (image *Image) Copy(ioctx *rados.IOContext, destname string) error

Copy one rbd image to another.

Implements:

int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname);

func (*Image) Copy2

func (image *Image) Copy2(dest *Image) error

Copy2 copies one rbd image to another, using an image handle.

Implements:

int rbd_copy2(rbd_image_t src, rbd_image_t dest);

func (*Image) CreateMirrorSnapshot added in v0.9.0

func (image *Image) CreateMirrorSnapshot() (uint64, error)

CreateMirrorSnapshot creates a snapshot for image propagation to mirrors.

Implements:

int rbd_mirror_image_create_snapshot(rbd_image_t image,
                                     uint64_t *snap_id);

func (*Image) CreateSnapshot

func (image *Image) CreateSnapshot(snapname string) (*Snapshot, error)

CreateSnapshot returns a new Snapshot objects after creating a snapshot of the rbd image.

Implements:

int rbd_snap_create(rbd_image_t image, const char *snapname);

func (*Image) DeepCopy added in v0.10.0

func (image *Image) DeepCopy(ioctx *rados.IOContext, destname string, rio *ImageOptions) error

DeepCopy an rbd image to a new image with specific options.

Implements:

int rbd_deep_copy(rbd_image_t src, rados_ioctx_t dest_io_ctx,
        const char *destname, rbd_image_options_t dest_opts);

func (*Image) DiffIterate added in v0.3.0

func (image *Image) DiffIterate(config DiffIterateConfig) error

DiffIterate calls a callback on changed extents of an image.

Calling DiffIterate will cause the callback specified in the DiffIterateConfig to be called as many times as there are changed regions in the image (controlled by the parameters as passed to librbd).

See the documentation of DiffIterateCallback for a description of the arguments to the callback and the return behavior.

Implements:

int rbd_diff_iterate2(rbd_image_t image,
                      const char *fromsnapname,
                      uint64_t ofs, uint64_t len,
                      uint8_t include_parent, uint8_t whole_object,
                      int (*cb)(uint64_t, size_t, int, void *),
                      void *arg);

func (*Image) Discard

func (image *Image) Discard(ofs uint64, length uint64) (int, error)

Discard the supplied range from the image. The supplied range will be read as zeros once Discard returns. The discarded range will no longer take up space.

Implements:

int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len);

func (*Image) EncryptionFormat added in v0.11.0

func (image *Image) EncryptionFormat(opts EncryptionOptions) error

EncryptionFormat creates an encryption format header

Implements:

int rbd_encryption_format(rbd_image_t image,
                          rbd_encryption_format_t format,
                          rbd_encryption_options_t opts,
                          size_t opts_size);

To issue an IO against the image, you need to mount the image with libvirt/qemu using the LUKS format, or make a call to rbd_encryption_load().

func (*Image) EncryptionLoad added in v0.11.0

func (image *Image) EncryptionLoad(opts EncryptionOptions) error

EncryptionLoad enables IO on an open encrypted image

Implements:

int rbd_encryption_load(rbd_image_t image,
                        rbd_encryption_format_t format,
                        rbd_encryption_options_t opts,
                        size_t opts_size);

func (*Image) Flatten

func (image *Image) Flatten() error

Flatten removes snapshot references from the image.

Implements:

int rbd_flatten(rbd_image_t image);

func (*Image) Flush

func (image *Image) Flush() error

Flush all cached writes to storage.

Implements:

int rbd_flush(rbd_image_t image);

func (*Image) GetAccessTimestamp added in v0.5.0

func (image *Image) GetAccessTimestamp() (Timespec, error)

GetAccessTimestamp returns the time the rbd image was last accessed.

Implements:

int rbd_get_access_timestamp(rbd_image_t image, struct timespec *timestamp);

func (*Image) GetCreateTimestamp added in v0.5.0

func (image *Image) GetCreateTimestamp() (Timespec, error)

GetCreateTimestamp returns the time the rbd image was created.

Implements:

int rbd_get_create_timestamp(rbd_image_t image, struct timespec *timestamp);

func (*Image) GetFeatures

func (image *Image) GetFeatures() (features uint64, err error)

GetFeatures returns the features bitmask for the rbd image.

Implements:

int rbd_get_features(rbd_image_t image, uint64_t *features);

func (*Image) GetGlobalMirrorStatus added in v0.9.0

func (image *Image) GetGlobalMirrorStatus() (GlobalMirrorImageStatus, error)

GetGlobalMirrorStatus returns status information pertaining to the state of the images's mirroring.

Implements:

int rbd_mirror_image_get_global_status(
  rbd_image_t image,
  rbd_mirror_image_global_status_t *mirror_image_global_status,
  size_t status_size);

func (*Image) GetGroup added in v0.8.0

func (image *Image) GetGroup() (GroupInfo, error)

GetGroup returns group info for the group this image is part of.

Implements:

int rbd_get_group(rbd_image_t image, rbd_group_info_t *group_info,
                  size_t group_info_size);

func (*Image) GetId

func (image *Image) GetId() (string, error)

GetId returns the internal image ID string.

Implements:

int rbd_get_id(rbd_image_t image, char *id, size_t id_len);

func (*Image) GetImageMirrorMode added in v0.8.0

func (image *Image) GetImageMirrorMode() (ImageMirrorMode, error)

GetImageMirrorMode fetches the mirroring approach for an RBD image.

Implements:

int rbd_mirror_image_get_mode(rbd_image_t image, rbd_mirror_image_mode_t *mode);

func (*Image) GetMetadata

func (image *Image) GetMetadata(key string) (string, error)

GetMetadata returns the metadata string associated with the given key.

Implements:

int rbd_metadata_get(rbd_image_t image, const char *key, char *value, size_t *vallen)

func (*Image) GetMirrorImageInfo added in v0.8.0

func (image *Image) GetMirrorImageInfo() (*MirrorImageInfo, error)

GetMirrorImageInfo fetches the mirroring status information of a RBD image.

Implements:

int rbd_mirror_image_get_info(rbd_image_t image,
                              rbd_mirror_image_info_t *mirror_image_info,
                              size_t info_size)

func (*Image) GetModifyTimestamp added in v0.5.0

func (image *Image) GetModifyTimestamp() (Timespec, error)

GetModifyTimestamp returns the time the rbd image was last modified.

Implements:

int rbd_get_modify_timestamp(rbd_image_t image, struct timespec *timestamp);

func (*Image) GetName added in v0.13.0

func (image *Image) GetName() string

GetName returns the image name.

func (*Image) GetOverlap

func (image *Image) GetOverlap() (overlap uint64, err error)

GetOverlap returns the overlapping bytes between the rbd image and its parent.

Implements:

int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);

func (*Image) GetParent added in v0.6.0

func (image *Image) GetParent() (*ParentInfo, error)

GetParent looks for the parent of the image and returns the parent image information which includes the image name, the pool name and the snapshot information.

Implements: int rbd_get_parent(rbd_image_t image, rbd_linked_image_spec_t *parent_image, rbd_snap_spec_t *parent_snap)

func (*Image) GetParentInfo

func (image *Image) GetParentInfo(pool, name, snapname []byte) error

GetParentInfo looks for the parent of the image and stores the pool, name and snapshot-name in the byte-arrays that are passed as arguments.

Implements:

int rbd_get_parent(rbd_image_t image,
                   rbd_linked_image_spec_t *parent_image,
                   rbd_snap_spec_t *parent_snap)

func (*Image) GetSize

func (image *Image) GetSize() (size uint64, err error)

GetSize returns the size of the rbd image.

Implements:

int rbd_size(rbd_image_t image, uint64_t *size);

func (*Image) GetSnapByID added in v0.10.0

func (image *Image) GetSnapByID(snapID uint64) (string, error)

GetSnapByID returns the snapshot name for the given snapshot ID.

Implements:

int rbd_snap_get_name(rbd_image_t image, uint64_t snap_id, char *snapname, size_t *name_len)

func (*Image) GetSnapID added in v0.10.0

func (image *Image) GetSnapID(snapName string) (uint64, error)

GetSnapID returns the snapshot ID for the given snapshot name.

Implements:

int rbd_snap_get_id(rbd_image_t image, const char *snapname, uint64_t *snap_id)

func (*Image) GetSnapNamespaceType added in v0.5.0

func (image *Image) GetSnapNamespaceType(snapID uint64) (SnapNamespaceType, error)

GetSnapNamespaceType gets the type of namespace to which the snapshot belongs to, returns error on failure.

Implements:

int rbd_snap_get_namespace_type(rbd_image_t image, uint64_t snap_id, rbd_snap_namespace_type_t *namespace_type)

func (*Image) GetSnapTimestamp added in v0.6.0

func (image *Image) GetSnapTimestamp(snapID uint64) (Timespec, error)

GetSnapTimestamp returns the timestamp of a snapshot for an image. For a non-existing snap ID, GetSnapTimestamp() may trigger an assertion and crash in the ceph library. Check https://tracker.ceph.com/issues/47287 for details.

Implements:

int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, struct timespec *timestamp)

func (*Image) GetSnapTrashNamespace added in v0.5.0

func (image *Image) GetSnapTrashNamespace(snapID uint64) (string, error)

GetSnapTrashNamespace returns the original name of the snapshot which was moved to the Trash. The caller should make sure that the snapshot ID passed in this function belongs to a snapshot already in the Trash.

Implements:

int rbd_snap_get_trash_namespace(rbd_image_t image, uint64_t snap_id, char *original_name, size_t max_length)

func (*Image) GetSnapshot

func (image *Image) GetSnapshot(snapname string) *Snapshot

GetSnapshot constructs a snapshot object for the image given the snap name. It does not validate that this snapshot exists.

func (*Image) GetSnapshotNames

func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error)

GetSnapshotNames returns more than just the names of snapshots associated with the rbd image.

Implements:

int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps);

func (*Image) GetStripeCount

func (image *Image) GetStripeCount() (uint64, error)

GetStripeCount returns the stripe-count value for the rbd image.

Implements:

int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count);

func (*Image) GetStripeUnit

func (image *Image) GetStripeUnit() (uint64, error)

GetStripeUnit returns the stripe-unit value for the rbd image.

Implements:

int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);

func (*Image) IsOldFormat

func (image *Image) IsOldFormat() (bool, error)

IsOldFormat returns true if the rbd image uses the old format.

Implements:

int rbd_get_old_format(rbd_image_t image, uint8_t *old);

func (*Image) ListChildren

func (image *Image) ListChildren() (pools []string, images []string, err error)

ListChildren returns arrays with the pools and names of the images that are children of the given image. The index of the pools and images arrays can be used to link the two items together.

Implements:

int rbd_list_children3(rbd_image_t image, rbd_linked_image_spec_t *images,
                       size_t *max_images);

func (*Image) ListLockers

func (image *Image) ListLockers() (tag string, lockers []Locker, err error)

ListLockers returns a list of clients that have locks on the image.

Impelemnts:

ssize_t rbd_list_lockers(rbd_image_t image, int *exclusive,
            char *tag, size_t *tag_len,
            char *clients, size_t *clients_len,
            char *cookies, size_t *cookies_len,
            char *addrs, size_t *addrs_len);

func (*Image) ListMetadata added in v0.7.0

func (image *Image) ListMetadata() (map[string]string, error)

ListMetadata returns a map containing all metadata assigned to the RBD image.

Implements:

int rbd_metadata_list(rbd_image_t image, const char *start, uint64_t max,
                      char *keys, size_t *key_len, char *values, size_t *vals_len);

func (*Image) ListWatchers added in v0.3.0

func (image *Image) ListWatchers() ([]ImageWatcher, error)

ListWatchers returns the watchers on an RBD image. In case of an error, nil and an error are returned.

Note:

Only supported in Ceph Mimic and newer.

Implements:

int rbd_watchers_list(rbd_image_t image,
                      rbd_image_watcher_t *watchers, size_t *max_watchers)

func (*Image) LockExclusive

func (image *Image) LockExclusive(cookie string) error

LockExclusive acquires an exclusive lock on the rbd image.

Implements:

int rbd_lock_exclusive(rbd_image_t image, const char *cookie);

func (*Image) LockShared

func (image *Image) LockShared(cookie string, tag string) error

LockShared acquires a shared lock on the rbd image.

Implements:

int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);

func (*Image) MirrorDemote added in v0.8.0

func (image *Image) MirrorDemote() error

MirrorDemote will demote the image to secondary status.

Implements:

int rbd_mirror_image_demote(rbd_image_t image);

func (*Image) MirrorDisable added in v0.8.0

func (image *Image) MirrorDisable(force bool) error

MirrorDisable will disable mirroring for the image.

Implements:

int rbd_mirror_image_disable(rbd_image_t image, bool force);

func (*Image) MirrorEnable added in v0.8.0

func (image *Image) MirrorEnable(mode ImageMirrorMode) error

MirrorEnable will enable mirroring for an image using the specified mode.

Implements:

int rbd_mirror_image_enable2(rbd_image_t image,
                             rbd_mirror_image_mode_t mode);

func (*Image) MirrorInstanceID added in v0.8.0

func (image *Image) MirrorInstanceID() (string, error)

MirrorInstanceID returns a string naming the instance id for the image.

Implements:

int rbd_mirror_image_get_instance_id(rbd_image_t image,
                                     char *instance_id,
                                     size_t *id_max_length);

func (*Image) MirrorPromote added in v0.8.0

func (image *Image) MirrorPromote(force bool) error

MirrorPromote will promote the image to primary status.

Implements:

int rbd_mirror_image_promote(rbd_image_t image, bool force);

func (*Image) MirrorResync added in v0.8.0

func (image *Image) MirrorResync() error

MirrorResync is used to manually resolve split-brain status by triggering resynchronization.

Implements:

int rbd_mirror_image_resync(rbd_image_t image);

func (*Image) Open deprecated

func (image *Image) Open(args ...interface{}) error

Open the rbd image.

Deprecated: use OpenImage and OpenImageReadOnly instead

func (*Image) Read

func (image *Image) Read(data []byte) (int, error)

ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len, char *buf); TODO: int64_t rbd_read_iterate(rbd_image_t image, uint64_t ofs, size_t len,

int (*cb)(uint64_t, size_t, const char *, void *), void *arg);

TODO: int rbd_read_iterate2(rbd_image_t image, uint64_t ofs, uint64_t len,

int (*cb)(uint64_t, size_t, const char *, void *), void *arg);

TODO: int rbd_diff_iterate(rbd_image_t image,

const char *fromsnapname,
uint64_t ofs, uint64_t len,
int (*cb)(uint64_t, size_t, int, void *), void *arg);

func (*Image) ReadAt

func (image *Image) ReadAt(data []byte, off int64) (int, error)

ReadAt copies data from the image into the supplied buffer.

func (*Image) Remove

func (image *Image) Remove() error

Remove the specified rbd image.

Implements:

int rbd_remove(rados_ioctx_t io, const char *name);

func (*Image) RemoveMetadata

func (image *Image) RemoveMetadata(key string) error

RemoveMetadata clears the metadata associated with the given key.

Implements:

int rbd_metadata_remove(rbd_image_t image, const char *key)

func (*Image) Rename

func (image *Image) Rename(destname string) error

Rename an rbd image.

Implements:

int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);

func (*Image) Resize

func (image *Image) Resize(size uint64) error

Resize an rbd image.

Implements:

int rbd_resize(rbd_image_t image, uint64_t size);

func (*Image) Seek

func (image *Image) Seek(offset int64, whence int) (int64, error)

Seek updates the internal file position for the current image.

func (*Image) SetMetadata

func (image *Image) SetMetadata(key string, value string) error

SetMetadata updates the metadata string associated with the given key.

Implements:

int rbd_metadata_set(rbd_image_t image, const char *key, const char *value)

func (*Image) SetSnapByID added in v0.6.0

func (image *Image) SetSnapByID(snapID uint64) error

SetSnapByID updates the rbd image (not the Snapshot) such that the snapshot is the source of readable data.

Implements:

int rbd_snap_set_by_id(rbd_image_t image, uint64_t snap_id);

func (*Image) SetSnapshot added in v0.10.0

func (image *Image) SetSnapshot(snapname string) error

SetSnapshot updates the rbd image (not the Snapshot) such that the snapshot is the source of readable data.

Implements:

int rbd_snap_set(rbd_image_t image, const char *snapname);

func (*Image) Sparsify added in v0.6.0

func (image *Image) Sparsify(sparseSize uint) error

Sparsify makes an image sparse by deallocating runs of zeros. The sparseSize value will be used to find runs of zeros and must be a power of two no less than 4096 and no larger than the image size.

Implements:

int rbd_sparsify(rbd_image_t image, size_t sparse_size);

func (*Image) Stat

func (image *Image) Stat() (info *ImageInfo, err error)

Stat an rbd image.

Implements:

int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);

func (*Image) Trash

func (image *Image) Trash(delay time.Duration) error

Trash will move an image into the RBD trash, where it will be protected (i.e., salvageable) for at least the specified delay.

func (*Image) Unlock

func (image *Image) Unlock(cookie string) error

Unlock releases a lock on the image.

Implements:

int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);

func (*Image) UpdateFeatures added in v0.3.0

func (image *Image) UpdateFeatures(features uint64, enabled bool) error

UpdateFeatures updates the features on the Image.

Implements:

int rbd_update_features(rbd_image_t image, uint64_t features,
                        uint8_t enabled);

func (*Image) UpdateWatch added in v0.5.0

func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, error)

UpdateWatch updates the image object to watch metadata changes to the image, returning a Watch object.

Implements:

int rbd_update_watch(rbd_image_t image, uint64_t *handle,
                     rbd_update_callback_t watch_cb, void *arg);

func (*Image) Write

func (image *Image) Write(data []byte) (n int, err error)

ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len, const char *buf);

func (*Image) WriteAt

func (image *Image) WriteAt(data []byte, off int64) (n int, err error)

WriteAt copies data from the supplied buffer to the image.

func (*Image) WriteSame added in v0.7.0

func (image *Image) WriteSame(ofs, n uint64, data []byte, flags rados.OpFlags) (int64, error)

WriteSame repeats writing data from starting point ofs until n bytes have been written.

Implements:

ssize_t rbd_writesame(rbd_image_t image, uint64_t ofs, size_t len,
                      const char *buf, size_t data_len, int op_flags);

type ImageInfo

type ImageInfo struct {
	Size              uint64
	Obj_size          uint64
	Num_objs          uint64
	Order             int
	Block_name_prefix string
}

ImageInfo represents the status information for an image.

type ImageMirrorMode added in v0.8.0

type ImageMirrorMode int64

ImageMirrorMode is used to indicate the mirroring approach for an RBD image.

func (ImageMirrorMode) String added in v0.9.0

func (imm ImageMirrorMode) String() string

String representation of ImageMirrorMode.

type ImageMirrorModeFilter added in v0.11.0

type ImageMirrorModeFilter interface {
	// contains filtered or unexported methods
}

ImageMirrorModeFilter is a ImageMirrorMode or nil for no filtering

type ImageOption added in v0.3.0

type ImageOption C.int

ImageOption values are unique keys for configurable options.

type ImageOptions added in v0.3.0

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

ImageOptions represents a group of configurable image options.

func NewRbdImageOptions

func NewRbdImageOptions() *ImageOptions

NewRbdImageOptions creates a new RbdImageOptions struct. Call RbdImageOptions.Destroy() to free the resources.

Implements:

void rbd_image_options_create(rbd_image_options_t* opts)

func (*ImageOptions) Clear added in v0.3.0

func (rio *ImageOptions) Clear()

Clear all options in the RbdImageOptions.

Implements:

void rbd_image_options_clear(rbd_image_options_t opts)

func (*ImageOptions) Destroy added in v0.3.0

func (rio *ImageOptions) Destroy()

Destroy a RbdImageOptions struct and free the associated resources.

Implements:

void rbd_image_options_destroy(rbd_image_options_t opts);

func (*ImageOptions) GetString added in v0.3.0

func (rio *ImageOptions) GetString(option ImageOption) (string, error)

GetString returns the string value of the RbdImageOption.

Implements:

int rbd_image_options_get_string(rbd_image_options_t opts, int optname,
        char* optval, size_t maxlen);

func (*ImageOptions) GetUint64 added in v0.3.0

func (rio *ImageOptions) GetUint64(option ImageOption) (uint64, error)

GetUint64 returns the uint64 value of the RbdImageOption.

Implements:

int rbd_image_options_get_uint64(rbd_image_options_t opts, int optname,
        uint64_t* optval);

func (*ImageOptions) IsEmpty added in v0.3.0

func (rio *ImageOptions) IsEmpty() bool

IsEmpty returns true if there are no options set in the RbdImageOptions, false otherwise.

Implements:

int rbd_image_options_is_empty(rbd_image_options_t opts)

func (*ImageOptions) IsSet added in v0.3.0

func (rio *ImageOptions) IsSet(option ImageOption) (bool, error)

IsSet returns a true if the RbdImageOption is set, false otherwise.

Implements:

int rbd_image_options_is_set(rbd_image_options_t opts, int optname,
        bool* is_set);

func (*ImageOptions) SetString added in v0.3.0

func (rio *ImageOptions) SetString(option ImageOption, value string) error

SetString sets the value of the RbdImageOption to the given string.

Implements:

int rbd_image_options_set_string(rbd_image_options_t opts, int optname,
        const char* optval);

func (*ImageOptions) SetUint64 added in v0.3.0

func (rio *ImageOptions) SetUint64(option ImageOption, value uint64) error

SetUint64 sets the value of the RbdImageOption to the given uint64.

Implements:

int rbd_image_options_set_uint64(rbd_image_options_t opts, int optname,
        const uint64_t optval);

func (*ImageOptions) Unset added in v0.3.0

func (rio *ImageOptions) Unset(option ImageOption) error

Unset a given RbdImageOption.

Implements:

int rbd_image_options_unset(rbd_image_options_t opts, int optname)

type ImageSpec added in v0.6.0

type ImageSpec struct {
	ImageName string
	PoolName  string
}

ImageSpec represents the image information.

type ImageWatcher added in v0.3.0

type ImageWatcher struct {
	Addr   string
	Id     int64
	Cookie uint64
}

ImageWatcher is a representation of the rbd_image_watcher_t from librbd.h

type Locker

type Locker struct {
	Client string
	Cookie string
	Addr   string
}

Locker provides info about a client that is locking an image.

type MirrorImageGlobalStatusIter added in v0.10.0

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

MirrorImageGlobalStatusIter provide methods for iterating over all the GlobalMirrorImageIdAndStatus values in a pool.

func NewMirrorImageGlobalStatusIter added in v0.10.0

func NewMirrorImageGlobalStatusIter(ioctx *rados.IOContext) *MirrorImageGlobalStatusIter

NewMirrorImageGlobalStatusIter creates a new iterator type ready for use.

func (*MirrorImageGlobalStatusIter) Close deprecated added in v0.10.0

Close terminates iteration regardless if iteration was completed and frees any associated resources.

Deprecated: not required

func (*MirrorImageGlobalStatusIter) Next added in v0.10.0

Next fetches one GlobalMirrorImageIDAndStatus value or a nil value if iteration is exhausted. The error return will be non-nil if an underlying error fetching more values occurred.

type MirrorImageInfo added in v0.8.0

type MirrorImageInfo struct {
	GlobalID string
	State    MirrorImageState
	Primary  bool
}

MirrorImageInfo represents the mirroring status information of a RBD image.

type MirrorImageInfoItem added in v0.11.0

type MirrorImageInfoItem struct {
	ID   string
	Mode ImageMirrorMode
	Info MirrorImageInfo
}

MirrorImageInfoItem contains an ID string for a RBD image and that image's ImageMirrorMode and MirrorImageInfo.

func MirrorImageInfoList added in v0.11.0

func MirrorImageInfoList(
	ioctx *rados.IOContext, modeFilter ImageMirrorModeFilter, start string,
	max int) ([]MirrorImageInfoItem, error)

MirrorImageInfoList returns a slice of MirrorImageInfoItem. If the length of the returned slice equals max, the next chunk of the list can be obtained by setting start to the ID of the last item of the returned slice. The returned items are filtered by the mirror mode specified with modeFilter. If max is 0 a slice of all items is returned.

Implements: int rbd_mirror_image_info_list(

rados_ioctx_t p, rbd_mirror_image_mode_t *mode_filter,
const char *start_id, size_t max, char **image_ids,
rbd_mirror_image_mode_t *mode_entries,
rbd_mirror_image_info_t *info_entries, size_t *num_entries)

type MirrorImageInfoIter added in v0.11.0

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

MirrorImageInfoIter provide methods for iterating over all the MirrorImageInfoItem values in a pool.

func NewMirrorImageInfoIter added in v0.11.0

func NewMirrorImageInfoIter(ioctx *rados.IOContext, modeFilter ImageMirrorModeFilter) *MirrorImageInfoIter

NewMirrorImageInfoIter creates a new iterator ready for use.

func (*MirrorImageInfoIter) Next added in v0.11.0

Next fetches one MirrorImageInfoItem value or a nil value if iteration is exhausted. The error return will be non-nil if an underlying error fetching more values occurred.

type MirrorImageInstanceIDItem added in v0.12.0

type MirrorImageInstanceIDItem struct {
	ID         string
	InstanceID string
}

MirrorImageInstanceIDItem contains an ID string for a RBD image and its corresponding mirrored image's Instance ID.

func MirrorImageInstanceIDList added in v0.12.0

func MirrorImageInstanceIDList(
	ioctx *rados.IOContext, start string,
	max int) ([]MirrorImageInstanceIDItem, error)

MirrorImageInstanceIDList returns a slice of MirrorImageInstanceIDItem. If the length of the returned slice equals max, the next chunk of the list can be obtained by setting start to the ID of the last item of the returned slice. If max is 0 a slice of all items is returned.

Implements: int rbd_mirror_image_instance_id_list(

rados_ioctx_t io_ctx,
const char *start_id,
size_t max, char **image_ids,
char **instance_ids,
size_t *len)

type MirrorImageInstanceIDIter added in v0.12.0

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

MirrorImageInstanceIDIter provide methods for iterating over all the MirrorImageInstanceIDItem values in a pool.

func NewMirrorImageInstanceIDIter added in v0.12.0

func NewMirrorImageInstanceIDIter(ioctx *rados.IOContext) *MirrorImageInstanceIDIter

NewMirrorImageInstanceIDIter creates a new iterator ready for use.

func (*MirrorImageInstanceIDIter) Next added in v0.12.0

Next fetches one MirrorImageInstanceIDItem value or a nil value if iteration is exhausted. The error return will be non-nil if an underlying error fetching more values occurred.

type MirrorImageState added in v0.8.0

type MirrorImageState C.rbd_mirror_image_state_t

MirrorImageState represents the mirroring state of a RBD image.

func (MirrorImageState) String added in v0.9.0

func (mis MirrorImageState) String() string

String representation of MirrorImageState.

type MirrorImageStatusState added in v0.9.0

type MirrorImageStatusState int64

MirrorImageStatusState is used to indicate the state of a mirrored image within the site status info.

func (MirrorImageStatusState) String added in v0.9.0

func (state MirrorImageStatusState) String() (s string)

String represents the MirrorImageStatusState as a short string.

type MirrorMode added in v0.8.0

type MirrorMode int64

MirrorMode is used to indicate an approach used for RBD mirroring.

func GetMirrorMode added in v0.8.0

func GetMirrorMode(ioctx *rados.IOContext) (MirrorMode, error)

GetMirrorMode is used to fetch the current mirroring mode for a pool.

Implements:

int rbd_mirror_mode_get(rados_ioctx_t io_ctx,
                        rbd_mirror_mode_t *mirror_mode);

func (MirrorMode) String added in v0.9.0

func (m MirrorMode) String() string

String representation of MirrorMode.

type MirrorPeerDirection added in v0.10.0

type MirrorPeerDirection int

MirrorPeerDirection is used to indicate what direction data is mirrored.

type ParentInfo added in v0.6.0

type ParentInfo struct {
	Image ImageSpec
	Snap  SnapSpec
}

ParentInfo represents the parent image and the parent snapshot information.

type PoolStatOption added in v0.5.0

type PoolStatOption C.rbd_pool_stat_option_t

PoolStatOption represents a group of configurable pool stat options.

type RbdImageOption

type RbdImageOption = ImageOption

RbdImageOption is a deprecated alias for ImageOption

type RbdImageOptions

type RbdImageOptions = ImageOptions

RbdImageOptions deprecated alias for ImageOptions

type SiteMirrorImageStatus added in v0.9.0

type SiteMirrorImageStatus struct {
	MirrorUUID  string
	State       MirrorImageStatusState
	Description string
	LastUpdate  int64
	Up          bool
}

SiteMirrorImageStatus contains information pertaining to the status of a mirrored image within a site.

type SnapInfo

type SnapInfo struct {
	Id   uint64
	Size uint64
	Name string
}

SnapInfo represents the status information for a snapshot.

type SnapNamespaceType added in v0.5.0

type SnapNamespaceType C.rbd_snap_namespace_type_t

SnapNamespaceType indicates the namespace to which the snapshot belongs to.

type SnapSpec added in v0.6.0

type SnapSpec struct {
	ID       uint64
	SnapName string
}

SnapSpec represents the snapshot infomation.

type Snapshot

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

Snapshot represents a snapshot on a particular rbd image.

func (*Snapshot) IsProtected

func (snapshot *Snapshot) IsProtected() (bool, error)

IsProtected returns true if the snapshot is currently protected.

Implements:

int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
             int *is_protected);

func (*Snapshot) Protect

func (snapshot *Snapshot) Protect() error

Protect a snapshot from unwanted deletion.

Implements:

int rbd_snap_protect(rbd_image_t image, const char *snap_name);

func (*Snapshot) Remove

func (snapshot *Snapshot) Remove() error

Remove the snapshot from the connected rbd image.

Implements:

int rbd_snap_remove(rbd_image_t image, const char *snapname);

func (*Snapshot) Rollback

func (snapshot *Snapshot) Rollback() error

Rollback the image to the snapshot.

Implements:

int rbd_snap_rollback(rbd_image_t image, const char *snapname);

func (*Snapshot) Set deprecated

func (snapshot *Snapshot) Set() error

Set updates the rbd image (not the Snapshot) such that the snapshot is the source of readable data.

Deprecated: use the SetSnapshot method of the Image type instead

Implements:

int rbd_snap_set(rbd_image_t image, const char *snapname);

func (*Snapshot) Unprotect

func (snapshot *Snapshot) Unprotect() error

Unprotect stops protecting the snapshot.

Implements:

int rbd_snap_unprotect(rbd_image_t image, const char *snap_name);

type Timespec added in v0.5.0

type Timespec ts.Timespec

Timespec is a public type for the internal C 'struct timespec'

type TrashInfo

type TrashInfo struct {
	Id               string    // Id string, required to remove / restore trashed RBDs.
	Name             string    // Original name of trashed RBD.
	DeletionTime     time.Time // Date / time at which the RBD was moved to the trash.
	DefermentEndTime time.Time // Date / time after which the trashed RBD may be permanently deleted.
}

TrashInfo contains information about trashed RBDs.

func GetTrashList

func GetTrashList(ioctx *rados.IOContext) ([]TrashInfo, error)

GetTrashList returns a slice of TrashInfo structs, containing information about all RBD images currently residing in the trash.

type Watch added in v0.5.0

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

Watch represents an ongoing image metadata watch.

func (*Watch) Unwatch added in v0.5.0

func (w *Watch) Unwatch() error

Unwatch un-registers the image watch.

Implements:

int rbd_update_unwatch(rbd_image_t image, uint64_t handle);

type WatchCallback added in v0.5.0

type WatchCallback func(interface{})

WatchCallback defines the function signature needed for the UpdateWatch callback.

Directories

Path Synopsis
Package admin is a convenience layer to support the administration of rbd volumes, snapshots, scheduling etc that is outside of the C api for librbd.
Package admin is a convenience layer to support the administration of rbd volumes, snapshots, scheduling etc that is outside of the C api for librbd.

Jump to

Keyboard shortcuts

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