-
Notifications
You must be signed in to change notification settings - Fork 257
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
rbd: implement librbd.rbd_group_snap_get_info #1025
Conversation
a40229f
to
dee055a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we could ignore the norm to have the corresponding tests for the newly introduced API in a separate source file, which I think may not hold good here due to its nature, changes look good to me.
@Mergifyio rebase |
dee055a
to
5d6c6f6
Compare
✅ Branch has been successfully rebased |
|
|
5d6c6f6
to
2052bb5
Compare
Pull request has been modified.
e604719
to
f7fa0ce
Compare
|
1 similar comment
|
@Mergifyio rebase |
The new GroupSnapGetInfo function can be used to get a list of the RBD image snapshots that were created as part of the RBD group snapshot. Signed-off-by: Niels de Vos <[email protected]>
Signed-off-by: Niels de Vos <[email protected]>
Signed-off-by: Niels de Vos <[email protected]>
✅ Branch has been successfully rebased |
f7fa0ce
to
4b0b8c8
Compare
|
|
All dependencies are merged, this should be ready for review (again) now. |
@Mergifyio refresh Maybe that is needed to detect the merging of the dependencies? |
✅ Pull request refreshed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
@Mergifyio rebase |
✅ Nothing to do for rebase action |
@ansiwen could you please have a look at this? |
@Mergifyio rebase |
✅ Nothing to do for rebase action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Types and constants are copied from librbd.h with added "_" as prefix. This | ||
// prevents redefinition of the types on librbd versions that have them | ||
// already. | ||
|
||
typedef enum { | ||
_RBD_GROUP_SNAP_NAMESPACE_TYPE_USER = 0 | ||
} _rbd_group_snap_namespace_type_t; | ||
|
||
typedef struct { | ||
char *image_name; | ||
int64_t pool_id; | ||
uint64_t snap_id; | ||
} _rbd_group_image_snap_info_t; | ||
|
||
typedef struct { | ||
char *id; | ||
char *name; | ||
char *image_snap_name; | ||
rbd_group_snap_state_t state; | ||
_rbd_group_snap_namespace_type_t namespace_type; | ||
size_t image_snaps_count; | ||
_rbd_group_image_snap_info_t *image_snaps; | ||
} _rbd_group_snap_info2_t; | ||
|
||
// rbd_group_snap_get_info_fn matches the rbd_group_snap_get_info function signature. | ||
typedef int(*rbd_group_snap_get_info_fn)(rados_ioctx_t group_p, | ||
const char *group_name, | ||
const char *snap_name, | ||
_rbd_group_snap_info2_t *snaps); | ||
|
||
// rbd_group_snap_get_info_dlsym take *fn as rbd_group_snap_get_info_fn and | ||
// calls the dynamically loaded rbd_group_snap_get_info function passed as 1st | ||
// argument. | ||
static inline int rbd_group_snap_get_info_dlsym(void *fn, | ||
rados_ioctx_t group_p, | ||
const char *group_name, | ||
const char *snap_name, | ||
_rbd_group_snap_info2_t *snaps) { | ||
// cast function pointer fn to rbd_group_snap_get_info and call the function | ||
return ((rbd_group_snap_get_info_fn) fn)(group_p, group_name, snap_name, snaps); | ||
} | ||
|
||
// rbd_group_snap_get_info_cleanup_fn matches the rbd_group_snap_get_info_cleanup function signature. | ||
typedef int(*rbd_group_snap_get_info_cleanup_fn)(_rbd_group_snap_info2_t *snaps); | ||
|
||
// rbd_group_snap_get_info_cleanup_dlsym take *fn as rbd_group_snap_get_info_cleanup_fn and | ||
// calls the dynamically loaded rbd_group_snap_get_info_cleanup function passed as 1st | ||
// argument. | ||
static inline int rbd_group_snap_get_info_cleanup_dlsym(void *fn, | ||
_rbd_group_snap_info2_t *snaps) { | ||
// cast function pointer fn to rbd_group_snap_get_info_cleanup and call the function | ||
return ((rbd_group_snap_get_info_cleanup_fn) fn)(snaps); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could avoid some of that boilerplate... But I don't have a suggestion right now, how to improve it. So I guess we just keep it like that for now, which probably means forever. 😅
@Mergifyio rebase |
✅ Nothing to do for rebase action |
@Mergifyio refresh |
✅ Pull request refreshed |
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 08e5b62 |
Ha..just because we had the following depends in the PR description and ceph did not have it configured, merging got stalled.
Now I can fool Mergify by adding the above lines back. |
|
1 similar comment
|
The new GroupSnapGetInfo function can be used to get a list of the RBD
image snapshots that were created as part of the RBD group snapshot.
This feature is implemented in 2 steps:
dlsym
I hope that makes it easier to understand, and might help others contributing such dynamically loaded functions too.
Depends-on: ceph/ceph#59883
Depends-on: ceph/ceph#59959
Checklist
//go:build ceph_preview
make api-update
to record new APIs