In a previous commit we added fsDisconnect to match with fsConnect. For
tests that do not use fsConnect but still acquire resources we need to
free up those resources with direct calls to the appropriate functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
For every (most?) call to fsConnect we should pair it with a (deferred)
call to fsDisconnect to close connection and release resources
associated with the mount object we have created for the test.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The defer function in TestMountWithRoot was always trying to call
unmount before release. This is not correct if the fs was not mounted
so we reorganize this code to more closely match what should be done
in normal practice.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Somehow we managed to introduce extra code into TestCreateMount that
had it create two mounts. This is undesirable for this test so this
change eliminates the extra unwanted invocation.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, the mds name was hardcoded in the tests to match that set up
by "micro-osd.sh". We continue to default to that value, but allow the
test to be supplied a custom value by the environment.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a utility function to test cases that expect the cephfs file system
to be mounted locally and accessible.
Add environment vars to configure the location of the mount point as
well whether the function causes the test to be skipped (the default)
or force an early but clear failure.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Moving the errutil pkg to "internal/errutil" makes errutil private-like
and accessible to only other go-ceph packages. The functions it provided
were always meant to be used only by go-ceph, this just makes it more
official. This is a breaking change but it was only available to
outside users for 1 release and it is somewhat doubtful users outside
of go-ceph would have reached for these functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The existing Mount() method did not provide a way to access the root
path argument to ceph_mount. This new function allows the caller to
specify an alternate root dir for the mount.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Try to improve the doc comments for clarity and less redundancy.
Add "implements" subsections for the three functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>
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.
* 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