Commit Graph

64 Commits

Author SHA1 Message Date
Mudit Agarwal 76e4089806 rados: move GetNamespace() to rados/ioctx.go
Now, we don't support ceph versions < nautilus this function
can move to a generic file so that nautilus specific functions
can be written here. Moved GetNamespace() and the corresponding
test function.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2021-06-02 06:16:01 +00:00
John Mulligan edcee808b1 rados: add GetLastVersion implementing rados_get_last_version
The GetLastVersion returns a number representing the most recent
read/write version for the io context.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-31 09:17:38 -04:00
Mudit Agarwal 837777d3fc rados: add wrapper for the function rados_ioctx_get_id()
Implements GetPoolID() and test case around the same.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-07-24 10:48:18 -04:00
John Mulligan a50c60be49 rados: add a more direct argv config wrapper ParseConfigArgv
Previously, ParseCmdLineArgs was the function directly wrapping the
ceph rados_conf_parse_argv function. This function has the improper
(IMO) behavior of assuming you didn't know your own argv[0] and just
always stuck "placeholder" in argv[0]. This function adds a more
direct wrapper ParseConfigArgv that allows the caller to pass an
full argv, and they can put any placholder value desired if they want.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-24 09:54:04 -04:00
John Mulligan 79dfe8e631 rados: move *Command functions into a separate file
Organize the rados package a bit more by moving functions that wrap
rados_xyz_command functions into a dedicated file. Move related test to
a separate file as well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-27 14:38:16 -04:00
John Mulligan 20311caff5 rados: check errors in test when deleting pools
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan a1de43cd5d rados: improve clean up of temporary file used in test
Clean up the temporary file using a defer and make sure that the
errors returned by the functions in the defer func are checked.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan c4f8f0445a rados: check errors returned by Write calls
Don't ignore errors returned by ioctx Write function calls.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 38adf053dd rados: check errors returned when reading config
Don't ignore the error return from ReadDefaultConfigFile.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 1f4543e835 rados: 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 1bd65c6f20 rados: fix test for mon command with input buffer on ceph octopus
It appears that ceph octopus (currently testing as master) is stricter
about some inputs and the old formatting in the test was failing.
Use formatting that all versions should be happy with.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-12 13:33:16 +01:00
Niels de Vos 5adb04909d rados: standardize error naming
RadosError-prefixes are not recommended, instead just Err as prefix is
used.

Also, errors are constants, not variables.

For existing users, backwards compatible constants are available. These
will need to be removed in a future go-ceph release.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-01-29 16:51:49 +01:00
Niels de Vos c6b65af9ec rados: add Create() function to create new objects
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-01-29 16:51:49 +01:00
John Mulligan de60dcb33b rados: add a test case for the >4086 buffer code path in ListPools
The code path where the pools result buffer was increased in size
then re-fetched was not being tested. Test it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan 15dfd6fc09 rados: reduce boilerplate in TestGetPoolByName using testify
Testfiy's assert and require libs have helpful functions for
checking values. Use them to reduce a bunch of boilerplate code in the
TestGetPoolByName function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan b5a0045d70 rados: add test coverage for failure to get config option
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan b8f04da105 rados: add test coverage for failure to open io context
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan dd1e25e5a4 rados: test error condition in PingMonitor
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan df46476e21 rados: make get rados error a private function
There is no good reason why the internal error handling support should
be exposed outside the rados package. Make the function lower-cased and
thus private.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-22 10:35:02 +01:00
John Mulligan d51628ca59 rados: update test setup code to avoid blocking forever
When working on the previous rbd change it was determined that the
connection setup code would block forever if the ceph config was missing
or bad when running the tests. Adjust the connection setup in the rados
pkg such that the tests will not block forever.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-20 16:52:45 +01:00
John Mulligan d4b6798928 rados: add test function for error type and functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 8a2d18be87 rados: include rados_test.go in rados package
Keeping the _test.go code in the same package allows for the testing
of private functions. AFAIK it is more conventional as well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 09:49:47 +01:00
Yue Zhu 750fe1830e rados: add support for sending PG commands 2019-12-13 16:30:00 +01:00
Niels de Vos 43a863d1cb Add GetPoolByID() for calling rados_pool_reverse_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
Niels de Vos bcf44fc782 Add GetPoolByName() for calling rados_pool_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
Noah Watkins fe9a93bb73 rados: migrate remaining tests to suite interface
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-09-14 14:35:45 -07:00
Noah Watkins a1c3394414 test: convert more tests to use suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-22 10:58:45 -07:00
Noah Watkins fad63ff1f9 test: convert more tests to use suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-17 11:51:36 -07:00
Noah Watkins 7b5a27ca9a rados: refactor tests to use testing suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-09 07:34:43 -07:00
Noah Watkins 6363bf77ae rados: use test suite to share code
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-07 18:48:17 -07:00
Michael Andersen 59cdfdc5a4 rados: improve support for namespaces 2018-02-03 10:59:54 -08:00
Damien Tournoud 03facd6d90 Fix bogus duration handling in IOContext.Lock*
Signed-off-by: Damien Tournoud <damien@platform.sh>
2017-07-28 16:32:25 +02:00
Michael Andersen f40720f238 Add test for ENOENT for omap 2017-01-12 17:49:01 -08:00
Emmet Cassidy 628bae93d1 rados: add support for object locking + test 2016-08-03 15:50:34 -07:00
Jared Watts c08104a20f Add support for mon_command input buffer 2016-07-21 13:07:30 -07:00
Noah Watkins 8c0703f5e2 Merge remote-tracking branch 'origin/pr/15' 2016-03-26 11:52:02 -07:00
Noah Watkins b6a7e80009 Merge remote-tracking branch 'origin/pr/14' 2016-03-26 11:49:28 -07:00
Livio Soares 57195e64fe rados_test.go: Improve Stat() test for non existant object name.
The test currently fails since 'RadosErrorNotFound' is not properly returned.
2016-03-25 00:58:11 -04:00
Livio Soares d5b49dd4ea rados_test.go: Fix import header to allow `gofmt` to work. 2016-03-25 00:57:23 -04:00
Livio Soares 46f5d61aba Namespace support for Pools.
This commit simply adds a SetNamespace() method to IOContext, allowing users to
perform pool operations in the context of a specific namespace.
2016-03-25 00:42:49 -04:00
Livio Soares 373a3043d7 rados: Implement Iter() interface to allow incremental listing of Pools.
The current IOContext struct has a ListObjects() method that works well for
pools with a reasonable number of objects. However, for very large pools, having
finer control over the iteration may be desirable.

This commit adds a new Iter() interface for pools. It allows callers to stop
iterating at any time by issuing a iter.Close(). It also allows callers to
"Seek" into the pool list using a token object.
2016-03-24 23:18:07 -04:00
Emmet Cassidy f251b539c3 added append function and a test 2015-10-28 09:25:11 -07: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 f39179553f Add rados_write_full function
Signed-off-by: Ye Yin <eyniy@qq.com>
2015-07-20 20:37:32 +08:00
Abhishek Lekshmanan d63c6698c2 gofmt all the source files
Running gofmt ./... on the repository

Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@gmail.com>
2015-07-08 14:04:54 +05:30
Travis Nielsen 8e73ca4191 Pass the correct admin user name 2015-06-16 16:10:09 -07:00
Travis Nielsen c7214b5694 Add a test for connecting with the cluster name and user name 2015-06-16 15:55:12 -07:00
Vincent Giersch b15639c44c ioctx: ListOmapValues & GetAllOmapValues added
* `ListOmapValues` allows to iterate on all the key feteched during
a read operation of an omap (the goal is to easily get the last
read key from the C iterator. This one can then be used in another
call as `startAfter` parameter).
* `GetAllOmapValues` returns all the keys / values of the whole omap
* `GetOmapValues` now uses `ListOmapValues`

Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
2015-05-04 14:50:59 +00:00
Noah Watkins c7a0450712 Merge pull request #15 from gierschv/feat-stat
ioctx: Stat added
2015-04-27 11:32:58 -07:00