Commit Graph

788 Commits

Author SHA1 Message Date
John Mulligan f88a2b13f9 cephfs: remove useMount test helper function
Now that there are no tests using the fuse mount point and the useMount
function that detects an external mount point is needed, we can remove
the useMount function itself and the env var used to control it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-21 06:19:40 +00:00
John Mulligan 57a37c6c74 cephfs: remove uses of external mount of test fs
The external mount point was mainly used for stat prior to a Stat
function being part of go-ceph's cephfs package. Now that we have
Statx, we can replace the need for the external mount and os.Stat.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-21 06:19:40 +00:00
John Mulligan f0142920b5 cephfs: remove uses of external mount of test fs
The external mount point was mainly used for stat prior to a Stat
function being part of go-ceph's cephfs package. Now that we have
Statx, we can replace the need for the external mount and os.Stat.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-21 06:19:40 +00:00
John Mulligan df9834fc82 cephfs: remove uses of external mount of test fs
The external mount point was mainly used for stat prior to a Stat
function being part of go-ceph's cephfs package. Now that we have
Statx, we can replace the need for the external mount and os.Stat.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-21 06:19:40 +00:00
John Mulligan 3b9317b608 cephfs: remove a use of external mount of test fs
The external mount point was mainly used for stat prior to a Stat
function being part of go-ceph's cephfs package. Now that we have
Statx, we can replace the need for the external mount and os.Stat.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-21 06:19:40 +00:00
Sven Anderson 1c72979ce0 ptrguard: assert that //go:uintptrescapes actually works
This adds a test that assures that the special //go:uintptrescapes comment
before the storeUntilRelease() function works as intended, that is the
garbage collector doesn't touch the object referenced by the uintptr until
the function returns after Release() is called.  The test will fail if the
//go:uintptrescapes comment is disabled (removed) or stops working in future
versions of go.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-03-19 09:47:19 -04:00
John Mulligan 51885f0875 rbd: add test case for Stringer supporting mirroring constants
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-19 11:23:37 +00:00
John Mulligan b614e93b9d rbd: add String method for MirrorImageState
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-19 11:23:37 +00:00
John Mulligan 741e7d43bd rbd: add String method for ImageMirrorMode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-19 11:23:37 +00:00
John Mulligan 406868763c rbd: add String method for MirrorMode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-03-19 11:23:37 +00:00
Sven Anderson d75b75fb75 ci: add branch pattern 'pr/**' to PR test workflow
In order to run CI jobs also on PRs that are based on other PRs, this
change adds the pattern 'pr/**' to the tested base branches.  That
means, if PRs are pushed that are based on branches that start with
pr/... these PRs are also get tested. So, if we - by convention - push
PRs to branches like for example pr/ansiwen/myfix42, then all PRs
that are not based on master but another PR get tested as well.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-03-12 10:07:58 -05:00
Sven Anderson 527553718c cephfs: add a missing userMount() to tests
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-03-05 04:30:30 +00:00
John Mulligan 97bccd7a90 readme: document v0.8.0 and the ceph versions it supports
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-10 12:46:41 +01:00
Sven Anderson 01c9818729 ci: add GODEBUG=cgocheck=2 to the container environment
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 13:36:28 -05:00
Sven Anderson 5768911be7 ci: add a test run for Iovec based on PtrGuard
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 11:09:25 -05:00
Sven Anderson b8a803ccbb cutil: use SyncBuffer for iovec type
The main motivation for PtrGuard was read and write buffers as they
are used in iovec.  This change uses SyncBuffer for the iovec
implementation, so that the no-copy PtrGuard implementation can be
enabled with the with_ptrguard build tag.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 11:09:25 -05:00
Sven Anderson 430dea5b7f cutil: add SyncBuffer abstraction layer to PtrGuard
In order to be able to swich on and off PtrGuard usage, SyncBuffer
implements a typical usage pattern of PtrGuard, that is a data buffer
referenced from inside a C allocated struct, in two ways: 1) using a
PtrGuard to dierctly store a pointer to the Go buffer in C memory, or
2) allocating a C buffer of same size and syncing data back with
C.memcpy().  The implementation can be chosen with the with_ptrguard
build tag.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 11:09:25 -05:00
Sven Anderson ac57250a5b cutil: add some useful function aliases
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 11:09:25 -05:00
John Mulligan 1286e0d4d0 rbd: add GroupSnapRollbackWithProgress function
* Add GroupSnapRollbackWithProgress implementing rbd_group_snap_rollback_with_progress

This has supporting code basically the same as our other existing
callback functions.
Tests too.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-08 15:29:11 +00:00
John Mulligan 8e6dfe4259 rbd: add GroupSnapRollback implementing rbd_group_snap_rollback
* Add GroupSnapRollback implementing rbd_group_snap_rollback

Adds tests for the above.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-08 15:29:11 +00:00
John Mulligan ffeabf1436 rbd: add GroupSnapList implementing rbd_group_snap_list
* Add GroupSnapList implementing rbd_group_snap_list

Adds tests for the above.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-08 15:29:11 +00:00
John Mulligan fd08e791cc rbd: add GroupSnapCreate, GroupSnapRemove, & GroupSnapRename funcs
* Add GroupSnapCreate implementing rbd_group_snap_create
* Add GroupSnapRemove implementing rbd_group_snap_remove
* Add GroupSnapRename implementing rbd_group_snap_rename

And tests for the above.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-08 15:29:11 +00:00
Sven Anderson 2bfdee2508 cutil: add test for PtrGuard
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 14:50:56 +00:00
Sven Anderson 0451edaf71 cutil: add PtrGuard for storing Go pointers in C memory
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-08 14:50:56 +00:00
Sven Anderson 48bff9548a ci: wait before starting ceph-osd
This is another attempt to fix #423.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-02-04 07:38:38 +00:00
John Mulligan 0b4ed9dbe8 rbd: add GetGroup implementing rbd_get_group
This method is useful to determine what group an image is part of.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-02 15:48:00 +00:00
John Mulligan cbf2a51698 rbd: add GroupImageList implementing rbd_group_image_list
This function can be used to list the images in a group.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-02 15:48:00 +00:00
John Mulligan cd0a5bfe01 rbd: add GroupImageAdd, GroupImageRemove, and GroupImageRemoveByID
* Add GroupImageAdd implementing rbd_group_image_add
* Add GroupImageRemove implementing rbd_group_image_remove
* Add GroupImageRemoveByID implementing rbd_group_image_remove_by_id

These functions allow managing the images that are part of a group.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-02 15:48:00 +00:00
Mudit Agarwal 1e15c36ec9 cephfs: add state field to SubVolumeInfo structure.
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2021-02-02 15:29:53 +00:00
John Mulligan 1748ad781c rbd: test that cephIoctx helper panics when fed invalid inputs
As per go-ceph issue #427, and a discussion in #399 this change and
test ensure that the cephIoctx helper function, that extracts the
C.rados_ioctx_t from a Go rados.IOContext, never returns a nil/null
C type.
As these are always "programming errors" panicking is reasonable
behavior for this case.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-01 15:31:17 +00:00
John Mulligan 5130f55387 cephfs admin: fix the json sent when flag RetainSnapshots is set
The json key sent to retain snapshots on subvolume remove was misspelled
and had a dash in it rather than an underscore. Fix the incorrect key
and add a test, that needs to be able to run on version of cephfs w/o
snapshot retention, and verifies that flag does the correct thing.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-02-01 08:33:28 +00:00
Niels de Vos 05a8b48688 rbd: Add TestWriteSame/zerofill test case
Using WriteSame() to implement a zerofill function is less straight
forward than expected. `rbd_discard_on_zeroed_write_same` is a Ceph
option than affects the behaviour of WriteSame(). By default the option
is enabled, causing WriteSame() to call discard instead of writing
zeros.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2021-01-28 16:04:12 +00:00
Mudit Agarwal 3032c539a0 rbd: add GetImageMirrorMode() to get the mirroing mode of a RBD image
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2021-01-25 20:35:15 +00:00
Mudit Agarwal 6ff40f828f rbd: add function to fetch mirror status of a RBD image.
Add GetMirrorImageInfo() to fetch the mirror status of a RBD image.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2021-01-25 20:35:15 +00:00
John Mulligan 25a5086184 rbd: fix typo in comment & improve comment consistency
RBD was misspelled as RDB. While I was there I made the comments
for both constants more consistently worded.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-25 14:38:39 +00:00
John Mulligan 1e3b9a2cd9 rbd: add an initial set of basic mirroring functions
Add functions:
* SetMirrorMode implementing rbd_mirror_mode_set
* GetMirrorMode implementing rbd_mirror_mode_get
* MirrorEnable implementing rbd_mirror_image_enable2
* MirrorDisable implementing rbd_mirror_image_disable
* MirrorPromote implementing rbd_mirror_image_promote
* MirrorDemote implementing rbd_mirror_image_demote
* MirrorResync implementing rbd_mirror_image_resync
* MirrorInstanceId implementing rbd_mirror_image_get_instance_id

For now, these mirroring related functions are only supported on octopus
builds. Right now the demand is for snapshot based mirroring, which is
new in octopus. We can always relax this in the future and add the
necessary support for nautilus, for journaling only based mirroring.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-22 09:27:06 -05:00
John Mulligan a40638e947 rbd: add GroupList implementing rbd_group_list
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-22 08:13:20 +00:00
John Mulligan 7eeb5f79ab rbd: add GroupCreate, GroupRemove, & GroupRename functions
Add GroupCreate implementing rbd_group_create
Add GroupRemove implementing rbd_group_remove
Add GroupRename implementing rbd_group_rename

Naming was <noun><verb> to better match other functions in rbd
like NamespaceCreate, etc. even though I don't prefer that
ordering ;-).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-22 08:13:20 +00:00
John Mulligan 76bca17e43 rbd: enable test cases with ceph issues that have been fixed
Ceph issue https://tracker.ceph.com/issues/43178 has been fixed for
a while with backports. No reason not to enable these test cases now.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-21 21:40:20 +00:00
Sven Anderson 0130c60281 cutil: add general C type, function and const aliases
This change adds a new pointer alias CPtr, that should always only
contains pointers to C allocated memory and should always used for
such pointers in order to keep them separate from Go pointers more
easily. This is helpful, since only CPtr are allowed to be stored in
C allocated memory, and Go pointers can only be passed to C functions
if they don't point to memory not containing Go pointers again, that
is all pointers in such memory must be CPtr.

The change also adds aliases for C.malloc and C.free that return and
accept the CPtr type as a little safety measure.

Additionally there are some useful constants defined.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-01-20 14:46:03 +00:00
John Mulligan c995d63088 cephfs: enable test cases with ceph issues that have been fixed
Ceph issue https://tracker.ceph.com/issues/46084 has been fixed with
backports to nautilus and octopus. Re-enable the relevant test data
and fix up the tests to match.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-19 08:23:52 +00:00
Sven Anderson 134c628df1 ci: run ceph-osd in foreground during mkfs
This is an attempt to fix #423.

Signed-off-by: Sven Anderson <sven@redhat.com>
2021-01-15 14:31:48 +00:00
John Mulligan c91f54ef25 rados: add test cases for ReadOp type and functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan 0a67ff8f5a rados: add an initial set of tests for WriteOp operations
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan 315188eaef rados: add AssertExists function to ReadOp
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan c8d8d8c364 rados: add Write, WriteFull, and WriteSame WriteOp functions
Add Write implementing rados_write_op_write.
Add WriteFull implementing rados_write_op_write_full.
Add WriteSame implementing rados_write_op_writesame.

These are some of the basic functions needed to write data to
a rados object using a WriteOp.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan e4e1257768 rados: add AssertExists WriteOp function
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan 570738b24c rados: add CleanOmap WriteOp function
Reimplement CleanOmap in term of a new CleanOmap function on the
WriteOp.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan f4e0730b8f rados: add RmOmapKeys WriteOp function
Reimplement RmOmapKeys in term of a new RmOmapKeys function on the
WriteOp.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00
John Mulligan 701bb74897 rados: add GetOmapValues function to the ReadOp
Refactor the previous ListOmapValues logic into a new read op step
that can be used for iteration over the results of the operation. The
previous function is now based on the ReadOp.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-01-12 14:47:30 +00:00