mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
rebase: bump github.com/ceph/go-ceph from 0.20.0 to 0.21.0
Bumps [github.com/ceph/go-ceph](https://github.com/ceph/go-ceph) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/ceph/go-ceph/releases) - [Changelog](https://github.com/ceph/go-ceph/blob/master/docs/release-process.md) - [Commits](https://github.com/ceph/go-ceph/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: github.com/ceph/go-ceph dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
c8f6878570
commit
d05847ee73
12
vendor/github.com/ceph/go-ceph/rbd/admin/msschedule.go
generated
vendored
12
vendor/github.com/ceph/go-ceph/rbd/admin/msschedule.go
generated
vendored
@ -40,7 +40,8 @@ func (ra *RBDAdmin) MirrorSnashotSchedule() *MirrorSnashotScheduleAdmin {
|
||||
// level spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd mirror snapshot schedule add <level_spec> <interval> <start_time>
|
||||
//
|
||||
// rbd mirror snapshot schedule add <level_spec> <interval> <start_time>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Add(l LevelSpec, i Interval, s StartTime) error {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd mirror snapshot schedule add",
|
||||
@ -59,7 +60,8 @@ func (mss *MirrorSnashotScheduleAdmin) Add(l LevelSpec, i Interval, s StartTime)
|
||||
// List the snapshot schedules based on the supplied level spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd mirror snapshot schedule list <level_spec>
|
||||
//
|
||||
// rbd mirror snapshot schedule list <level_spec>
|
||||
func (mss *MirrorSnashotScheduleAdmin) List(l LevelSpec) ([]SnapshotSchedule, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd mirror snapshot schedule list",
|
||||
@ -114,7 +116,8 @@ func parseMirrorSnapshotScheduleList(res commands.Response) (
|
||||
// Remove a snapshot schedule matching the supplied arguments.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd mirror snapshot schedule remove <level_spec> <interval> <start_time>
|
||||
//
|
||||
// rbd mirror snapshot schedule remove <level_spec> <interval> <start_time>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Remove(
|
||||
l LevelSpec, i Interval, s StartTime) error {
|
||||
|
||||
@ -136,7 +139,8 @@ func (mss *MirrorSnashotScheduleAdmin) Remove(
|
||||
// matching the supplied level spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd mirror snapshot schedule status <level_spec>
|
||||
//
|
||||
// rbd mirror snapshot schedule status <level_spec>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Status(l LevelSpec) ([]ScheduledImage, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd mirror snapshot schedule status",
|
||||
|
18
vendor/github.com/ceph/go-ceph/rbd/admin/task.go
generated
vendored
18
vendor/github.com/ceph/go-ceph/rbd/admin/task.go
generated
vendored
@ -56,7 +56,8 @@ func parseTaskResponseList(res commands.Response) ([]TaskResponse, error) {
|
||||
// supplied image spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task add flatten <image_spec>
|
||||
//
|
||||
// rbd task add flatten <image_spec>
|
||||
func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task add flatten",
|
||||
@ -70,7 +71,8 @@ func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||
// image spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task add remove <image_spec>
|
||||
//
|
||||
// rbd task add remove <image_spec>
|
||||
func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task add remove",
|
||||
@ -84,7 +86,8 @@ func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||
// on the supplied image id spec.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task add trash remove <image_id_spec>
|
||||
//
|
||||
// rbd task add trash remove <image_id_spec>
|
||||
func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task add trash remove",
|
||||
@ -97,7 +100,8 @@ func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||
// List pending or running asynchronous tasks.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task list
|
||||
//
|
||||
// rbd task list
|
||||
func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task list",
|
||||
@ -109,7 +113,8 @@ func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||
// GetTaskByID returns pending or running asynchronous task using id.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task list <task_id>
|
||||
//
|
||||
// rbd task list <task_id>
|
||||
func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task list",
|
||||
@ -122,7 +127,8 @@ func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||
// Cancel a pending or running asynchronous task.
|
||||
//
|
||||
// Similar To:
|
||||
// rbd task cancel <task_id>
|
||||
//
|
||||
// rbd task cancel <task_id>
|
||||
func (ta *TaskAdmin) Cancel(taskID string) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "rbd task cancel",
|
||||
|
13
vendor/github.com/ceph/go-ceph/rbd/diff_iterate.go
generated
vendored
13
vendor/github.com/ceph/go-ceph/rbd/diff_iterate.go
generated
vendored
@ -84,12 +84,13 @@ const (
|
||||
// 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);
|
||||
//
|
||||
// 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 *Image) DiffIterate(config DiffIterateConfig) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
|
18
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
18
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
@ -91,10 +91,11 @@ func (opts EncryptionOptionsLUKS2) allocateEncryptionOptions() cEncryptionData {
|
||||
// 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);
|
||||
//
|
||||
// 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
|
||||
@ -119,10 +120,11 @@ func (image *Image) EncryptionFormat(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);
|
||||
//
|
||||
// int rbd_encryption_load(rbd_image_t image,
|
||||
// rbd_encryption_format_t format,
|
||||
// rbd_encryption_options_t opts,
|
||||
// size_t opts_size);
|
||||
func (image *Image) EncryptionLoad(opts EncryptionOptions) error {
|
||||
if image.image == nil {
|
||||
return ErrImageNotOpen
|
||||
|
8
vendor/github.com/ceph/go-ceph/rbd/features.go
generated
vendored
8
vendor/github.com/ceph/go-ceph/rbd/features.go
generated
vendored
@ -154,7 +154,8 @@ func (fs *FeatureSet) Names() []string {
|
||||
// GetFeatures returns the features bitmask for the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_get_features(rbd_image_t image, uint64_t *features);
|
||||
//
|
||||
// int rbd_get_features(rbd_image_t image, uint64_t *features);
|
||||
func (image *Image) GetFeatures() (features uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -170,8 +171,9 @@ func (image *Image) GetFeatures() (features uint64, err error) {
|
||||
// UpdateFeatures updates the features on the Image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_update_features(rbd_image_t image, uint64_t features,
|
||||
// uint8_t enabled);
|
||||
//
|
||||
// int rbd_update_features(rbd_image_t image, uint64_t features,
|
||||
// uint8_t enabled);
|
||||
func (image *Image) UpdateFeatures(features uint64, enabled bool) error {
|
||||
if image.image == nil {
|
||||
return RbdErrorImageNotOpen
|
||||
|
57
vendor/github.com/ceph/go-ceph/rbd/group.go
generated
vendored
57
vendor/github.com/ceph/go-ceph/rbd/group.go
generated
vendored
@ -18,7 +18,8 @@ import (
|
||||
// GroupCreate is used to create an image group.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_group_create(rados_ioctx_t p, const char *name);
|
||||
//
|
||||
// int rbd_group_create(rados_ioctx_t p, const char *name);
|
||||
func GroupCreate(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
@ -30,7 +31,8 @@ func GroupCreate(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);
|
||||
//
|
||||
// int rbd_group_remove(rados_ioctx_t p, const char *name);
|
||||
func GroupRemove(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
@ -42,8 +44,9 @@ func GroupRemove(ioctx *rados.IOContext, name 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);
|
||||
//
|
||||
// int rbd_group_rename(rados_ioctx_t p, const char *src_name,
|
||||
// const char *dest_name);
|
||||
func GroupRename(ioctx *rados.IOContext, src, dest string) error {
|
||||
cSrc := C.CString(src)
|
||||
defer C.free(unsafe.Pointer(cSrc))
|
||||
@ -57,7 +60,8 @@ func GroupRename(ioctx *rados.IOContext, src, dest string) error {
|
||||
// GroupList returns a slice of image group names.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_group_list(rados_ioctx_t p, char *names, size_t *size);
|
||||
//
|
||||
// int rbd_group_list(rados_ioctx_t p, char *names, size_t *size);
|
||||
func GroupList(ioctx *rados.IOContext) ([]string, error) {
|
||||
var (
|
||||
buf []byte
|
||||
@ -89,10 +93,11 @@ func GroupList(ioctx *rados.IOContext) ([]string, error) {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_group_image_add(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rados_ioctx_t image_p,
|
||||
// const char *image_name);
|
||||
func GroupImageAdd(groupIoctx *rados.IOContext, groupName string,
|
||||
imageIoctx *rados.IOContext, imageName string) error {
|
||||
|
||||
@ -113,10 +118,11 @@ func GroupImageAdd(groupIoctx *rados.IOContext, groupName string,
|
||||
// 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);
|
||||
//
|
||||
// int rbd_group_image_remove(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rados_ioctx_t image_p,
|
||||
// const char *image_name);
|
||||
func GroupImageRemove(groupIoctx *rados.IOContext, groupName string,
|
||||
imageIoctx *rados.IOContext, imageName string) error {
|
||||
|
||||
@ -137,10 +143,11 @@ func GroupImageRemove(groupIoctx *rados.IOContext, groupName string,
|
||||
// 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);
|
||||
//
|
||||
// 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 GroupImageRemoveByID(groupIoctx *rados.IOContext, groupName string,
|
||||
imageIoctx *rados.IOContext, imageID string) error {
|
||||
|
||||
@ -178,11 +185,12 @@ type GroupImageInfo struct {
|
||||
// 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);
|
||||
//
|
||||
// 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);
|
||||
func GroupImageList(ioctx *rados.IOContext, name string) ([]GroupImageInfo, error) {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
@ -233,8 +241,9 @@ type GroupInfo struct {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_get_group(rbd_image_t image, rbd_group_info_t *group_info,
|
||||
// size_t group_info_size);
|
||||
func (image *Image) GetGroup() (GroupInfo, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return GroupInfo{}, err
|
||||
|
52
vendor/github.com/ceph/go-ceph/rbd/group_snap.go
generated
vendored
52
vendor/github.com/ceph/go-ceph/rbd/group_snap.go
generated
vendored
@ -29,9 +29,10 @@ import (
|
||||
// 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);
|
||||
//
|
||||
// int rbd_group_snap_create(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
func GroupSnapCreate(ioctx *rados.IOContext, group, snap string) error {
|
||||
cGroupName := C.CString(group)
|
||||
defer C.free(unsafe.Pointer(cGroupName))
|
||||
@ -45,9 +46,10 @@ func GroupSnapCreate(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);
|
||||
//
|
||||
// int rbd_group_snap_remove(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
func GroupSnapRemove(ioctx *rados.IOContext, group, snap string) error {
|
||||
cGroupName := C.CString(group)
|
||||
defer C.free(unsafe.Pointer(cGroupName))
|
||||
@ -61,10 +63,11 @@ func GroupSnapRemove(ioctx *rados.IOContext, group, snap 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);
|
||||
//
|
||||
// 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 GroupSnapRename(ioctx *rados.IOContext, group, src, dest string) error {
|
||||
cGroupName := C.CString(group)
|
||||
defer C.free(unsafe.Pointer(cGroupName))
|
||||
@ -98,11 +101,12 @@ type GroupSnapInfo struct {
|
||||
// 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);
|
||||
//
|
||||
// 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);
|
||||
func GroupSnapList(ioctx *rados.IOContext, group string) ([]GroupSnapInfo, error) {
|
||||
cGroupName := C.CString(group)
|
||||
defer C.free(unsafe.Pointer(cGroupName))
|
||||
@ -147,9 +151,10 @@ func GroupSnapList(ioctx *rados.IOContext, group string) ([]GroupSnapInfo, error
|
||||
// given snapshot.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_group_snap_rollback(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
//
|
||||
// int rbd_group_snap_rollback(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
func GroupSnapRollback(ioctx *rados.IOContext, group, snap string) error {
|
||||
cGroupName := C.CString(group)
|
||||
defer C.free(unsafe.Pointer(cGroupName))
|
||||
@ -174,11 +179,12 @@ var groupSnapRollbackCallbacks = callbacks.New()
|
||||
// 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);
|
||||
//
|
||||
// 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 GroupSnapRollbackWithProgress(
|
||||
ioctx *rados.IOContext, group, snap string,
|
||||
cb GroupSnapRollbackCallback, data interface{}) error {
|
||||
|
14
vendor/github.com/ceph/go-ceph/rbd/metadata.go
generated
vendored
14
vendor/github.com/ceph/go-ceph/rbd/metadata.go
generated
vendored
@ -15,7 +15,8 @@ import (
|
||||
// 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)
|
||||
//
|
||||
// int rbd_metadata_get(rbd_image_t image, const char *key, char *value, size_t *vallen)
|
||||
func (image *Image) GetMetadata(key string) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", err
|
||||
@ -47,7 +48,8 @@ func (image *Image) GetMetadata(key string) (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)
|
||||
//
|
||||
// int rbd_metadata_set(rbd_image_t image, const char *key, const char *value)
|
||||
func (image *Image) SetMetadata(key string, value string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -69,7 +71,8 @@ func (image *Image) SetMetadata(key string, value string) error {
|
||||
// RemoveMetadata clears the metadata associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_metadata_remove(rbd_image_t image, const char *key)
|
||||
//
|
||||
// int rbd_metadata_remove(rbd_image_t image, const char *key)
|
||||
func (image *Image) RemoveMetadata(key string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -89,8 +92,9 @@ func (image *Image) RemoveMetadata(key 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);
|
||||
//
|
||||
// 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 *Image) ListMetadata() (map[string]string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
|
38
vendor/github.com/ceph/go-ceph/rbd/migration.go
generated
vendored
38
vendor/github.com/ceph/go-ceph/rbd/migration.go
generated
vendored
@ -62,12 +62,12 @@ type MigrationImageStatus struct {
|
||||
// to source and making source read-only.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_prepare(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
//
|
||||
// int rbd_migration_prepare(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
func MigrationPrepare(ioctx *rados.IOContext, sourceImageName string, destIoctx *rados.IOContext, destImageName string, rio *ImageOptions) error {
|
||||
cSourceImageName := C.CString(sourceImageName)
|
||||
cDestImageName := C.CString(destImageName)
|
||||
@ -90,11 +90,11 @@ func MigrationPrepare(ioctx *rados.IOContext, sourceImageName string, destIoctx
|
||||
// from a specified source to a new target image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_prepare_import(const char *source_spec,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
//
|
||||
// int rbd_migration_prepare_import(const char *source_spec,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
func MigrationPrepareImport(sourceSpec string, ioctx *rados.IOContext, destImageName string, rio *ImageOptions) error {
|
||||
cSourceSpec := C.CString(sourceSpec)
|
||||
cDestImageName := C.CString(destImageName)
|
||||
@ -116,9 +116,9 @@ func MigrationPrepareImport(sourceSpec string, ioctx *rados.IOContext, destImage
|
||||
// from the source image to the target image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_execute(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
// int rbd_migration_execute(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
func MigrationExecute(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -136,9 +136,9 @@ func MigrationExecute(ioctx *rados.IOContext, name string) error {
|
||||
// breaking the relationship of image to the source.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_commit(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
// int rbd_migration_commit(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
func MigrationCommit(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -156,9 +156,9 @@ func MigrationCommit(ioctx *rados.IOContext, name string) error {
|
||||
// breaking the relationship of image to the source.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_abort(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
// int rbd_migration_abort(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
func MigrationAbort(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -176,11 +176,11 @@ func MigrationAbort(ioctx *rados.IOContext, name string) error {
|
||||
// for the specified image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_migration_status(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rbd_image_migration_status_t *status,
|
||||
// size_t status_size);
|
||||
//
|
||||
// int rbd_migration_status(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rbd_image_migration_status_t *status,
|
||||
// size_t status_size);
|
||||
func MigrationStatus(ioctx *rados.IOContext, name string) (*MigrationImageStatus, error) {
|
||||
cName := C.CString(name)
|
||||
|
||||
|
115
vendor/github.com/ceph/go-ceph/rbd/mirror.go
generated
vendored
115
vendor/github.com/ceph/go-ceph/rbd/mirror.go
generated
vendored
@ -81,8 +81,9 @@ func (imm ImageMirrorMode) String() string {
|
||||
// associated with the ioctx.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_uuid_get(rados_ioctx_t io_ctx, char *uuid, size_t
|
||||
// *max_len);
|
||||
//
|
||||
// int rbd_mirror_uuid_get(rados_ioctx_t io_ctx, char *uuid, size_t
|
||||
// *max_len);
|
||||
func GetMirrorUUID(ioctx *rados.IOContext) (string, error) {
|
||||
var (
|
||||
err error
|
||||
@ -109,8 +110,9 @@ func GetMirrorUUID(ioctx *rados.IOContext) (string, error) {
|
||||
// an automatic or per-image behavior.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_mode_set(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_mode_t mirror_mode);
|
||||
//
|
||||
// int rbd_mirror_mode_set(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_mode_t mirror_mode);
|
||||
func SetMirrorMode(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
ret := C.rbd_mirror_mode_set(
|
||||
cephIoctx(ioctx),
|
||||
@ -121,8 +123,9 @@ func SetMirrorMode(ioctx *rados.IOContext, mode 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);
|
||||
//
|
||||
// int rbd_mirror_mode_get(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_mode_t *mirror_mode);
|
||||
func GetMirrorMode(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
var mode C.rbd_mirror_mode_t
|
||||
|
||||
@ -138,8 +141,9 @@ func GetMirrorMode(ioctx *rados.IOContext) (MirrorMode, 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);
|
||||
//
|
||||
// int rbd_mirror_image_enable2(rbd_image_t image,
|
||||
// rbd_mirror_image_mode_t mode);
|
||||
func (image *Image) MirrorEnable(mode ImageMirrorMode) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -151,7 +155,8 @@ func (image *Image) MirrorEnable(mode ImageMirrorMode) error {
|
||||
// MirrorDisable will disable mirroring for the image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force);
|
||||
//
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force);
|
||||
func (image *Image) MirrorDisable(force bool) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -163,7 +168,8 @@ func (image *Image) MirrorDisable(force bool) error {
|
||||
// MirrorPromote will promote the image to primary status.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force);
|
||||
//
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force);
|
||||
func (image *Image) MirrorPromote(force bool) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -175,7 +181,8 @@ func (image *Image) MirrorPromote(force bool) error {
|
||||
// MirrorDemote will demote the image to secondary status.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_demote(rbd_image_t image);
|
||||
//
|
||||
// int rbd_mirror_image_demote(rbd_image_t image);
|
||||
func (image *Image) MirrorDemote() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -188,7 +195,8 @@ func (image *Image) MirrorDemote() error {
|
||||
// resynchronization.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_resync(rbd_image_t image);
|
||||
//
|
||||
// int rbd_mirror_image_resync(rbd_image_t image);
|
||||
func (image *Image) MirrorResync() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -200,9 +208,10 @@ func (image *Image) MirrorResync() 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);
|
||||
//
|
||||
// int rbd_mirror_image_get_instance_id(rbd_image_t image,
|
||||
// char *instance_id,
|
||||
// size_t *id_max_length);
|
||||
func (image *Image) MirrorInstanceID() (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", err
|
||||
@ -275,9 +284,10 @@ func convertMirrorImageInfo(cInfo *C.rbd_mirror_image_info_t) MirrorImageInfo {
|
||||
// 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)
|
||||
//
|
||||
// int rbd_mirror_image_get_info(rbd_image_t image,
|
||||
// rbd_mirror_image_info_t *mirror_image_info,
|
||||
// size_t info_size)
|
||||
func (image *Image) GetMirrorImageInfo() (*MirrorImageInfo, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -303,7 +313,8 @@ func (image *Image) GetMirrorImageInfo() (*MirrorImageInfo, 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);
|
||||
//
|
||||
// int rbd_mirror_image_get_mode(rbd_image_t image, rbd_mirror_image_mode_t *mode);
|
||||
func (image *Image) GetImageMirrorMode() (ImageMirrorMode, error) {
|
||||
var mode C.rbd_mirror_image_mode_t
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -404,10 +415,11 @@ type siteArray [cutil.MaxIdx]C.rbd_mirror_image_site_status_t
|
||||
// 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);
|
||||
//
|
||||
// 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 *Image) GetGlobalMirrorStatus() (GlobalMirrorImageStatus, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return GlobalMirrorImageStatus{}, err
|
||||
@ -453,8 +465,9 @@ func newGlobalMirrorImageStatus(
|
||||
// CreateMirrorSnapshot creates a snapshot for image propagation to mirrors.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_create_snapshot(rbd_image_t image,
|
||||
// uint64_t *snap_id);
|
||||
//
|
||||
// int rbd_mirror_image_create_snapshot(rbd_image_t image,
|
||||
// uint64_t *snap_id);
|
||||
func (image *Image) CreateMirrorSnapshot() (uint64, error) {
|
||||
var snapID C.uint64_t
|
||||
ret := C.rbd_mirror_image_create_snapshot(
|
||||
@ -467,9 +480,10 @@ func (image *Image) CreateMirrorSnapshot() (uint64, error) {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_mirror_image_status_summary(
|
||||
// rados_ioctx_t io_ctx, rbd_mirror_image_status_state_t *states, int *counts,
|
||||
// size_t *maxlen);
|
||||
func MirrorImageStatusSummary(
|
||||
ioctx *rados.IOContext) (map[MirrorImageStatusState]uint, error) {
|
||||
// ideally, we already know the size of the arrays - they should be
|
||||
@ -513,8 +527,9 @@ func MirrorImageStatusSummary(
|
||||
// cluster associated with the provided rados connection.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_site_name_set(rados_t cluster,
|
||||
// const char *name);
|
||||
//
|
||||
// int rbd_mirror_site_name_set(rados_t cluster,
|
||||
// const char *name);
|
||||
func SetMirrorSiteName(conn *rados.Conn, name string) error {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
@ -530,7 +545,8 @@ func SetMirrorSiteName(conn *rados.Conn, name string) error {
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_site_name_get(rados_t cluster,
|
||||
// char *name, size_t *max_len);
|
||||
//
|
||||
// char *name, size_t *max_len);
|
||||
func GetMirrorSiteName(conn *rados.Conn) (string, error) {
|
||||
|
||||
var (
|
||||
@ -562,8 +578,9 @@ func GetMirrorSiteName(conn *rados.Conn) (string, error) {
|
||||
// pools.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_peer_bootstrap_create(
|
||||
// rados_ioctx_t io_ctx, char *token, size_t *max_len);
|
||||
//
|
||||
// int rbd_mirror_peer_bootstrap_create(
|
||||
// rados_ioctx_t io_ctx, char *token, size_t *max_len);
|
||||
func CreateMirrorPeerBootstrapToken(ioctx *rados.IOContext) (string, error) {
|
||||
var (
|
||||
cioctx = cephIoctx(ioctx)
|
||||
@ -606,9 +623,10 @@ const (
|
||||
// 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);
|
||||
//
|
||||
// int rbd_mirror_peer_bootstrap_import(
|
||||
// rados_ioctx_t io_ctx, rbd_mirror_peer_direction_t direction,
|
||||
// const char *token);
|
||||
func ImportMirrorPeerBootstrapToken(
|
||||
ioctx *rados.IOContext, direction MirrorPeerDirection, token string) error {
|
||||
// instead of taking a length, rbd_mirror_peer_bootstrap_import assumes a
|
||||
@ -644,8 +662,9 @@ var iterBufSize = 64
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// const char *start_id, size_t max, char **image_ids,
|
||||
// rbd_mirror_image_status_t *images, size_t *len)
|
||||
func MirrorImageGlobalStatusList(
|
||||
ioctx *rados.IOContext, start string, max int) ([]GlobalMirrorImageIDAndStatus, error) {
|
||||
var (
|
||||
@ -781,10 +800,11 @@ type MirrorImageInfoItem struct {
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// 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)
|
||||
func MirrorImageInfoList(
|
||||
ioctx *rados.IOContext, modeFilter ImageMirrorModeFilter, start string,
|
||||
max int) ([]MirrorImageInfoItem, error) {
|
||||
@ -921,11 +941,12 @@ type MirrorImageInstanceIDItem struct {
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// rados_ioctx_t io_ctx,
|
||||
// const char *start_id,
|
||||
// size_t max, char **image_ids,
|
||||
// char **instance_ids,
|
||||
// size_t *len)
|
||||
func MirrorImageInstanceIDList(
|
||||
ioctx *rados.IOContext, start string,
|
||||
max int) ([]MirrorImageInstanceIDItem, error) {
|
||||
|
71
vendor/github.com/ceph/go-ceph/rbd/mirror_desc_status.go
generated
vendored
Normal file
71
vendor/github.com/ceph/go-ceph/rbd/mirror_desc_status.go
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
// #cgo LDFLAGS: -lrbd
|
||||
// #include <stdlib.h>
|
||||
// #include <rbd/librbd.h>
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// MirrorDescriptionReplayStatus contains information pertaining to the status
|
||||
// of snapshot based RBD image mirroring.
|
||||
type MirrorDescriptionReplayStatus struct {
|
||||
ReplayState string `json:"replay_state"`
|
||||
RemoteSnapshotTimestamp int64 `json:"remote_snapshot_timestamp"`
|
||||
LocalSnapshotTimestamp int64 `json:"local_snapshot_timestamp"`
|
||||
SyncingSnapshotTimestamp int64 `json:"syncing_snapshot_timestamp"`
|
||||
SyncingPercent int `json:"syncing_percent"`
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
BytesPerSnapshot float64 `json:"bytes_per_snapshot"`
|
||||
LastSnapshotSyncSeconds int64 `json:"last_snapshot_sync_seconds"`
|
||||
LastSnapshotBytes int64 `json:"last_snapshot_bytes"`
|
||||
}
|
||||
|
||||
// extractDescriptionJSON will extract one string containing a JSON object from
|
||||
// the description if one can be found.
|
||||
func (s *SiteMirrorImageStatus) extractDescriptionJSON() (string, error) {
|
||||
start := strings.Index(s.Description, "{")
|
||||
if start == -1 {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
end := strings.LastIndex(s.Description, "}")
|
||||
if end == -1 {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
if start >= end {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
return s.Description[start : end+1], nil
|
||||
}
|
||||
|
||||
// UnmarshalDescriptionJSON parses an embedded JSON string that may be found in
|
||||
// the description of the SiteMirrorImageStatus. It will store the result in
|
||||
// the value pointed to by v. If no embedded JSON string is found an
|
||||
// ErrNotExist error is returned. An error may also be returned if the contents
|
||||
// can not be parsed.
|
||||
func (s *SiteMirrorImageStatus) UnmarshalDescriptionJSON(v interface{}) error {
|
||||
desc, err := s.extractDescriptionJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return json.Unmarshal([]byte(desc), v)
|
||||
}
|
||||
|
||||
// DescriptionReplayStatus parses a MirrorDescriptionReplayStatus result out of
|
||||
// the image status description field if available. If the embedded status JSON
|
||||
// is not found or fails to parse and error will be returned.
|
||||
func (s *SiteMirrorImageStatus) DescriptionReplayStatus() (
|
||||
*MirrorDescriptionReplayStatus, error) {
|
||||
// ---
|
||||
mdrs := MirrorDescriptionReplayStatus{}
|
||||
if err := s.UnmarshalDescriptionJSON(&mdrs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mdrs, nil
|
||||
}
|
58
vendor/github.com/ceph/go-ceph/rbd/mirror_nautilus.go
generated
vendored
58
vendor/github.com/ceph/go-ceph/rbd/mirror_nautilus.go
generated
vendored
@ -35,7 +35,8 @@ const (
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_mode_get(rados_ioctx_t p, rbd_mirror_mode_t *mirror_mode)
|
||||
//
|
||||
// int rbd_mirror_mode_get(rados_ioctx_t p, rbd_mirror_mode_t *mirror_mode)
|
||||
func MirrorModeGet(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
var rmm C.rbd_mirror_mode_t
|
||||
|
||||
@ -53,7 +54,8 @@ func MirrorModeGet(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// rbd_mirror_mode_set(rados_ioctx_t p, rbd_mirror_mode_t mirror_mode)
|
||||
//
|
||||
// rbd_mirror_mode_set(rados_ioctx_t p, rbd_mirror_mode_t mirror_mode)
|
||||
func MirrorModeSet(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
cMode := C.rbd_mirror_mode_t(mode)
|
||||
|
||||
@ -70,10 +72,11 @@ func MirrorModeSet(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_peer_add(rados_ioctx_t p, char *uuid,
|
||||
// size_t uuid_max_length,
|
||||
// const char *cluster_name,
|
||||
// const char *client_name)
|
||||
//
|
||||
// int rbd_mirror_peer_add(rados_ioctx_t p, char *uuid,
|
||||
// size_t uuid_max_length,
|
||||
// const char *cluster_name,
|
||||
// const char *client_name)
|
||||
func MirrorPeerAdd(ioctx *rados.IOContext, clusterName, clientName string) (string, error) {
|
||||
// librbd uses 36-byte UUIDs with a trailing null. rbd_mirror_add_peer will
|
||||
// return -E2BIG if we pass a UUID buffer smaller than 37 bytes.
|
||||
@ -98,7 +101,8 @@ func MirrorPeerAdd(ioctx *rados.IOContext, clusterName, clientName string) (stri
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_peer_remove(rados_ioctx_t io_ctx, const char *uuid)
|
||||
//
|
||||
// int rbd_mirror_peer_remove(rados_ioctx_t io_ctx, const char *uuid)
|
||||
func MirrorPeerRemove(ioctx *rados.IOContext, uuid string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
@ -121,9 +125,10 @@ type MirrorPeerInfo struct {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_peer_list(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_peer_list_t *peers,
|
||||
// int *max_peers);
|
||||
//
|
||||
// int rbd_mirror_peer_list(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_peer_list_t *peers,
|
||||
// int *max_peers);
|
||||
func MirrorPeerList(ioctx *rados.IOContext) ([]*MirrorPeerInfo, error) {
|
||||
var mpi []*MirrorPeerInfo
|
||||
cMaxPeers := C.int(5)
|
||||
@ -218,9 +223,10 @@ type MirrorImageInfo struct {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// rbd_mirror_image_get_info(rbd_image_t image,
|
||||
// rbd_mirror_image_info_t *mirror_image_info,
|
||||
// size_t info_size)
|
||||
//
|
||||
// rbd_mirror_image_get_info(rbd_image_t image,
|
||||
// rbd_mirror_image_info_t *mirror_image_info,
|
||||
// size_t info_size)
|
||||
func (image *Image) MirrorGetImage() (*MirrorImageInfo, error) {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
@ -250,11 +256,12 @@ func (image *Image) MirrorGetImage() (*MirrorImageInfo, error) {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_status_list(rados_ioctx_t io_ctx,
|
||||
// const char *start_id, size_t max,
|
||||
// char **image_ids,
|
||||
// rbd_mirror_image_status_t *images,
|
||||
// size_t *len)
|
||||
//
|
||||
// int rbd_mirror_image_status_list(rados_ioctx_t io_ctx,
|
||||
// const char *start_id, size_t max,
|
||||
// char **image_ids,
|
||||
// rbd_mirror_image_status_t *images,
|
||||
// size_t *len)
|
||||
func MirrorImageList(ioctx *rados.IOContext) ([]*MirrorImageInfo, error) {
|
||||
imageInfos := make([]*MirrorImageInfo, 0)
|
||||
const cMaxIter C.size_t = 100
|
||||
@ -327,7 +334,8 @@ func iterateImageList(ioctx *rados.IOContext, imageInfos *[]*MirrorImageInfo, st
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_enable(rbd_image_t image)
|
||||
//
|
||||
// int rbd_mirror_image_enable(rbd_image_t image)
|
||||
func (image *Image) MirrorEnable() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
@ -344,7 +352,8 @@ func (image *Image) MirrorEnable() error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force)
|
||||
//
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force)
|
||||
func (image *Image) MirrorDisable(force bool) error {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
@ -361,7 +370,8 @@ func (image *Image) MirrorDisable(force bool) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force)
|
||||
//
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force)
|
||||
func (image *Image) MirrorPromote(force bool) error {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
@ -378,7 +388,8 @@ func (image *Image) MirrorPromote(force bool) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_demote(rbd_image_t image)
|
||||
//
|
||||
// int rbd_mirror_image_demote(rbd_image_t image)
|
||||
func (image *Image) MirrorDemote() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
@ -396,7 +407,8 @@ func (image *Image) MirrorDemote() error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_resync(rbd_image_t image)
|
||||
//
|
||||
// int rbd_mirror_image_resync(rbd_image_t image)
|
||||
func (image *Image) MirrorResync() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
if err != nil {
|
||||
|
255
vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go
generated
vendored
Normal file
255
vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
// #cgo LDFLAGS: -lrbd
|
||||
// #include <stdlib.h>
|
||||
// #include <rbd/librbd.h>
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/cutil"
|
||||
"github.com/ceph/go-ceph/internal/retry"
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
)
|
||||
|
||||
// AddMirrorPeerSite adds a peer site to the list of existing sites
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_add(rados_ioctx_t p, char *uuid, size_t uuid_max_length,
|
||||
// rbd_mirror_peer_direction_t direction,
|
||||
// const char *site_name,
|
||||
// const char *client_name);
|
||||
func AddMirrorPeerSite(ioctx *rados.IOContext, siteName string, clientName string,
|
||||
direction MirrorPeerDirection) (string, error) {
|
||||
|
||||
var (
|
||||
err error
|
||||
buf []byte
|
||||
cSize C.size_t
|
||||
)
|
||||
|
||||
cSiteName := C.CString(siteName)
|
||||
defer C.free(unsafe.Pointer(cSiteName))
|
||||
cClientName := C.CString(clientName)
|
||||
defer C.free(unsafe.Pointer(cClientName))
|
||||
|
||||
retry.WithSizes(512, 1<<16, func(size int) retry.Hint {
|
||||
cSize = C.size_t(size)
|
||||
buf = make([]byte, cSize)
|
||||
ret := C.rbd_mirror_peer_site_add(
|
||||
cephIoctx(ioctx),
|
||||
(*C.char)(unsafe.Pointer(&buf[0])),
|
||||
cSize, C.rbd_mirror_peer_direction_t(direction),
|
||||
cSiteName, cClientName)
|
||||
err = getError(ret)
|
||||
return retry.Size(int(cSize)).If(err != nil)
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(bytes.Trim(buf[:cSize], "\x00")), nil
|
||||
}
|
||||
|
||||
// RemoveMirrorPeerSite removes the site with the provided uuid
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_remove(rados_ioctx_t p, const char *uuid)
|
||||
func RemoveMirrorPeerSite(ioctx *rados.IOContext, uuid string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_remove(cephIoctx(ioctx), cUUID)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// GetAttributesMirrorPeerSite fetches the list of key,value pair of attributes of a peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_get_attributes(rados_ioctx_t p, const char *uuid, char *keys,
|
||||
// size_t *max_key_len, char *values, size_t *max_val_len,
|
||||
// size_t *key_value_count);
|
||||
func GetAttributesMirrorPeerSite(ioctx *rados.IOContext, uuid string) (map[string]string, error) {
|
||||
|
||||
var (
|
||||
err error
|
||||
keys []byte
|
||||
vals []byte
|
||||
keySize C.size_t
|
||||
valSize C.size_t
|
||||
count = C.size_t(0)
|
||||
)
|
||||
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
retry.WithSizes(1024, 1<<16, func(size int) retry.Hint {
|
||||
keySize = C.size_t(size)
|
||||
valSize = C.size_t(size)
|
||||
keys = make([]byte, keySize)
|
||||
vals = make([]byte, valSize)
|
||||
ret := C.rbd_mirror_peer_site_get_attributes(
|
||||
cephIoctx(ioctx), cUUID, (*C.char)(unsafe.Pointer(&keys[0])),
|
||||
&keySize, (*C.char)(unsafe.Pointer(&vals[0])), &valSize,
|
||||
&count)
|
||||
err = getErrorIfNegative(ret)
|
||||
return retry.Size(int(keySize)).If(err == errRange)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
keyList := cutil.SplitBuffer(keys[:keySize])
|
||||
valList := cutil.SplitBuffer(vals[:valSize])
|
||||
attributes := map[string]string{}
|
||||
for i := 0; i < int(len(keyList)); i++ {
|
||||
attributes[keyList[i]] = valList[i]
|
||||
}
|
||||
return attributes, nil
|
||||
}
|
||||
|
||||
// SetAttributesMirrorPeerSite sets the attributes for the site with the given uuid
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_attributes(rados_ioctx_t p, const char *uuid,
|
||||
// const char *keys, const char *values,
|
||||
// size_t count) ;
|
||||
func SetAttributesMirrorPeerSite(ioctx *rados.IOContext, uuid string, attributes map[string]string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
var (
|
||||
key string
|
||||
val string
|
||||
count = C.size_t(len(attributes))
|
||||
)
|
||||
|
||||
for k, v := range attributes {
|
||||
key += k + "\000"
|
||||
val += v + "\000"
|
||||
}
|
||||
|
||||
cKey := C.CString(key)
|
||||
defer C.free(unsafe.Pointer(cKey))
|
||||
|
||||
cVal := C.CString(val)
|
||||
defer C.free(unsafe.Pointer(cVal))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_attributes(cephIoctx(ioctx), cUUID, cKey, cVal, count)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// MirrorPeerSite contains information about a mirroring peer site.
|
||||
type MirrorPeerSite struct {
|
||||
UUID string
|
||||
Direction MirrorPeerDirection
|
||||
SiteName string
|
||||
MirrorUUID string
|
||||
ClientName string
|
||||
LastSeen C.time_t
|
||||
}
|
||||
|
||||
// ListMirrorPeerSite returns the list of peer sites
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_list(rados_ioctx_t p, rbd_mirror_peer_site_t *peers, int *max_peers)
|
||||
func ListMirrorPeerSite(ioctx *rados.IOContext) ([]*MirrorPeerSite, error) {
|
||||
var mps []*MirrorPeerSite
|
||||
cMaxPeers := C.int(10)
|
||||
|
||||
var cSites []C.rbd_mirror_peer_site_t
|
||||
for {
|
||||
cSites = make([]C.rbd_mirror_peer_site_t, cMaxPeers)
|
||||
ret := C.rbd_mirror_peer_site_list(cephIoctx(ioctx), &cSites[0], &cMaxPeers)
|
||||
err := getError(ret)
|
||||
if err == errRange {
|
||||
// There are too many peer sites to fit in the list, and the number of peer sites has been
|
||||
// returned in cMaxPeers. Try again with the returned value.
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ret == 0
|
||||
break
|
||||
}
|
||||
|
||||
defer C.rbd_mirror_peer_site_list_cleanup(&cSites[0], cMaxPeers)
|
||||
cSites = cSites[:cMaxPeers]
|
||||
|
||||
for _, cSite := range cSites {
|
||||
mps = append(mps, &MirrorPeerSite{
|
||||
UUID: C.GoString(cSite.uuid),
|
||||
Direction: MirrorPeerDirection(cSite.direction),
|
||||
SiteName: C.GoString(cSite.site_name),
|
||||
MirrorUUID: C.GoString(cSite.mirror_uuid),
|
||||
ClientName: C.GoString(cSite.client_name),
|
||||
})
|
||||
}
|
||||
|
||||
return mps, nil
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteClientName sets the client name for a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_client_name(rados_ioctx_t p, const char *uuid,
|
||||
// const char *client_name);
|
||||
func SetMirrorPeerSiteClientName(ioctx *rados.IOContext, uuid string, clientName string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
cClientName := C.CString(clientName)
|
||||
defer C.free(unsafe.Pointer(cClientName))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_client_name(cephIoctx(ioctx), cUUID, cClientName)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteDirection sets the direction of a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_direction(rados_ioctx_t p, const char *uuid,
|
||||
// rbd_mirror_peer_direction_t direction);
|
||||
func SetMirrorPeerSiteDirection(ioctx *rados.IOContext, uuid string, direction MirrorPeerDirection) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_direction(cephIoctx(ioctx), cUUID,
|
||||
C.rbd_mirror_peer_direction_t(direction))
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteName sets the name of a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_name(rados_ioctx_t p, const char *uuid,
|
||||
// const char *site_name);
|
||||
func SetMirrorPeerSiteName(ioctx *rados.IOContext, uuid string, siteName string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
cSiteName := C.CString(siteName)
|
||||
defer C.free(unsafe.Pointer(cSiteName))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_name(cephIoctx(ioctx), cUUID, cSiteName)
|
||||
|
||||
return getError(ret)
|
||||
}
|
12
vendor/github.com/ceph/go-ceph/rbd/namespace_nautilus.go
generated
vendored
12
vendor/github.com/ceph/go-ceph/rbd/namespace_nautilus.go
generated
vendored
@ -22,7 +22,8 @@ import (
|
||||
// NamespaceCreate creates the namespace for a given Rados IOContext.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_namespace_create(rados_ioctx_t io, const char *namespace_name);
|
||||
//
|
||||
// int rbd_namespace_create(rados_ioctx_t io, const char *namespace_name);
|
||||
func NamespaceCreate(ioctx *rados.IOContext, namespaceName string) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -40,7 +41,8 @@ func NamespaceCreate(ioctx *rados.IOContext, namespaceName string) error {
|
||||
// NamespaceRemove removes a given namespace.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_namespace_remove(rados_ioctx_t io, const char *namespace_name);
|
||||
//
|
||||
// int rbd_namespace_remove(rados_ioctx_t io, const char *namespace_name);
|
||||
func NamespaceRemove(ioctx *rados.IOContext, namespaceName string) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -58,7 +60,8 @@ func NamespaceRemove(ioctx *rados.IOContext, namespaceName string) 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);
|
||||
//
|
||||
// int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name, bool *exists);
|
||||
func NamespaceExists(ioctx *rados.IOContext, namespaceName string) (bool, error) {
|
||||
if ioctx == nil {
|
||||
return false, ErrNoIOContext
|
||||
@ -77,7 +80,8 @@ func NamespaceExists(ioctx *rados.IOContext, namespaceName string) (bool, 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);
|
||||
//
|
||||
// int rbd_namespace_list(rados_ioctx_t io, char *namespace_names, size_t *size);
|
||||
func NamespaceList(ioctx *rados.IOContext) (names []string, err error) {
|
||||
if ioctx == nil {
|
||||
return nil, ErrNoIOContext
|
||||
|
40
vendor/github.com/ceph/go-ceph/rbd/options.go
generated
vendored
40
vendor/github.com/ceph/go-ceph/rbd/options.go
generated
vendored
@ -99,7 +99,8 @@ type RbdImageOption = ImageOption
|
||||
// RbdImageOptions.Destroy() to free the resources.
|
||||
//
|
||||
// Implements:
|
||||
// void rbd_image_options_create(rbd_image_options_t* opts)
|
||||
//
|
||||
// void rbd_image_options_create(rbd_image_options_t* opts)
|
||||
func NewRbdImageOptions() *ImageOptions {
|
||||
rio := &ImageOptions{}
|
||||
C.rbd_image_options_create(&rio.options)
|
||||
@ -109,7 +110,8 @@ func NewRbdImageOptions() *ImageOptions {
|
||||
// Destroy a RbdImageOptions struct and free the associated resources.
|
||||
//
|
||||
// Implements:
|
||||
// void rbd_image_options_destroy(rbd_image_options_t opts);
|
||||
//
|
||||
// void rbd_image_options_destroy(rbd_image_options_t opts);
|
||||
func (rio *ImageOptions) Destroy() {
|
||||
C.rbd_image_options_destroy(rio.options)
|
||||
}
|
||||
@ -117,8 +119,9 @@ func (rio *ImageOptions) Destroy() {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_image_options_set_string(rbd_image_options_t opts, int optname,
|
||||
// const char* optval);
|
||||
func (rio *ImageOptions) SetString(option ImageOption, value string) error {
|
||||
cValue := C.CString(value)
|
||||
defer C.free(unsafe.Pointer(cValue))
|
||||
@ -135,8 +138,9 @@ func (rio *ImageOptions) SetString(option ImageOption, value 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);
|
||||
//
|
||||
// int rbd_image_options_get_string(rbd_image_options_t opts, int optname,
|
||||
// char* optval, size_t maxlen);
|
||||
func (rio *ImageOptions) GetString(option ImageOption) (string, error) {
|
||||
value := make([]byte, 4096)
|
||||
|
||||
@ -153,8 +157,9 @@ func (rio *ImageOptions) GetString(option ImageOption) (string, 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);
|
||||
//
|
||||
// int rbd_image_options_set_uint64(rbd_image_options_t opts, int optname,
|
||||
// const uint64_t optval);
|
||||
func (rio *ImageOptions) SetUint64(option ImageOption, value uint64) error {
|
||||
cValue := C.uint64_t(value)
|
||||
|
||||
@ -170,8 +175,9 @@ func (rio *ImageOptions) SetUint64(option ImageOption, value 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);
|
||||
//
|
||||
// int rbd_image_options_get_uint64(rbd_image_options_t opts, int optname,
|
||||
// uint64_t* optval);
|
||||
func (rio *ImageOptions) GetUint64(option ImageOption) (uint64, error) {
|
||||
var cValue C.uint64_t
|
||||
|
||||
@ -186,8 +192,9 @@ func (rio *ImageOptions) GetUint64(option ImageOption) (uint64, 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);
|
||||
//
|
||||
// int rbd_image_options_is_set(rbd_image_options_t opts, int optname,
|
||||
// bool* is_set);
|
||||
func (rio *ImageOptions) IsSet(option ImageOption) (bool, error) {
|
||||
var cSet C.bool
|
||||
|
||||
@ -202,7 +209,8 @@ func (rio *ImageOptions) IsSet(option ImageOption) (bool, error) {
|
||||
// Unset a given RbdImageOption.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_image_options_unset(rbd_image_options_t opts, int optname)
|
||||
//
|
||||
// int rbd_image_options_unset(rbd_image_options_t opts, int optname)
|
||||
func (rio *ImageOptions) Unset(option ImageOption) error {
|
||||
ret := C.rbd_image_options_unset(rio.options, C.int(option))
|
||||
if ret != 0 {
|
||||
@ -215,7 +223,8 @@ func (rio *ImageOptions) Unset(option ImageOption) error {
|
||||
// Clear all options in the RbdImageOptions.
|
||||
//
|
||||
// Implements:
|
||||
// void rbd_image_options_clear(rbd_image_options_t opts)
|
||||
//
|
||||
// void rbd_image_options_clear(rbd_image_options_t opts)
|
||||
func (rio *ImageOptions) Clear() {
|
||||
C.rbd_image_options_clear(rio.options)
|
||||
}
|
||||
@ -224,7 +233,8 @@ func (rio *ImageOptions) Clear() {
|
||||
// false otherwise.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_image_options_is_empty(rbd_image_options_t opts)
|
||||
//
|
||||
// int rbd_image_options_is_empty(rbd_image_options_t opts)
|
||||
func (rio *ImageOptions) IsEmpty() bool {
|
||||
ret := C.rbd_image_options_is_empty(rio.options)
|
||||
return ret != 0
|
||||
|
24
vendor/github.com/ceph/go-ceph/rbd/pool_nautilus.go
generated
vendored
24
vendor/github.com/ceph/go-ceph/rbd/pool_nautilus.go
generated
vendored
@ -20,7 +20,8 @@ import (
|
||||
// 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);
|
||||
//
|
||||
// int rbd_pool_metadata_get(rados_ioctx_t io_ctx, const char *key, char *value, size_t *val_len);
|
||||
func GetPoolMetadata(ioctx *rados.IOContext, key string) (string, error) {
|
||||
if ioctx == nil {
|
||||
return "", ErrNoIOContext
|
||||
@ -53,7 +54,8 @@ func GetPoolMetadata(ioctx *rados.IOContext, key string) (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);
|
||||
//
|
||||
// int rbd_pool_metadata_set(rados_ioctx_t io_ctx, const char *key, const char *value);
|
||||
func SetPoolMetadata(ioctx *rados.IOContext, key, value string) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -71,7 +73,8 @@ func SetPoolMetadata(ioctx *rados.IOContext, key, value 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)
|
||||
//
|
||||
// int rbd_pool_metadata_remove(rados_ioctx_t io_ctx, const char *key)
|
||||
func RemovePoolMetadata(ioctx *rados.IOContext, key string) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -89,7 +92,8 @@ func RemovePoolMetadata(ioctx *rados.IOContext, key string) error {
|
||||
// to host rbd images.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_pool_init(rados_ioctx_t io, bool force)
|
||||
//
|
||||
// int rbd_pool_init(rados_ioctx_t io, bool force)
|
||||
func PoolInit(ioctx *rados.IOContext, force bool) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -107,7 +111,8 @@ type poolStats struct {
|
||||
// poolStatsCreate creates a new poolStats struct.
|
||||
//
|
||||
// Implements:
|
||||
// void rbd_pool_stats_create(rbd_pool_stats_t *stats)
|
||||
//
|
||||
// void rbd_pool_stats_create(rbd_pool_stats_t *stats)
|
||||
func poolStatsCreate() *poolStats {
|
||||
poolstats := &poolStats{}
|
||||
C.rbd_pool_stats_create(&poolstats.stats)
|
||||
@ -117,7 +122,8 @@ func poolStatsCreate() *poolStats {
|
||||
// destroy a poolStats struct and free the associated resources.
|
||||
//
|
||||
// Implements:
|
||||
// void rbd_pool_stats_destroy(rbd_pool_stats_t stats)
|
||||
//
|
||||
// void rbd_pool_stats_destroy(rbd_pool_stats_t stats)
|
||||
func (poolstats *poolStats) destroy() {
|
||||
C.rbd_pool_stats_destroy(poolstats.stats)
|
||||
|
||||
@ -159,7 +165,8 @@ const (
|
||||
// addPoolStatOption adds the given PoolStatOption to PoolStats.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_pool_stats_option_add_uint64(rbd_pool_stats_t stats, int stat_option, uint64_t* stat_val)
|
||||
//
|
||||
// int rbd_pool_stats_option_add_uint64(rbd_pool_stats_t stats, int stat_option, uint64_t* stat_val)
|
||||
func (poolstats *poolStats) addPoolStatOption(option PoolStatOption, val *uint64) error {
|
||||
ret := C.rbd_pool_stats_option_add_uint64(
|
||||
poolstats.stats,
|
||||
@ -171,7 +178,8 @@ func (poolstats *poolStats) addPoolStatOption(option PoolStatOption, val *uint64
|
||||
// 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);
|
||||
//
|
||||
// int rbd_pool_stats_get(rados_ioctx_t io, rbd_pool_stats_t stats);
|
||||
func GetAllPoolStats(ioctx *rados.IOContext) (map[PoolStatOption]uint64, error) {
|
||||
var omap = make(map[PoolStatOption]uint64)
|
||||
if ioctx == nil {
|
||||
|
165
vendor/github.com/ceph/go-ceph/rbd/rbd.go
generated
vendored
165
vendor/github.com/ceph/go-ceph/rbd/rbd.go
generated
vendored
@ -145,14 +145,16 @@ func GetImage(ioctx *rados.IOContext, name string) *Image {
|
||||
// Create a new rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_create(rados_ioctx_t io, const char *name, uint64_t size, int *order);
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// 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 Create(ioctx *rados.IOContext, name string, size uint64, order int,
|
||||
args ...uint64) (image *Image, err error) {
|
||||
var ret C.int
|
||||
@ -188,8 +190,9 @@ func Create(ioctx *rados.IOContext, name string, size uint64, order int,
|
||||
// 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);
|
||||
//
|
||||
// int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// uint64_t features, int *order);
|
||||
func Create2(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
order int) (image *Image, err error) {
|
||||
var ret C.int
|
||||
@ -215,9 +218,10 @@ func Create2(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
// 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);
|
||||
//
|
||||
// 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 Create3(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
order int, stripeUnit uint64, stripeCount uint64) (image *Image, err error) {
|
||||
var ret C.int
|
||||
@ -243,9 +247,10 @@ func Create3(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
// 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);
|
||||
//
|
||||
// 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 *Image) Clone(snapname string, cIoctx *rados.IOContext, cName string, features uint64, order int) (*Image, error) {
|
||||
if err := image.validate(imageNeedsIOContext); err != nil {
|
||||
return nil, err
|
||||
@ -281,7 +286,8 @@ func (image *Image) Clone(snapname string, cIoctx *rados.IOContext, cName string
|
||||
// Remove the specified rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
//
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
func (image *Image) Remove() error {
|
||||
if err := image.validate(imageNeedsIOContext | imageNeedsName | imageIsNotOpen); err != nil {
|
||||
return err
|
||||
@ -306,7 +312,8 @@ func (image *Image) Trash(delay time.Duration) error {
|
||||
// Rename an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);
|
||||
//
|
||||
// int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);
|
||||
func (image *Image) Rename(destname string) error {
|
||||
if err := image.validate(imageNeedsIOContext | imageNeedsName); err != nil {
|
||||
return err
|
||||
@ -370,7 +377,8 @@ func (image *Image) Open(args ...interface{}) error {
|
||||
// Close an open rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_close(rbd_image_t image);
|
||||
//
|
||||
// int rbd_close(rbd_image_t image);
|
||||
func (image *Image) Close() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -387,7 +395,8 @@ func (image *Image) Close() error {
|
||||
// Resize an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_resize(rbd_image_t image, uint64_t size);
|
||||
//
|
||||
// int rbd_resize(rbd_image_t image, uint64_t size);
|
||||
func (image *Image) Resize(size uint64) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -399,7 +408,8 @@ func (image *Image) Resize(size uint64) error {
|
||||
// Stat an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);
|
||||
//
|
||||
// int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);
|
||||
func (image *Image) Stat() (info *ImageInfo, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -422,7 +432,8 @@ func (image *Image) Stat() (info *ImageInfo, err 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);
|
||||
//
|
||||
// int rbd_get_old_format(rbd_image_t image, uint8_t *old);
|
||||
func (image *Image) IsOldFormat() (bool, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return false, err
|
||||
@ -441,7 +452,8 @@ func (image *Image) IsOldFormat() (bool, error) {
|
||||
// GetSize returns the size of the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_size(rbd_image_t image, uint64_t *size);
|
||||
//
|
||||
// int rbd_size(rbd_image_t image, uint64_t *size);
|
||||
func (image *Image) GetSize() (size uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -457,7 +469,8 @@ func (image *Image) GetSize() (size uint64, err 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);
|
||||
//
|
||||
// int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);
|
||||
func (image *Image) GetStripeUnit() (uint64, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -474,7 +487,8 @@ func (image *Image) GetStripeUnit() (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);
|
||||
//
|
||||
// int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count);
|
||||
func (image *Image) GetStripeCount() (uint64, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -492,7 +506,8 @@ func (image *Image) GetStripeCount() (uint64, error) {
|
||||
// parent.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);
|
||||
//
|
||||
// int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);
|
||||
func (image *Image) GetOverlap() (overlap uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -508,7 +523,8 @@ func (image *Image) GetOverlap() (overlap uint64, err error) {
|
||||
// Copy one rbd image to another.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname);
|
||||
//
|
||||
// int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname);
|
||||
func (image *Image) Copy(ioctx *rados.IOContext, destname string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -528,7 +544,8 @@ func (image *Image) Copy(ioctx *rados.IOContext, destname string) error {
|
||||
// Copy2 copies one rbd image to another, using an image handle.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_copy2(rbd_image_t src, rbd_image_t dest);
|
||||
//
|
||||
// int rbd_copy2(rbd_image_t src, rbd_image_t dest);
|
||||
func (image *Image) Copy2(dest *Image) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -542,8 +559,9 @@ func (image *Image) Copy2(dest *Image) 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);
|
||||
//
|
||||
// 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 *Image) DeepCopy(ioctx *rados.IOContext, destname string, rio *ImageOptions) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -569,7 +587,8 @@ func (image *Image) DeepCopy(ioctx *rados.IOContext, destname string, rio *Image
|
||||
// Flatten removes snapshot references from the image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_flatten(rbd_image_t image);
|
||||
//
|
||||
// int rbd_flatten(rbd_image_t image);
|
||||
func (image *Image) Flatten() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -581,11 +600,12 @@ func (image *Image) Flatten() 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);
|
||||
//
|
||||
// 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 *Image) ListLockers() (tag string, lockers []Locker, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", nil, err
|
||||
@ -645,7 +665,8 @@ func (image *Image) ListLockers() (tag string, lockers []Locker, err error) {
|
||||
// LockExclusive acquires an exclusive lock on the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_lock_exclusive(rbd_image_t image, const char *cookie);
|
||||
//
|
||||
// int rbd_lock_exclusive(rbd_image_t image, const char *cookie);
|
||||
func (image *Image) LockExclusive(cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -660,7 +681,8 @@ func (image *Image) LockExclusive(cookie 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);
|
||||
//
|
||||
// int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
|
||||
func (image *Image) LockShared(cookie string, tag string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -677,7 +699,8 @@ func (image *Image) LockShared(cookie string, tag string) error {
|
||||
// Unlock releases a lock on the image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
|
||||
//
|
||||
// int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
|
||||
func (image *Image) Unlock(cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -692,7 +715,8 @@ func (image *Image) Unlock(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);
|
||||
//
|
||||
// int rbd_break_lock(rbd_image_t image, const char *client, const char *cookie);
|
||||
func (image *Image) BreakLock(client string, cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -711,8 +735,9 @@ func (image *Image) BreakLock(client string, cookie string) error {
|
||||
// offset which is not safe in concurrent code. Prefer ReadAt when possible.
|
||||
//
|
||||
// Implements:
|
||||
// ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// char *buf);
|
||||
//
|
||||
// ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// char *buf);
|
||||
func (image *Image) Read(data []byte) (int, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -745,8 +770,9 @@ func (image *Image) Read(data []byte) (int, error) {
|
||||
// offset which is not safe in concurrent code. Prefer WriteAt when possible.
|
||||
//
|
||||
// Implements:
|
||||
// ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// const char *buf);
|
||||
//
|
||||
// ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// const char *buf);
|
||||
func (image *Image) Write(data []byte) (n int, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -790,7 +816,8 @@ func (image *Image) Seek(offset int64, whence int) (int64, error) {
|
||||
// space.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len);
|
||||
//
|
||||
// int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len);
|
||||
func (image *Image) Discard(ofs uint64, length uint64) (int, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return 0, err
|
||||
@ -855,8 +882,9 @@ func (image *Image) WriteAt(data []byte, off int64) (n int, err error) {
|
||||
// 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);
|
||||
//
|
||||
// ssize_t rbd_writesame(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// const char *buf, size_t data_len, int op_flags);
|
||||
func (image *Image) WriteSame(ofs, n uint64, data []byte, flags rados.OpFlags) (int64, error) {
|
||||
var err error
|
||||
|
||||
@ -884,7 +912,8 @@ func (image *Image) WriteSame(ofs, n uint64, data []byte, flags rados.OpFlags) (
|
||||
// Flush all cached writes to storage.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_flush(rbd_image_t image);
|
||||
//
|
||||
// int rbd_flush(rbd_image_t image);
|
||||
func (image *Image) Flush() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -897,7 +926,8 @@ func (image *Image) Flush() error {
|
||||
// associated with the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps);
|
||||
//
|
||||
// int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps);
|
||||
func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -929,7 +959,8 @@ func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error) {
|
||||
// GetId returns the internal image ID string.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_get_id(rbd_image_t image, char *id, size_t id_len);
|
||||
//
|
||||
// int rbd_get_id(rbd_image_t image, char *id, size_t id_len);
|
||||
func (image *Image) GetId() (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", err
|
||||
@ -964,7 +995,8 @@ func (image *Image) GetName() string {
|
||||
// is the source of readable data.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
//
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
func (image *Image) SetSnapshot(snapname string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -1033,8 +1065,9 @@ func TrashRestore(ioctx *rados.IOContext, id, name string) error {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_open(rados_ioctx_t io, const char *name,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImage(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
if ioctx == nil {
|
||||
return nil, ErrNoIOContext
|
||||
@ -1076,8 +1109,9 @@ func OpenImage(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
// provided.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_open_read_only(rados_ioctx_t io, const char *name,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
//
|
||||
// int rbd_open_read_only(rados_ioctx_t io, const char *name,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageReadOnly(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
if ioctx == nil {
|
||||
return nil, ErrNoIOContext
|
||||
@ -1120,8 +1154,9 @@ func OpenImageReadOnly(ioctx *rados.IOContext, name, snapName string) (*Image, e
|
||||
// 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);
|
||||
//
|
||||
// int rbd_open_by_id(rados_ioctx_t io, const char *id,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageById(ioctx *rados.IOContext, id, snapName string) (*Image, error) {
|
||||
if ioctx == nil {
|
||||
return nil, ErrNoIOContext
|
||||
@ -1164,8 +1199,9 @@ func OpenImageById(ioctx *rados.IOContext, id, snapName string) (*Image, error)
|
||||
// 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);
|
||||
//
|
||||
// int rbd_open_by_id_read_only(rados_ioctx_t io, const char *id,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageByIdReadOnly(ioctx *rados.IOContext, id, snapName string) (*Image, error) {
|
||||
if ioctx == nil {
|
||||
return nil, ErrNoIOContext
|
||||
@ -1203,8 +1239,9 @@ func OpenImageByIdReadOnly(ioctx *rados.IOContext, id, snapName string) (*Image,
|
||||
// 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);
|
||||
//
|
||||
// int rbd_create4(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// rbd_image_options_t opts);
|
||||
func CreateImage(ioctx *rados.IOContext, name string, size uint64, rio *ImageOptions) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -1227,7 +1264,8 @@ func CreateImage(ioctx *rados.IOContext, name string, size uint64, rio *ImageOpt
|
||||
// RemoveImage removes the specified rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
//
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
func RemoveImage(ioctx *rados.IOContext, name string) error {
|
||||
if ioctx == nil {
|
||||
return ErrNoIOContext
|
||||
@ -1245,9 +1283,10 @@ func RemoveImage(ioctx *rados.IOContext, name string) error {
|
||||
// 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);
|
||||
//
|
||||
// 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 CloneImage(ioctx *rados.IOContext, parentName, snapName string,
|
||||
destctx *rados.IOContext, name string, rio *ImageOptions) error {
|
||||
|
||||
|
12
vendor/github.com/ceph/go-ceph/rbd/rbd_nautilus.go
generated
vendored
12
vendor/github.com/ceph/go-ceph/rbd/rbd_nautilus.go
generated
vendored
@ -48,7 +48,8 @@ func GetImageNames(ioctx *rados.IOContext) ([]string, error) {
|
||||
// GetCreateTimestamp returns the time the rbd image was created.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_get_create_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
//
|
||||
// int rbd_get_create_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetCreateTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return Timespec{}, err
|
||||
@ -66,7 +67,8 @@ func (image *Image) GetCreateTimestamp() (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);
|
||||
//
|
||||
// int rbd_get_access_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetAccessTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return Timespec{}, err
|
||||
@ -84,7 +86,8 @@ func (image *Image) GetAccessTimestamp() (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);
|
||||
//
|
||||
// int rbd_get_modify_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetModifyTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return Timespec{}, err
|
||||
@ -104,7 +107,8 @@ func (image *Image) GetModifyTimestamp() (Timespec, error) {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_sparsify(rbd_image_t image, size_t sparse_size);
|
||||
func (image *Image) Sparsify(sparseSize uint) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
|
26
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
26
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
@ -21,7 +21,8 @@ type Snapshot struct {
|
||||
// a snapshot of the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_create(rbd_image_t image, const char *snapname);
|
||||
//
|
||||
// int rbd_snap_create(rbd_image_t image, const char *snapname);
|
||||
func (image *Image) CreateSnapshot(snapname string) (*Snapshot, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -66,7 +67,8 @@ func (image *Image) GetSnapshot(snapname string) *Snapshot {
|
||||
// Remove the snapshot from the connected rbd image.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_remove(rbd_image_t image, const char *snapname);
|
||||
//
|
||||
// int rbd_snap_remove(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Remove() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -81,7 +83,8 @@ func (snapshot *Snapshot) Remove() error {
|
||||
// Rollback the image to the snapshot.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_rollback(rbd_image_t image, const char *snapname);
|
||||
//
|
||||
// int rbd_snap_rollback(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Rollback() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -96,7 +99,8 @@ func (snapshot *Snapshot) Rollback() error {
|
||||
// Protect a snapshot from unwanted deletion.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_protect(rbd_image_t image, const char *snap_name);
|
||||
//
|
||||
// int rbd_snap_protect(rbd_image_t image, const char *snap_name);
|
||||
func (snapshot *Snapshot) Protect() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -111,7 +115,8 @@ func (snapshot *Snapshot) Protect() error {
|
||||
// Unprotect stops protecting the snapshot.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_unprotect(rbd_image_t image, const char *snap_name);
|
||||
//
|
||||
// int rbd_snap_unprotect(rbd_image_t image, const char *snap_name);
|
||||
func (snapshot *Snapshot) Unprotect() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -126,8 +131,9 @@ func (snapshot *Snapshot) Unprotect() 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);
|
||||
//
|
||||
// int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
|
||||
// int *is_protected);
|
||||
func (snapshot *Snapshot) IsProtected() (bool, error) {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return false, err
|
||||
@ -153,7 +159,8 @@ func (snapshot *Snapshot) IsProtected() (bool, error) {
|
||||
// Deprecated: use the SetSnapshot method of the Image type instead
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
//
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Set() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -168,7 +175,8 @@ func (snapshot *Snapshot) Set() error {
|
||||
// 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)
|
||||
//
|
||||
// int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, struct timespec *timestamp)
|
||||
func (image *Image) GetSnapTimestamp(snapID uint64) (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return Timespec{}, err
|
||||
|
6
vendor/github.com/ceph/go-ceph/rbd/snapshot_namespace.go
generated
vendored
6
vendor/github.com/ceph/go-ceph/rbd/snapshot_namespace.go
generated
vendored
@ -32,7 +32,8 @@ const (
|
||||
// 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)
|
||||
//
|
||||
// int rbd_snap_get_namespace_type(rbd_image_t image, uint64_t snap_id, rbd_snap_namespace_type_t *namespace_type)
|
||||
func (image *Image) GetSnapNamespaceType(snapID uint64) (SnapNamespaceType, error) {
|
||||
var nsType SnapNamespaceType
|
||||
|
||||
@ -51,7 +52,8 @@ func (image *Image) GetSnapNamespaceType(snapID uint64) (SnapNamespaceType, erro
|
||||
// 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)
|
||||
//
|
||||
// int rbd_snap_get_trash_namespace(rbd_image_t image, uint64_t snap_id, char *original_name, size_t max_length)
|
||||
func (image *Image) GetSnapTrashNamespace(snapID uint64) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", err
|
||||
|
15
vendor/github.com/ceph/go-ceph/rbd/snapshot_nautilus.go
generated
vendored
15
vendor/github.com/ceph/go-ceph/rbd/snapshot_nautilus.go
generated
vendored
@ -19,9 +19,10 @@ import (
|
||||
// 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)
|
||||
//
|
||||
// int rbd_get_parent(rbd_image_t image,
|
||||
// rbd_linked_image_spec_t *parent_image,
|
||||
// rbd_snap_spec_t *parent_snap)
|
||||
func (image *Image) GetParentInfo(pool, name, snapname []byte) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
@ -123,8 +124,9 @@ func (image *Image) GetParent() (*ParentInfo, error) {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_list_children3(rbd_image_t image, rbd_linked_image_spec_t *images,
|
||||
// size_t *max_images);
|
||||
func (image *Image) ListChildren() (pools []string, images []string, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, nil, err
|
||||
@ -162,7 +164,8 @@ func (image *Image) ListChildren() (pools []string, images []string, err error)
|
||||
// is the source of readable data.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_set_by_id(rbd_image_t image, uint64_t snap_id);
|
||||
//
|
||||
// int rbd_snap_set_by_id(rbd_image_t image, uint64_t snap_id);
|
||||
func (image *Image) SetSnapByID(snapID uint64) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
|
6
vendor/github.com/ceph/go-ceph/rbd/snapshot_octopus.go
generated
vendored
6
vendor/github.com/ceph/go-ceph/rbd/snapshot_octopus.go
generated
vendored
@ -17,7 +17,8 @@ import (
|
||||
// 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)
|
||||
//
|
||||
// int rbd_snap_get_id(rbd_image_t image, const char *snapname, uint64_t *snap_id)
|
||||
func (image *Image) GetSnapID(snapName string) (uint64, error) {
|
||||
var snapID C.uint64_t
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -37,7 +38,8 @@ func (image *Image) GetSnapID(snapName string) (uint64, 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)
|
||||
//
|
||||
// int rbd_snap_get_name(rbd_image_t image, uint64_t snap_id, char *snapname, size_t *name_len)
|
||||
func (image *Image) GetSnapByID(snapID uint64) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return "", err
|
||||
|
3
vendor/github.com/ceph/go-ceph/rbd/snapshot_rename.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/rbd/snapshot_rename.go
generated
vendored
@ -12,7 +12,8 @@ import (
|
||||
// Rename a snapshot.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_rename(rbd_image_t image, const char *snapname,
|
||||
//
|
||||
// int rbd_snap_rename(rbd_image_t image, const char *snapname,
|
||||
// const char* dstsnapsname);
|
||||
func (snapshot *Snapshot) Rename(destName string) error {
|
||||
if err := snapshot.validate(imageNeedsIOContext | imageIsOpen | imageNeedsName | snapshotNeedsName); err != nil {
|
||||
|
88
vendor/github.com/ceph/go-ceph/rbd/sparsify.go
generated
vendored
Normal file
88
vendor/github.com/ceph/go-ceph/rbd/sparsify.go
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lrbd
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <rbd/librbd.h>
|
||||
|
||||
extern int sparsifyCallback(uint64_t, uint64_t, uintptr_t);
|
||||
|
||||
// inline wrapper to cast uintptr_t to void*
|
||||
static inline int wrap_rbd_sparsify_with_progress(
|
||||
rbd_image_t image, size_t sparse_size, uintptr_t arg) {
|
||||
return rbd_sparsify_with_progress(
|
||||
image, sparse_size, (librbd_progress_fn_t)sparsifyCallback, (void*)arg);
|
||||
};
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"github.com/ceph/go-ceph/internal/callbacks"
|
||||
)
|
||||
|
||||
// SparsifyCallback defines the function signature needed for the
|
||||
// SparsifyWithProgress callback.
|
||||
//
|
||||
// This callback will be called by SparsifyWithProgress when it wishes to
|
||||
// report progress on sparse. The callback function will be called with the
|
||||
// first argument containing the current offset within the image being made
|
||||
// sparse and the second argument containing the total size of the image. The
|
||||
// third argument is an opaque value that is passed to the SparsifyWithProgress
|
||||
// function's data argument and every call to the callback will receive the
|
||||
// same object. The sparsify operation will be aborted if the progress
|
||||
// callback returns a non-zero value.
|
||||
type SparsifyCallback func(uint64, uint64, interface{}) int
|
||||
|
||||
var sparsifyCallbacks = callbacks.New()
|
||||
|
||||
type sparsifyCallbackCtx struct {
|
||||
callback SparsifyCallback
|
||||
data interface{}
|
||||
}
|
||||
|
||||
// SparsifyWithProgress 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.
|
||||
// The given progress callback will be called to report on the progress
|
||||
// of sparse. The operation will be aborted if the progress callback returns
|
||||
// a non-zero value.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_sparsify_with_progress(rbd_image_t image, size_t sparse_size,
|
||||
// librbd_progress_fn_t cb, void *cbdata);
|
||||
func (image *Image) SparsifyWithProgress(
|
||||
sparseSize uint, cb SparsifyCallback, data interface{}) error {
|
||||
// the provided callback must be a real function
|
||||
if cb == nil {
|
||||
return rbdError(C.EINVAL)
|
||||
}
|
||||
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx := sparsifyCallbackCtx{
|
||||
callback: cb,
|
||||
data: data,
|
||||
}
|
||||
cbIndex := sparsifyCallbacks.Add(ctx)
|
||||
defer diffIterateCallbacks.Remove(cbIndex)
|
||||
|
||||
ret := C.wrap_rbd_sparsify_with_progress(image.image, C.size_t(sparseSize), C.uintptr_t(cbIndex))
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
//export sparsifyCallback
|
||||
func sparsifyCallback(
|
||||
offset, total C.uint64_t, index uintptr) C.int {
|
||||
|
||||
v := sparsifyCallbacks.Lookup(index)
|
||||
ctx := v.(sparsifyCallbackCtx)
|
||||
return C.int(ctx.callback(uint64(offset), uint64(total), ctx.data))
|
||||
}
|
16
vendor/github.com/ceph/go-ceph/rbd/watchers.go
generated
vendored
16
vendor/github.com/ceph/go-ceph/rbd/watchers.go
generated
vendored
@ -31,11 +31,13 @@ type ImageWatcher struct {
|
||||
// and an error are returned.
|
||||
//
|
||||
// Note:
|
||||
// Only supported in Ceph Mimic and newer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// int rbd_watchers_list(rbd_image_t image,
|
||||
// rbd_image_watcher_t *watchers, size_t *max_watchers)
|
||||
func (image *Image) ListWatchers() ([]ImageWatcher, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -91,8 +93,9 @@ type Watch struct {
|
||||
// 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);
|
||||
//
|
||||
// int rbd_update_watch(rbd_image_t image, uint64_t *handle,
|
||||
// rbd_update_callback_t watch_cb, void *arg);
|
||||
func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return nil, err
|
||||
@ -120,7 +123,8 @@ func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, err
|
||||
// Unwatch un-registers the image watch.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_update_unwatch(rbd_image_t image, uint64_t handle);
|
||||
//
|
||||
// int rbd_update_unwatch(rbd_image_t image, uint64_t handle);
|
||||
func (w *Watch) Unwatch() error {
|
||||
if w.image == nil {
|
||||
return ErrImageNotOpen
|
||||
|
Reference in New Issue
Block a user