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>
Similar to the rados function of the same name, ParseDefaultConfigEnv
uses the environment to configure the cephfs mount.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The ParseConfigArgv behaves similarly to the same named function in
rados. The command line argv value is parsed by ceph libs and used to
configure the mount object.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
ceph MountInfo pointer is being passed in the functions without a validation check, if it is nil there may be a crash. Fixed the functions to first validate mount.mount
Signed-off-by: Mudit Agarwal muagarwa@redhat.com
Continue organizing the cephfs functionality by creating new files
for chmod and chown functionality.
Similarly, the dedicated test functions for those items are moved
into a new file as well.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Continue organizing the cephfs functionality by creating new files
for the most basic path management functions:
MakeDir, RemoveDir, ChangeDir, CurrentDir
Similarly, the dedicated test functions for those items are moved into
a new file as well.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Start organizing some of the cephfs functionality into functions grouped
by files by moving the MDS command functions into a new file. Move the
tests dedicated to those functions into a new matching file too.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
To prevent test failures re-reunning the suite against the same fs we
need to make sure tests clean up after themselves.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, calling Release more than once for the same MountInfo would
abort due to a double free in the ceph libs. As this is somewhat user
hostile we add some simple state tracking in our wrapper type such that
one can make redundant calls to Release without crashing the
application.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The test function that exercises ChangeDir was creating a directory
and leaving it behind. Add some basic cleanup to the test to try
and avoid leaking stuff between test runs.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
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>
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>
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>
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>
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