Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrappers for rbd trash functionality #62

Closed
dswarbrick opened this issue Sep 11, 2018 · 5 comments
Closed

Add wrappers for rbd trash functionality #62

dswarbrick opened this issue Sep 11, 2018 · 5 comments

Comments

@dswarbrick
Copy link
Contributor

dswarbrick commented Sep 11, 2018

The trash subcommand of the rbd command caught my attention recently, and it would be very useful to have wrappers for these functions in go-ceph. Although the functionality is available in Luminous (and maybe earlier?), it is only documented in the rbd manpage in current master branch.

The relevant functions that would need wrappers are defined in librbd.h:

CEPH_RBD_API int rbd_trash_move(rados_ioctx_t io, const char *name,
                                uint64_t delay);
CEPH_RBD_API int rbd_trash_get(rados_ioctx_t io, const char *id,
                               rbd_trash_image_info_t *info);
CEPH_RBD_API void rbd_trash_get_cleanup(rbd_trash_image_info_t *info);
CEPH_RBD_API int rbd_trash_list(rados_ioctx_t io,
                                rbd_trash_image_info_t *trash_entries,
                                size_t *num_entries);
CEPH_RBD_API void rbd_trash_list_cleanup(rbd_trash_image_info_t *trash_entries,
                                         size_t num_entries);
CEPH_RBD_API int rbd_trash_remove(rados_ioctx_t io, const char *id, bool force);
CEPH_RBD_API int rbd_trash_remove_with_progress(rados_ioctx_t io, const char *id,
                                                bool force, librbd_progress_fn_t cb,
                                                void *cbdata);
CEPH_RBD_API int rbd_trash_restore(rados_ioctx_t io, const char *id,
const char *name);

I can probably have a go at this myself, but I'm just not sure what the current status is as far as go-ceph supporting backwards compatibility. Obviously it will fail to build against Jewel, Kraken etc if we just blindly add these functions.

@dotnwat
Copy link
Contributor

dotnwat commented Sep 11, 2018

The current plan is to keep go-ceph master branch up-to-date with ceph master, and then fork out branches for versions that have backwards compat issues. I believe the current go-ceph master branch has some deprecations, but we haven't yet cut any branch according to this plan.

So if you'd like to build these wrappers you can submit a PR against the master branch and we'll figure out how to build these other branches in the future.

If you happen to have any opinions about how to handle the compat issues, we are also interested in hearing those. But so far these simple plan has been the consensus.

@dswarbrick
Copy link
Contributor Author

@noahdesu After merging #66, would you mind please running go fmt ./... on the tree? The go-ceph source is in general not formatted as per gofmt, and I didn't want to do that myself in this PR as it would obscure what was actually new code, and what was just reformatting. Maybe you can include a gofmt into the CI pipeline, so as to fail tests if source is not formatted.

@dotnwat
Copy link
Contributor

dotnwat commented Sep 17, 2018

@dswarbrick do you know what the command is to validate with go fmt? I think it go right here https://github.com/ceph/go-ceph/blob/master/entrypoint.sh#L12

@dswarbrick
Copy link
Contributor Author

dswarbrick commented Sep 17, 2018

@noahdesu You can use something like gofmt -d -s . which will write a diff to stdout, instead of modifying the files in-place. If the code is already well formatted, this should be an empty string.

Added to travis.yml, it should appear in the script section something like:

script:
  - diff -u <(echo -n) <(gofmt -d -s .)

@dotnwat
Copy link
Contributor

dotnwat commented Sep 17, 2018

Thanks, that's in the CI now along with fmt fixes.

@dotnwat dotnwat closed this as completed Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants