Commit Graph

14 Commits

Author SHA1 Message Date
Niels de Vos 3dbd875587 rbd: replace rbdError by cephError
Signed-off-by: Niels de Vos <ndevos@ibm.com>
2024-10-14 17:49:08 +00:00
Niels de Vos 5a7f9c9050 rbd: add ErrExist as standard error
Certain operations with RBD can return the C errno EEXIST. Applications
using go-ceph benefit from easily detecting this error.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
2024-09-25 11:52:59 +00:00
Niels de Vos a9ce294dbb rbd: let CloneImageByID check for rbd_clone4 at runtime
Some versions of librbd provide the rbd_clone4 function, and others do
not. Squid will have the function backported in the 1st update, the
initial release of Squid does not have it. This makes checking for the
function based on the named Ceph version impractical.

With the new dlsym.LookupSymbol() function, it is now possible to check
the availability of rbd_clone4 during runtime. If the symbol is not
found ErrNotImplemented is returned, which can be used to detect the
unavailability of the function.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
2024-07-25 12:03:15 +00:00
John Mulligan 5c537e20ad rbd: add GetGlobalMirrorStatus implementing rbd_mirror_image_get_global_status
This function is added, along with required return types and some helper
functions, to support fetching the global mirroring status component
that makes up a major part of `rbd mirror image status` command's
output.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-04-13 09:47:43 +00:00
John Mulligan 849fc3c1f3 rbd: use FormatErrorCode for formatting rbd errors
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan ab49935b5b rbd: rename error type's Errno method to ErrorCode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -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
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 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
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 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 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