Commit Graph

24 Commits

Author SHA1 Message Date
Niels de Vos 65d1e9c763 rbd: include rbd_test.go in rbd package
Keeping the _test.go code in the same package allows for the testing
of private functions. AFAWK it is more conventional as well.

See-also: ceph/go-ceph#135
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-12-16 10:12:51 -05:00
John Mulligan 7c1e4f2ca9 rbd: convert test to use errors with conventional names
We recently created errors in the rbd that match the golang convention
but left aliases for external code. Switch the test code to use the
newer more standard form instead of the "aliases."

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 11:32:21 +01:00
John Mulligan 36fc3510d8 rbd: use conventional naming style for errors
A recent PR added new error values that were similar to the existing
naming convention but were not the normal go convention. Change all the
errors to match typical convention but leave the older names as aliases
such that older code will continue to work (for now).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 11:32:21 +01:00
Niels de Vos a713db983a rbd: return more useful error messages
Translate the return value (errno) from the C rbd_*() functions into the
standardized strerror() error message.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-12-12 13:56:53 -05:00
Niels de Vos 2d52744470 rbd: improve error checking
Make it possible to easily validate the *Image and *Snapshot objects
before using them. This makes the use of go-ceph for RBD functions more
stable, and it is less likely that incorrect use causes Go panics.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-12-11 19:47:21 -05:00
Niels de Vos b86563db7e rbd: add Create4() for more advanced RBD Image creation
This allows to set additional options while creating RBD images.
Ceph-CSI will initially consume this to configure an optionally
different pool for data.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-12-11 13:43:58 -05:00
Niels de Vos 6a17d59988 rbd: split Create() off into Create2() ad Create3() following librbd.h
The C library offers rbd_create2() and rbd_create3() and does not try to
cover all options with rbd_create(). For users that are familiar with
the C API, the Create2() and Create3() functions have been added.

The existing Create() API still handles the complete set of
rbd_create*() functions, so backwards compatibility is covered.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-12-11 09:09:54 -05:00
John Mulligan fa319f99bb rbd: use uuid library, rather than shelling out, in rbd test
Previously, the tests were shelling out to run 'uuidgen' which
is not particularly efficient and a bit ugly. Switch this test
to use the same uuid library already in use by the rados test code.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-06 11:23:03 -05:00
Sven Anderson 472f6dd5bb Tests: avoid segmentation faults in tests
This change replaces a couple of functions from the "assert" package
with the corresponding functions from the "require", where the
following code relies on a non-nil object.

Signed-off-by: Sven Anderson <sven@redhat.com>
2019-12-06 11:12:34 -05:00
Noah Watkins 208695a8c1 fmt: apply gofmt updates
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-09-17 15:57:31 -07:00
Daniel Swarbrick bdc1c100fe
Force trash remove to override deferment time
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2018-09-17 23:33:23 +02:00
Daniel Swarbrick 837181cb94
Add unit test for rbd_trash functionality
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2018-09-17 23:07:18 +02:00
Vicente Cheng d6ed102905 rbd: add test cases about create image for rbd_create, rbd_create2, rbd_create3
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
2016-12-23 00:24:13 +08:00
Ryan Roemmich 777d9c72ab continue after -ERANGE in retval of rbd_list_children. fix out of range on zero children 2016-04-05 10:23:09 -06:00
Crazykev ee740834a2 add param 'order' to Create() and Image.Clone(), and upgrade ci ceph version to hammer
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
2016-03-03 21:59:09 -05:00
Noah Watkins 3f52ea219a repo: update new repo path
noahdesu -> ceph

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-08-31 07:34:42 -07:00
Ye Yin 193dbacdb0 Convert some C error code to Go code, for convenient Golang code to handle error.
Define some Rbd constant variables, to pass to librbd API.
Add test unit for RbdErrorNotFound

Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-23 15:33:34 +08:00
Ye Yin 80e3e9ea7f Add rbd_get_parent_info
Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-20 11:34:47 +08:00
Kai Storbeck 0c6bdf8d59 run gofmt on all sources 2015-02-11 22:21:05 +01:00
Sylvain Baubeau edd909006b rbd: add tests for read/write and snapshots 2015-01-15 15:19:20 +01:00
Sylvain Baubeau 5671536b12 rbd: clean images and pools in tests 2015-01-15 15:18:18 +01:00
Noah Watkins 6fb5e09394 rbd: fix test
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-14 17:36:56 -08:00
Noah Watkins f5bfcec122 fix go-rados -> go-ceph renames
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-14 17:30:46 -08:00
Noah Watkins 44c15bf439 rbd: add rbd package
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-12 22:15:32 -08:00