Commit Graph

178 Commits

Author SHA1 Message Date
Sven Anderson 085e2049b3 tests: add tests for the Errno() methods of numeric error types
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-07-24 23:14:20 +02:00
Mudit Agarwal 2bb1b9bffc rbd: add constants for pool stat options and wrapper for rbd_pool_stats_get()
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>
2020-07-24 10:35:57 -04:00
Mudit Agarwal fec47ac9a9 rbd: add wrapper for unexported pool stat functions.
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>
2020-07-24 10:35:57 -04:00
Mudit Agarwal 0cd2b21224 rbd: add wrapper for rbd_pool_init() function
Added PoolInit function implementing rbd_pool_init which sets the
application tag to rbd.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-07-24 10:35:57 -04:00
Mudit Agarwal 0ffebd1f25 rbd: moved ImageOptionCloneFormat to rbd/options_mimic.go
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>
2020-07-24 10:20:27 -04:00
Mudit Agarwal 982a3975a9 rbd: add wrapper for function rbd_snap_get_trash_namespace()
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>
2020-07-24 10:20:27 -04:00
Mudit Agarwal a5da5e308b rbd: add functions and constants related to snapshot namespace.
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>
2020-07-24 10:20:27 -04:00
John Mulligan bfe4adfd2d rbd: convert ListChildren for mimic to use cutil.SplitSparseBuffer
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-23 16:38:39 -04:00
John Mulligan 2a62588181 rbd: convert NamespaceList for nautilus to use cutil.SplitSparseBuffer
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-23 16:38:39 -04:00
John Mulligan 4d2d6493af rbd: convert GetImageNames for mimic to use cutil.SplitSparseBuffer
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-23 16:38:39 -04:00
John Mulligan 3d5741301d rbd: convert uses of split function to use cutil.SplitSparseBuffer
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-23 16:38:39 -04:00
John Mulligan 97732ac885 rbd: add a UpdateWatch test case with multiple watches and go channels
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-23 13:19:57 -04:00
John Mulligan f3f2180e66 rbd: add Watch type and watch callbacks support
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>
2020-07-23 13:19:57 -04:00
Sven Anderson 6c944e8b65 rbd: make RBDError type unexported
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>
2020-07-17 13:47:32 -04:00
Niels de Vos d4440eb8c2 rbd: add simple test for Image.GetModifyTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Niels de Vos 491f7827a8 rbd: add Image.GetModifyTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Niels de Vos 048ed11e63 rbd: add simple test for Image.GetAccessTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Niels de Vos 0d9f802732 rbd: add Image.GetAccessTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Niels de Vos 8ef910e0c5 rbd: add simple test for Image.GetCreateTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Niels de Vos 5b45db6803 rbd: add Image.GetCreateTimestamp()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-22 09:22:18 -04:00
Mudit Agarwal 3c416e264a rbd: minor fixes in error.go
1. Generalize the message for ErrNoIOContext
2. Fixed a typo

Signed-off-by: Mudit Agarwal muagarwa@redhat.com
2020-06-15 13:43:26 -04:00
Mudit Agarwal 5b6c599176 rbd: add wrapper for rbd_namespace_list() function.
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
2020-06-15 13:43:26 -04:00
Mudit Agarwal 08536b9d93 rbd: add wrappers for rbd_namespace_create(), rbd_namespace_exists() and rbd_namespace_remove().
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>
2020-06-15 13:43:26 -04:00
Mudit Agarwal 7be8bbfe81 rbd: additional error checking in GetPoolMetadata, SetPoolMetadata and RemovePoolMetadata
added a check to validate ioctx in all the three *PoolMetadata functions

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-06-15 13:20:37 -04:00
Niels de Vos ec822aa3a9 rbd: add error checking in CreateImage()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-11 10:42:57 -04:00
Niels de Vos 3fc893bc0f rbd: add error checking in RemoveImage()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-11 10:42:57 -04:00
Niels de Vos 9e7a1c444f rbd: add error checking in OpenImage*() functions
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-11 10:42:57 -04:00
Mudit Agarwal a2c1c2bb34 rbd: add wrapper for rbd_pool_metadata_remove()
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>
2020-06-10 11:58:51 -04:00
Mudit Agarwal d999f78e2e rbd: add tests for GetPoolMetadata() and SetPoolMetadata()
Added test cases for GetPoolMetadata() func and SetPoolMetadata() func.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-06-10 11:58:51 -04:00
Mudit Agarwal 7b56123e17 rbd: add wrapper for rbd_pool_metadata_set()
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>
2020-06-10 11:58:51 -04:00
Mudit Agarwal f88a17dc64 rbd: add wrapper for rbd_pool_metadata_get()
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>
2020-06-10 11:58:51 -04:00
Niels de Vos 6c5364f422 rbd: add RBD_IMAGE_OPTION_MIRROR_IMAGE_MODE for Octopus
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-09 08:54:33 -04:00
Niels de Vos 8235827b5a rbd: add RBD_IMAGE_OPTION_CLONE_FORMAT for Nautilus
Fixes: #295
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-09 08:54:33 -04:00
Niels de Vos ba93f46cb4 rbd: add RBD_IMAGE_OPTION_FLATTEN for Mimic
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-09 08:54:33 -04:00
Sven Anderson 217e502afa rbd: add better error when attempting to remove opened images
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-05-28 08:49:35 -04:00
root e89344cae1 fix typos 2020-05-01 09:37:09 -04:00
Sven Anderson 6072f41bd6 update more code to use the retry lib.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-04-20 15:08:36 -04:00
Sven Anderson e8da761769 update various parts of the code to use the retry lib.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-04-20 15:08:36 -04:00
John Mulligan 0faccb56e8 rbd: check that encode calls dont return error
Don't ignore the error returned by json encode func call.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 8ce5fa5fc7 rbd: remove a redundant else statement
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 054ae8ddff rbd: consolidate error types & values in an errors.go file
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-06 17:10:09 -04:00
John Mulligan eee19d642f rbd: rename uses of RbdImageOptions to ImageOptions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan a29025a893 rbd: drop the Rbd prefix from ImageOptions and ImageOption
Previously, the types were named RbdImageOptions and RbdImageOption.
Now they are named ImageOptions and ImageOption.
Type aliases have been added to prevent existing code from
breaking. As these types were new in v0.2, I suspect we can drop
the aliases post-v0.3.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan 51827ead4e rbd: convert uses of RbdImageOptionX to ImageOptionX
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan 6d77dc97dc rbd: remove Rbd prefix from constants and provide aliases
Image option constants are now named ImageOptionX, without an Rbd
prefix. Aliases to the old names are provided and doc comments for both.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan c2d0bc90ef rbd: add comments to features go file to pass check tool
Make the features.go file clean to the revive checker tool.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan 8f2671fee9 rbd: add doc comments for (Get|Set|Remove)Metadata funcs
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan 53fd07425a rbd: add doc comment for GetSnapshotNames function
This function also happens to be mis-named.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-20 09:43:15 -04:00
John Mulligan 644b7939d0 rbd: add doc comments for Flush function
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-20 09:43:15 -04:00
John Mulligan 51e9a080bb rbd: add doc comments for ReadAt and WriteAt
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-20 09:43:15 -04:00