graphdriver: add support for ceph graph driver#9146
graphdriver: add support for ceph graph driver#9146simon3z wants to merge 1 commit intomoby:masterfrom
Conversation
|
At first glance, it seems like all your functions ought to be private, except the stuff in driver.go (since that's implementing the public interface). |
|
Thanks @cpuguy83 I'll fix that in the next revision. |
|
What's needed to make this work? After installing librados and librbd I was at least able to get it to compile, albiet with an error from librados. |
|
@cpuguy83 you need your host to be configured to use your ceph cluster. For example this should work: ceph osd lspools0 data,1 metadata,2 rbd Then the only thing you need to do is: ceph osd pool create docker-data 100ceph osd lspools0 data,1 metadata,2 rbd,3 docker-data, and you should be good to go. BTW, can you paste the librados error that you got? |
It would be super nice for the driver to handle creating this pool... and potentially support a |
|
@cpuguy83 I just updated the patch with your suggestions: private functions and --storage-opt ceph.datapool to select the pool. I also added a TODO (that I'll handle later) to create the pool automatically. Thanks for the feedback, let me know if it works for you. |
dd8d2a6 to
62ec005
Compare
|
@cpuguy83 do you know if there's anything I can do to let the patch pass drone.io? It seems that the ceph dev packages are missing. Is it something I can fix or is it a private setting of the drone.io environment? |
|
@simon3z You'd need to add |
|
@cpuguy83 yes that's what I've done in the last revision. Isn't it? |
|
Maybe an issue with drone... I personally can't get it to not segfault upon start. |
|
@cpuguy83 I need more information. What distro are you using? (ubuntu 14.04?) What is the output of "ceph osd lspools"? Can you run with gdb and check where it segfaults? Additionally you can contact me on irc (fsimonce on freenode) so that we can try to fix this asap. Thanks. |
|
I gave this PR a try and also hit a segfault. It seems to occur in some global constructor
gdb output: strace output: |
|
@cpuguy83 @yadutaf it seems that static linking is not possible at the moment and it results in the sigsegv that you are experiencing. The main problem is that at least 1 lib used by ceph is not available for static linking (nss3). I tested this on ubuntu 14.04.1 with the following packages: golang 2:1.2.1-2ubuntu1 building with: $ AUTO_GOPATH=1 DOCKER_BUILDTAGS="exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" ./project/make.sh dynbinary And the ceph graph driver works as expected. You could be hitting one of these issues (other sigsegv): ceph/ceph#2937 The mitigation for both at the moment is to remove "rbd cache = true" from the ceph.conf. |
|
The On start, it attempts to remove
In the source code, I noticed a couple of execs to Design question: what happens if say, 2 nodes of a cluster are pulling the same image / common layers simultaneously? Btw, could you add some logging especially when raising an error? It would be awesome to help troubleshoot ceph related errors. |
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
|
@yadutaf I added --storage-opt ceph.client as you suggested. At the moment I haven't wired the unmap of the half-baked base image yet. I think I'll add it when I'll remove the need of the devices map and devicesLock. I'd love to get rid of "rbd map/unmap" but at the moment their logic is not present in the rbd library and removing them at the moment would result in duplicating too much logic inside the driver. WRT multiple hosts: well the initial idea was that multiple hosts would be able to share the same images. This requires a lot of work in docker infrastructure so I am postponing it and now I am focusing in providing a regular graph driver. For this purpose I added the storage opt "ceph.imageprefix" that can be used on different hosts with different values (hostname?) to avoid (unmanaged at this time) collisions. Errors should be logged already. Can you give me an example of more verbose reporting? Thanks. |
|
I'm thinking a better use of this would be for implementing as a backend for volume storage. Right now "vfs" is hardcoded as the storage for volumes, but ceph might be really nice there for certain things. |
|
@cpuguy83 yes, that makes perfectly sense, this patch is providing some bindings that you could use for that as well. |
Nice thinking! |
There was a problem hiding this comment.
It could be interesting to log the output of strerror(-err) to help debugging
|
Thanks for the new options, I'll give it a try. IMHO, the main advantage of having a ceph graph driver inside Docker is precisely Host coordination / data sharing so that pulling an image on a host makes it immediately available on any other host having access to the cluster. Use cases for this includes failover and fast application scaling. (but probably not storage space due to the 3 replicates common setup). Regarding multi-host safety, it could rely on advisory locking (https://github.com/ceph/ceph/blob/master/src/include/rbd/librbd.h#L232). |
|
I personally feel it's a little weird for image/container storage since these things are static and there is the registry. Having multiple hosts accessing the same /var/lib/docker would be really bad. A registry backend driver would be really nice, too. |
|
@simon3z If I remember correctly, the functions related to map/unmap have been splitted into a separate library (libkrbd) in Ceph master |
|
@cpuguy83 I wrote this little patch on top of this branch and your 'add_volumes_command' branch to be able to use the Ceph graphdriver to create volumes |
|
@yadutaf @cpuguy83 a next possible step (on top of this patch) could be to provide drivers also for the metadata that we now store in sqlite. In fact if we do so we could use a ceph object store to maintain also the metadata and then share common images between hosts (using ceph locking). Anyway this could be too far fetched, it's a possibility. @lebauce thanks, I discovered libkrbd few days ago but I still want this patch to be easily consumable on fedora/el6/el7/ubuntu where that lib is not available yet. I'll definitely use libkrbd in the future. |
|
@simon3z Does this still have an issue with static compilation? That will hinder being able to merge. |
|
@cpuguy83 the problem is that ubuntu is not providing the static libs for some packages (e.g. nss3, ceph, etc.). This means that in the Dockerfile we would have to do what we do for devmapper... download the sources and recompile them statically. Where can I get some background on why this is strictly required? (Maybe a previous thread, a faq, etc.) From my point of view the static compilation is not an issue in the driver but simply there's no distribution providing the required static libraries today. Any suggestion on how to proceed? |
|
Hi @simon3z, |
|
As an alternative to an external plugin, this could have two parts: 1) the part which is integrated into Docker 2) a tool which is linked against the ceph libraries. The tool which is linked against the ceph libraries could then a) become part of ceph itself and provided by ceph or b) be recompiled by the user / distribution packager This dependency on the exact version of the library it's linked against is a problem. The way it is right now, users would always have to recompile the Docker binaries if they install newer ceph packages or if their distribution has another version of ceph. |
This is an initial proof of concept for adding a ceph graph driver. It's not fully in a good shape yet but it works pretty well at the moment.
Please leave a feedback, I am willing to finish this up and get it merged if you think it's interesting.