Commit Graph

41 Commits

Author SHA1 Message Date
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 c06593eef7 rbd: add support for RbdImageOptions
There are several RbdImageOptions that can be used to configure features
of an RBD image while creating, cloning, migrating and copying. A
follow-up patch will add Create4() where the RbdImageOptions can be
used.

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
zhangyue de3bd20fe3 bugfix: use GetError instead of RDBError to return
Signed-off-by: zhangyue <zy675793960@yeah.net>
2019-12-11 08:44:00 -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
Daniel Swarbrick 951118e855
Drop unnecessary typecasts
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2018-09-18 11:12:32 +02:00
Daniel Swarbrick 3023eb281d
Go style cleanups
- Use C errno constants in place of hardcoded ints
- Use type inference where possible (especially C.CString
- Don't explicitly specify zero values where value would be default anway
- Rewrap some unnecessarily wrapped short lines
- Use if/else one-liners where value is not needed afterwards

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2018-09-18 11:03:41 +02: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
Daniel Swarbrick 4a88b5da12
Implement wrappers around rbd_trash_* functions
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2018-09-17 20:46:23 +02:00
Daniel Swarbrick 9d12f2ecd1
Merge branch 'master' into feature-consts 2018-09-14 23:53:47 +02:00
Daniel Swarbrick 1623e77d20
Wrap feature macros from rbd/features.h 2018-09-14 23:52:24 +02:00
Daniel Swarbrick 3a8c38ca41 Add RBD feature flag sets as per Python rbd module 2018-09-14 16:59:08 +02:00
Daniel Swarbrick 340e124452 Convert RBD feature flags to constants with iota 2018-09-14 16:38:01 +02:00
Daniel Swarbrick df4109f4b7 Check that parent image has been opened before attempting snapshot operations 2018-09-14 16:02:11 +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
Vicente Cheng 19439f3958 rbd: the length of args on create_v3 should be 3 instead of 2
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
2016-12-20 19:24:31 +08:00
Noah Watkins 1cbeb759e2 Merge pull request #22 from david-z/wip-fix-list-lockers-crash
Fix rbd list lockers crashing
2016-05-20 07:34:18 -07:00
Noah Watkins 62e94854a4 Merge pull request #19 from abligh/fix-read-at-write-at-race
Replace ReadAt and WriteAt with thread-safe versions
2016-05-20 07:34:10 -07:00
Zhi Zhang b68bd88243 Fix rbd list lockers crashing
Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
2016-05-20 17:26:29 +08:00
Alex Bligh 38c3c12b50 Replace ReadAt and WriteAt with thread-safe versions
ReadAt and WriteAt should not rely on image.offset as this
prevents the from working in a thread-safe manner.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
2016-04-29 14:36:01 +01: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 5c2d42ef5a Change return new error for rados and rbd
Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-24 11:34:18 +08: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
Noah Watkins 0d62c1455a rbd: remove buggy aio interface
The AIO interface is not thread safe. There is an example of how to use
non-Go threads to make callback into Go found in the zookeepr api go
bindings.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-02-09 10:54:19 -08: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
Sylvain Baubeau 75e9c455a6 rbd: fix error handling for write, seek and flush 2015-01-15 15:15:31 +01:00
Sylvain Baubeau 921a14b17f rbd: fix calls to wrong C functions 2015-01-15 15:13:53 +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 9a1b29d02e Merge remote-tracking branch 'lb/newrbd'
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-14 17:32:51 -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
Sylvain Baubeau e00f9bf1a8 lib: add full support for RADOS block devices 2015-01-15 00:44:26 +01:00
Noah Watkins d58cbadae5 doc: update doc layouts
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-01-13 07:27:06 -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