Commit Graph

21 Commits

Author SHA1 Message Date
John Mulligan 2240c56614 cephfs: update TestCreateMountWithId to check custom id is used
Now that we have mds command function, we can use it to check for the id
we passed to CreateMountWithId appears in the session list.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 14:01:33 +01:00
John Mulligan 34f1507992 cephfs: add wrapper funcs for ceph_mds_command
Adding a wrapper for ceph_mds_command allows the client to make
queries against the mds server.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 14:01:33 +01:00
John Mulligan 15a55c9000 cephfs: add a doc.go file documenting the package
The minimal doc.go file matches the style currently used for rados and
rbd.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-28 16:10:39 +01:00
John Mulligan c433abf787 cephfs: allow creating mount with an id
The ceph api function supports passing a string to identify the
client doing the mount. Expose that aspect of the api with a
new function CreateMountWithId.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-28 08:52:51 +01:00
John Mulligan 296c551613 cephfs: test creating a cephfs mount from a rados Conn
Verify the cephfs CreateFromRados function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-27 18:30:10 +01:00
John Mulligan 9929f63b13 cephfs: wrap ceph_create_from_rados function
Support creating a cephfs 'mount' from an existing rados connection
using the ceph_create_from_rados function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-27 18:30:10 +01:00
John Mulligan b177121473 cephfs: replace tests mount setup boilerplate with func
In the cephfs tests the setup of the mount/connection was largely being
done as a copy-n-paste. This change adds a common setup function for
most of the test cases that need an active connection.
Similar to other recent changes this also adds a timeout such that
if the test fails to get a connection it will fail quickly rather
than block forever.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-20 16:52:45 +01:00
John Mulligan 4589af9dfd cephfs: fix linting errors found in cephfs_test.go
Now that cephfs_test.go is part of the cephfs package, the linter is
checking it and finding errors. Fix them.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 73753d5482 cephfs: test error type and error handling functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 9f46b4621b cephfs: include cephfs_test.go in cephfs package
This will allow us to test private functions from the cephfs package
int our test file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan b6ad17881a cephfs: convert cephfs error type to exported type
Convert cephfs packages previously unexposed type to a public one and
replace a bunch of the existing boilerplate error handling with a
convenience function similar to those found ind rbd and rados.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 72ea0669c2 cephfs: use common error extraction function
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan ce5d3ef04d cephfs: remove use of logging in package
After discussion we decided to entirely drop logging from the library.
Future users should rely instead of the error types and values the
function calls return.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-13 15:17:27 +01:00
Sven Anderson 472f6dd5bb Tests: avoid segmentation faults in tests
This change replaces a couple of functions from the "assert" package
with the corresponding functions from the "require", where the
following code relies on a non-nil object.

Signed-off-by: Sven Anderson <sven@redhat.com>
2019-12-06 11:12:34 -05:00
Lincoln Thurlow 5a74b46a87 cephfs: modified guard clauses + golint'd 2018-10-11 11:36:26 -07:00
Lincoln Thurlow ecf9a99249 cephfs: add unmount, release, chmod, chown, etc
This commit adds the following cephfs functions:

* Unmount // Unmounting is necessary to cleanup mounts
* Release // Release destroys the cmount ~ end of transaction
* RemoveDir // inverse of MakeDir
* Chown // change ownership of file or directory
* Chmod // change permissions of file or directory

Tests are included for each function.

In addition to these changes modifications to:

.travis.yml, Dockerfile, and Makefile

were made to accomodate tests to mount the ceph volume.  Tests use
fuse to mount the volume which requires adding:

--device /dev/fuse --cap-add SYS_ADMIN --security-opt \
apparmor:unconfined

to the docker container (alternatively --privileged works but adds
additional permissions).

Changes to README add the above docker changes as well as point
users to the necessary ceph development libraries.
2018-10-11 11:09:16 -07:00
Lincoln Thurlow f3df337fab cephfs: add cephfs commands, expand logging
* CephError uses syscall for string version of error
* Add error logging for every function
* Add RemoveDir() function
* Add Unmount() function
* Add Release() function
* Add Chown() function
* Add Chmod() function
2018-10-11 11:09:16 -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
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
Noah Watkins 0f4cf26919 cephfs: add mkdir
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-05-01 12:57:07 -07:00
Noah Watkins 1efdf980f0 cephfs: begin cephfs wrappers
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2015-05-01 12:41:47 -07:00