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>
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>
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>
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>
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>
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>
* 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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Reimplement SetOmap in terms of a new SetOmap function on the WriteOp.
Now the actions of the write op can start to be atomically chained the
way WriteOps are supposed to.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a new error that will be returned from a op step method if the
method is called before the step is ready to provide data - like
when the operation has not yet been performed.
Signed-off-by: John Mulligan <jmulligan@redhat.com>