Commit Graph

254 Commits

Author SHA1 Message Date
Daniel M. Lambea f06baa43e5 rados: add support for retrieving the alignment (stripe size) for EC pools
Add support for getting the alignment (stripe size) in bytes for pools that require/support it.
Fixes #739

This commit adds two new API calls to IOContext, one to know if the pool requires alignment and
the second one to get the stripe size in bytes:

 RequiresAlignment() (bool, error)
 Alignment() (uint64, error)

Signed-off-by: Daniel M. Lambea <dmlambea@tenerife.es>
2022-07-26 05:57:29 +00:00
Sven Anderson fdd9853f0f go-ceph: add warn logs to finalizers.
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-07-19 14:37:32 +00:00
Quentin Devos 5f38b5422e rados: Implement rados_set_alloc_hint2
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2022-07-06 17:56:39 +00:00
Joshua Baergen 9e340d1e4e rados: Make sure Conn isn't GC'd while it has dependant IOContexts.
Because we have a finalizer configured for Conn that cleans up Ceph
resources, it's important that we don't let it get GC'd before anything
that depends on it has been cleaned up. Since clients are free to hold a
reference to an IOContext without maintaining a reference to the
underlying Conn, we hold such a Conn reference within the IOContext to
signal this dependency to the Go GC.

Signed-off-by: Joshua Baergen <jbaergen@digitalocean.com>
2022-07-01 15:30:18 +00:00
John Mulligan 863d71caa5 rados: various readop & writeop apis are now stable
These apis are now stable as per the stability plan.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-06-14 16:01:43 +00:00
John Mulligan ec0b9a1455 rados: watcher apis are now stable
Watcher apis are now stable as per the stability plan.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-06-14 16:01:43 +00:00
Sven Anderson f4fb583252 docs: remove all PREVIEW comments
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-06-06 14:42:04 +00:00
Nick Janus e1f75a459d rados: adds null oid coverage to omap related tests
Previous changes added support for operating on omap keys that include
null characters (e.g. rados_omap_get_next2,
rados_write_op_omap_rm_keys2).  This change adds some basic test
coverage those operations' null character support.

Signed-off-by: Nick Janus <github@nondesignated.com>
2022-04-21 19:27:09 +00:00
Nick Janus 52182d0103 rados: adds support for listing oids with null chars
The previous `rados_nobjects_list_open` used for listing could not
return oids that included null characters. Although this isn't a common
case, having go-ceph able to list such objects is useful for bugs such
as https://tracker.ceph.com/issues/48874.

Signed-off-by: Nick Janus <github@nondesignated.com>
2022-04-21 19:27:09 +00:00
Robert Vasek 3eba56ce60 rados: use rados_write_op_omap_rm_keys2()
WriteOp.RmOmapKeys now uses rados_write_op_omap_rm_keys2().

The entirety of removeOmapKeysStep struct was removed as it's not necessary for
it to own the various C-allocated values passed to
rados_write_op_omap_rm_keys2() as arguments. rados_write_op_omap_rm_keys2()
makes copies of all the string-based args [1], so it's sufficient for them to
be short lived.

[1] 2bd3dd512a/src/librados/librados_c.cc (L3888-L3902)
2022-03-09 14:02:56 +00:00
Robert Vasek 044c3733e9 rados: use rados_write_op_omap_set2()
WriteOp.SetOmap now uses rados_write_op_omap_set2().

The entirety of setOmapStep struct was removed as it's not necessary for it to
own the various C-allocated values passed to rados_write_op_omap_set2()
as arguments. rados_write_op_omap_set2() makes copies of all the string-based
args [1], so it's sufficient for them to be short lived.

[1] 2bd3dd512a/src/librados/librados_c.cc (L3852-L3871)
2022-03-09 14:02:56 +00:00
Robert Vasek 3f9bcf03cc rados: simplified GetOmapStep and ReadOp.GetOmapValues
C strings that are passed in to rados_read_op_omap_get_vals2() are copied by
the function, see [1][2] for its implementation. It's therefore not necessary for
them to be owned by GetOmapStep. It's enough to construct and destruct them
in ReadOp.GetOmapValues.

[1] 2bd3dd512a/src/librados/librados_c.cc (L4334-L4358)
[2] 2bd3dd512a/src/include/rados/librados.hpp (L572-L587)
2022-03-09 14:02:56 +00:00
Robert Vasek 8371a1377d rados: use rados_read_op_omap_get_vals_by_keys2()
ReadOp.GetOmapValuesByKeys() now uses rados_read_op_omap_get_vals_by_keys2().
2022-03-09 14:02:56 +00:00
Robert Vasek ecdb224b75 rados: use rados_omap_get_next2()
GetOmapSte.Next() and ReadOpOmapGetValsByKeysStep.Next() now use
rados_omap_get_next2().
2022-03-09 14:02:56 +00:00
mergify-bot a88702fb93 rados: add wrapper to set locator key on IOContext (#651)
add wrapper to set locator key on IOContext

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>

* mark API as PREVIEW and update docs

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>

* move new API call into own file to add preview build tag

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>

* reset locater with nil instead of a empty string

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>

* rename variables for naming consistency

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>

* update release versions for new API call

Signed-off-by: Alexander Pücker <alexander.puecker@hetzner.com>
2022-03-05 15:43:02 +00:00
Sven Anderson d43f087ec4 rados: add warning logs to watcher callbacks
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-03-03 15:06:20 +00:00
Sven Anderson 7ac455058f rados: declare WriteOp.CmpExt as stable
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-14 16:50:27 +00:00
Sven Anderson 21f192a484 rados: implement watch/notify APIs
This change implements the bindings for the watch/notify APIs of
librados. Instead of callbacks, the watcher is implemented with more
Go-idiomatic channels. A watcher object exposes two read-only
channels, one to receive the notify events and one to receive
occuring errors.

Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-10 07:38:07 +00:00
Robert Vasek 573598cf22 rados: implement binding for read_op_omap_get_vals_by_keys
This commit implements binding for read_op_omap_get_vals_by_keys
RADOS Read operation.

Includes a unit test.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2022-02-09 15:25:37 +00:00
Robert Vasek 4cf39ce07b rados: implement binding for rados_write_op_setxattr
This commit implements binding for rados_write_op_setxattr
RADOS Write operation.

Includes a unit test.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2022-02-08 19:35:32 +00:00
Sven Anderson 520018f6ef rados: fix revive error
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-08 15:17:34 +00:00
Robert Vasek 4c8fb2d210 rados: implement binding for rados_{read,write}_op_assert_version
This commit implements binding for rados_read_op_assert_version
RADOS Read operation as well as rados_write_op_assert_version
RADOS Write operation.

Includes unit tests for both.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2022-02-08 14:29:21 +00:00
Robert Vasek 17fbb4b3a0 rados: implement binding for rados_write_op_remove
This commit implements binding for rados_write_op_remove RADOS Write operation.
Includes a unit test.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2022-02-07 23:08:33 +00:00
Robert Vasek 937f8d8164 rados: implement binding for rados_read_op_read
This commit implements binding for rados_read_op_read RADOS Read operation.
Includes a unit test.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2022-01-13 09:37:59 -05:00
Robert Vasek 0443277bb9 rados: implement binding for rados_write_op_cmpext
This commit implements binding for rados_write_op_cmpext RADOS Write operation.
Includes a unit test.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
2021-12-08 19:07:12 +00:00
Sven Anderson b5c4989a88 rados: add comment about missing pinning in writeStep
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-11-15 21:47:09 +00:00
Sven Anderson 3a7f2e2896 rados: C-allocate return parameters in GetOmapStep
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-11-15 21:47:09 +00:00
John Mulligan 5985d410ce rados: merge test case into standard tests file, removing luminous tag
We no longer support ceph luminous, and have not for a while. This
test case was kept separately from the others because it didn't function
correctly when tested against luminous clusters. As part of the effort
to remove the unsupported build tags, there's no longer even a reason
to keep this as it's own file with the tags removed, so merge it
together.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-11-09 01:24:01 +00:00
Sven Anderson 87f4563118 format: run gofmt on all files
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-10-04 18:58:35 +00:00
Sven Anderson af5a9e9906 rados: remove unused constant
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson 605e31fef8 rados: remove gosimple linter warnings
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson 54fe45484a rados: remove errcheck linter warnings
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson b7f01be284 rados: remove ineffassign linter warnings
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson ff75b9c2a2 rados: add missing error asserts
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-14 14:14:23 +00:00
John Mulligan c658cc93a9 rados: import testify suite as tsuite
This avoids import shadowing elsewhere in rados_test.go.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 91efd1f092 rados: naming conventions: disable revive naming check on old struct
This struct has public fields that violate standard naming
conventions.
Disable the check on this struct only.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 25c0699926 rados: naming conventions: disable revive naming check on old struct
This struct has public fields that violate standard naming conventions.
Disable the check on this struct only.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 572de578f6 rados: naming conventions: rename ensure_connected to ensureConnected
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 615b122e49 rados: naming conventions: fixes in test func TestListAcrossNamespaces
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 5506545be0 rados: naming conventions: fixes in test function TestSetNamespace
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 35bcee9804 rados: naming conventions: fixes in test funcs TestObjectIterator*
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan ef031dddcf rados: naming conventions: fixes in test function TestGetPoolStats
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan a15c91d711 rados: naming conventions: fixes in test function TestCreate
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan b045c8b239 rados: naming conventions: fixes in test funcs TestGetPoolBy{Name,ID}
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 810022af7b rados: naming conventions: fixes in test function TestMakeDeletePool
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan e3196e45e0 rados: naming conventions: fixes in test function TestGetClusterStats
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 9d7d31d158 rados: naming conventions: fixes in test functions for config
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan fcdd6fd657 rados: naming conventions: fixes in TestMonCommandWithInputBuffer
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 402707f2f5 rados: naming conventions: fixes in WriteFull function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-07-26 14:07:47 -04:00
John Mulligan b7b21273e3 rados: naming conventions: fixes in Write function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-07-26 14:07:47 -04:00