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>
The Init functions initializes the connection without mounting the fs.
This function must be called before setting the perms but before
creating the mount.
SetMountPerms accepts a UserPerm object to set the fs ownership info
on the mount. The corresponding tests verifies that the UserPerm
can be applied and it effects the gid of newly created dirs for that
mount.
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>
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>
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>
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 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