The sparsify function can be used to make an image sparse by replacing
runs of zeros with holes. This change adds a wrapper for the basic
rbd_sparsify function and accompanying tests.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Since the index of the registered callbacks is basically only used as
void*/unsafe.Pointer, it makes more sense and code simpler, if
the index type is uintptr instead of a simple int.
Signed-off-by: Sven Anderson <sven@redhat.com>
This patch changes the name to the as-agreed-upon naming from a call.
I forgot to fix this in the original patches before merging things.
Oops.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, the code that set up the callbacks was doing a pretty
direct translation of go-function to c-function. It turns out this
is not needed due to the way we set up the "dynamic" go callbacks
via an integer based callback "registry". Instead, we can stay within
the C layer entirely for the C callback, passing it only the index
value and then return to the go layer through a static C function
that only needs the index value.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Corresponding fields for Parent_pool and Parent_name have been deprecated from
ceph's rbd_image_info_t stuct, removing the same from go-ceph's ImageInfo struct.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Added pool stat options constants.
Also implemented GetAllPoolStats() function to introduce
the functionality of rbd_pool_stats_option_add_uint64() and rbd_pool_stats_get()
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Added wrappers for rbd_pool_stats_create() and rbd_pool_stats_destroy() functions.
Right now, keeping these unexported.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
RBD_IMAGE_OPTION_CLONE_FORMAT was added in Ceph Mimic but fix for issue #295 added
it only for Ceph Nautilus, moving it to rbd/options_mimic.go
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Added a wrapper for function rbd_snap_get_trash_namespace() which
returns the original name of the snapshot which was moved to Trash.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Added few constants used for determining snapshot namespace.
Added wrapper for function rbd_snap_get_namespace_type() which returns namespace type for a given snapshot.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Add UpdateWatch function implementing rbd_update_watch.
Add Unwatch function implementing rbd_update_unwatch.
Add a higher level Watch type to encapsulate watching
the image and the watch handle.
Add basic tests to validate the callback behavior.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
In order to avoid external dependencies on implementation details,
this change replaces RBDError with the unexported rbdError. In case
some application really needs access to the integer value, it can use
the pattern
var errno interface{ Errno() int }
if errors.As(err, errno) { ... errno.Errno() ... }
Signed-off-by: Sven Anderson <sven@redhat.com>
Added wrapper for rbd_namespace_list() function which returns the names of all the namespaces
present for a given IOContext.
Signed-off-by: Mudit Agarwal muagarwa@redhat.com
rbd_namespace_create() function creates namespace for a given iocontext.
rbd_namespace_exists() function checks whether the given namespace exists or not.
rbd_namespace_remove() function removes the given namespace.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Add wrapper for rbd_pool_metadata_remove() function which removes pool
metadata associated with a given key.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Add wrapper for rbd_pool_metadata_set() function which sets pool metadata
associated with the given key.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Add wrapper for rbd_pool_metadata_get() function which returns pool metadata
associated with the given key.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>