Commit Graph

751 Commits

Author SHA1 Message Date
John Mulligan
fd10d9b756 cephfs admin: add functions to create, list, & remove subvolumes
Adds functions and tests for:
* CreateSubVolume
* ListSubVolumes
* RemoveSubVolume

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-31 10:38:38 -04:00
John Mulligan
5e6eec6a1a cephfs admin: add functions to create, list, & delete subvolumegroups
Adds functions and tests for:
* CreateSubVolumeGroup
* ListSubVolumeGroups
* RemoveSubVolumeGroup

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-31 10:38:38 -04:00
John Mulligan
198541cccd cephfs admin: add core functionality and volume functions
Adds the central admin type `FSAdmin` and some helper functions.
Adds basic volume list and info functions.
Adds tests for the volume functions and common fsadmin functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-31 10:38:38 -04:00
John Mulligan
ea1073dc1d cephfs admin: start a package for convenient administration of cephfs
These functions are not part of the cephfs APIs but will be based on the
various command-json features of the 'ceph' command line tool.
This change only adds a doc.go to stub in the package.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-31 10:38:38 -04:00
John Mulligan
c845565e1b readme: clarify why we can't make static binaries
Make the statemant about not being able to statically link a less
general statement. It's not just cgo, we also only have shared objects
from ceph lib{rados,rbd,cephfs}.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
f88b87eaab readme: "Development" sub-title was at the wrong level
All other titles were at level two. Make "Development" consistent.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
4ec7a91da8 readme: move the scattershot api hints to a separate doc
There were various random "documentation" tidbits, all for rados,
on the main readme. As these are neither comprehensive nor complete
I am moving them to a seperate page and calling them "hints" which
seem to be closer to what they are.

Eventually, we could include more comprehensive examples in the
docs/ directory.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
a1641d2838 readme: note that code using go-ceph needs go dynamic libs
Add a caveat that go-ceph requires the ceph dynamically linked libraries
at runtime and that static linking is not available.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
c6113f79f9 readme: improve flow of the Installation section
Emphasize that go-ceph is a library and that the ceph devel packages are
build-time dependencies.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
07243682f2 readme: add brief introduction to what go-ceph is
Like a lot of projects on github the readme didn't really explain what
go-ceph *is*. There is a very brief project description and if you're
clever you may know what "bindings" are. This short introduction should
help clarify and expand that for any newcomers to the project.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
db01338d4a readme: remove irrelevant "badge" from README.md
This "badge" was making use of travis ci. We dropped use of travis ci
months ago. I am opting not to replace the badge with something new
because I don't think badges are useful in the first place.
But I don't want to rock the boat too much and remove all of them.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 13:44:24 -04:00
John Mulligan
b24fa281df cephfs: clarify the behavior of the EOF case and short read in Preadv
Extend the Preadv/Pwritev test cases by adding assertions for the
behavior of the call in the end-of-file condition, and add another
test case to clarify the behavior in an explicit short-read test.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 10:07:34 -04:00
John Mulligan
f3d14f90b3 cephfs: change the permissions of open files in file_test.go
As pointed out in a review of Pwritev/Preadv functions, someone could
be using the tests as example code and not realize the "wide open"
permissions used in the test. Because it doesn't actually impact the
behavior of the test there's no reason not use use more restricted
permissions.
This change makes the older functions in the file use the restricted
perms too.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 10:07:34 -04:00
John Mulligan
9c1ed2dfc2 cephfs: implement Preadv and Pwritev File methods
Add Preadv implementing ceph_preadv.
Add Pwritev implementing ceph_pwritev.
These calls act similarly to ReadAt and WriteAt but take multiple
buffers at once.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 10:07:34 -04:00
John Mulligan
ebea82dda5 cutil: add Iovec type wrapping C struct iovec arrays
This type is useful for passing disparate buffers to be read or
written in a single call. Functions using this type exist in cephfs
and rbd. Currently this is needed for cephfs calls.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-28 10:07:34 -04:00
Sven Anderson
4706453428 rbd: remove unnecessary C wrapper functions
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-08-28 09:51:06 -04:00
John Mulligan
dbf20aea0a rbd: add Sparsify implementing rbd_sparsify
The sparsify function can be used to make an image sparse by replacing
runs of zeros with holes. This change adds a wrapper for the basic
rbd_sparsify function and accompanying tests.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-27 14:22:52 -04:00
Sven Anderson
176a163c3c callbacks: use uintptr instead of int as index
Since the index of the registered callbacks is basically only used as
void*/unsafe.Pointer, it makes more sense and code simpler, if
the index type is uintptr instead of a simple int.

Signed-off-by: Sven Anderson <sven@redhat.com>
2020-08-27 10:26:12 -04:00
John Mulligan
9cd28289b5 testing: use supported golang version in ci container images
Bump the golang version to 1.14.7. Go 1.14 is now the older supported
version, with the recent release of Go.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-25 09:32:07 -04:00
John Mulligan
d0f3a30c57 readme: add a support table for go-ceph <-> ceph versions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-25 09:00:56 -04:00
John Mulligan
d2d2af34b1 readme: another small wording tweak
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-25 09:00:56 -04:00
John Mulligan
76bb869f02 readme: switch example tag use to 'nautilus'
Switch the example of how to compile go-ceph with tags to refer to
nautilus in light of luminous and mimic being deprecated.
Small wording/grammar changes to try and make the sentence clearer.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-25 09:00:56 -04:00
John Mulligan
0498d7dbc9 readme: minor grammatical tweaks
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-25 09:00:56 -04:00
John Mulligan
b7836c621e testing: drop castxml install from ci container build
The castxml install from centos8+epel has been rather fraught with
errors including broken/failed installs and, at the time of this commit,
it installs but can not run due to llvm integration/cli issues.
On top of this it was not available on centos7 anyway and so would,
in theory, only have worked on the octopus container image.
At this point it seem that running the implements tool is not worth
all the failures that trying to install castxml causes.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-13 13:33:11 -04:00
John Mulligan
4cf21dd0b3 testing: simplify package update, but require matching versions
Now that ceph/daemon-base:latest-octopus is on v15.2.4 we can
stop the need to update already installed packages in the container.
To make things "safer" and fail early with errors rather than mysterious
compatibility problems, I am adding explicit versions to the
lib{cephfs,rados,rbd}-devel-* packages. Now if the container can't find
these packages it will fail rather than partially upgrade the ceph
packages.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-13 13:33:11 -04:00
John Mulligan
849fc3c1f3 rbd: use FormatErrorCode for formatting rbd errors
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
b6dff699e4 rados: use FormatErrorCode for formatting rados errors
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
33e84bc9c5 cephfs: use FormatErrorCode for formatting cephfs errors
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
828ea92a51 errutil: replace unused StrError with FormatErrorCode function
This change removes StrError, as it was unused.
Instead we add FormatErrorCode which should replace the common code that
was previously repeated for all error-code types, along with
consistently printing the raw error code value's sign (minus sign when
negative).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
ab49935b5b rbd: rename error type's Errno method to ErrorCode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
54c268cb81 rados: rename error type's Errno method to ErrorCode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
1ecac966de cephfs: rename error types Errno method to ErrorCode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-10 13:03:24 -04:00
John Mulligan
d6e928993b rbd: fix naming of internal watch callback item type
This patch changes the name to the as-agreed-upon naming from a call.
I forgot to fix this in the original patches before merging things.
Oops.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-07 08:38:15 -04:00
John Mulligan
aa29fad715 rbd: simplify callback mechanism in diff_iterate and watchers
Previously, the code that set up the callbacks was doing a pretty
direct translation of go-function to c-function. It turns out this
is not needed due to the way we set up the "dynamic" go callbacks
via an integer based callback "registry". Instead, we can stay within
the C layer entirely for the C callback, passing it only the index
value and then return to the go layer through a static C function
that only needs the index value.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-07 08:38:15 -04:00
John Mulligan
4a58616b96 cephfs: fix a typo in the ListXattr doc comment
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-04 13:35:35 -04:00
John Mulligan
f020a3ffac cephfs: add path-based xattr functions
This change adds wrappers for:

* ceph_getxattr
* ceph_listxattr
* ceph_removexattr
* ceph_setxattr

As well as:
* ceph_lgetxattr
* ceph_llistxattr
* ceph_lremovexattr
* ceph_lsetxattr

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-04 13:35:35 -04:00
John Mulligan
80ce962b68 cephfs: give xattr test samples a better name
The name "samples" was too generic. Rename it to "xattrSamples".
This variable will be used outside of this file in a future change.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-08-04 13:35:35 -04:00
Sven Anderson
e0982bc6e1 tests: disable disk space check in micro-osd.sh
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-08-04 12:59:38 -04:00
Sven Anderson
2a75461371 make: add micro-osd.sh to container dependencies
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-08-04 12:59:38 -04:00
Mudit Agarwal
7a387654c5 rbd: remove deprecated fields from ImageInfo struct
Corresponding fields for Parent_pool and Parent_name have been deprecated from
ceph's rbd_image_info_t stuct, removing the same from go-ceph's ImageInfo struct.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 12:48:01 -04:00
Mudit Agarwal
16a24da06d rados: add wrapper for rados_ioctx_snap_set_read() function
Implemented SetReadSnap() which sets the snapshot from which reads
would be performed.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
610b92ded2 rados: add wrapper for rados_ioctx_snap_rollback() function
Implemented RollbackSnapshot() and testcases for the same.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
62f5881485 rados: add wrapper for rados_ioctx_snap_list() function
Signed-off-by Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
ff1ce13478 rados: add wrappers for rados snapshot ID related functions
Add wrappers for following three functions which involve snapshot ID:
1. rados_ioctx_snap_lookup()
2. rados_ioctx_snap_get_name()
3. rados_ioctx_snap_get_stamp()

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
8e5a05c1a4 rados: add snapshot create/remove functions
Added wrappers for pool-wide snapshot create and remove functions.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
558b366fbb rados: modify validate() to return ErrInvalidIOContext error
If ioctx is not ready to be used then validate() should
return ErrInvalidIOContext error.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04:00
Mudit Agarwal
8788a901dc rados: one minor reformat in errors.go
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-08-04 11:07:40 -04: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
John Mulligan
9179f8df29 rados: add a validate() function to IOContexts
The validate function works similarly to those already found
in rbd and cephfs. It will be used in future functions or
updated functions to ensure the C ioctx is ready for use.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-31 09:17:38 -04:00
Sven Anderson
085e2049b3 tests: add tests for the Errno() methods of numeric error types
Signed-off-by: Sven Anderson <sven@redhat.com>
2020-07-24 23:14:20 +02:00