Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage Driver: Ceph Object Storage (RADOS) #443

Merged
merged 1 commit into from
May 30, 2015

Conversation

gierschv
Copy link
Contributor

This driver implements the storagedriver.StorageDriver interface and
uses Ceph Object Storage as storage backend.

Since RADOS is an object storage and no hierarchy notion, the
following convention is used to keep the filesystem notions stored in
this backend:

  • All the objects data are stored with opaque UUID names prefixed
    (e.g. "blob:d3d232ff-ab3a-4046-9ab7-930228d4c164).

  • All the hierarchy information are stored in rados omaps, where the
    omap object identifier is the virtual directory name, the keys in
    a specific are the relative filenames and the values the blob
    object identifier (or empty value for a sub directory).

    e.g. For the following hierarchy:

    /directory1
    /directory1/object1
    /directory1/object2
    /directory1/directory2/object3

    The omap "/directory1" will contains the following key / values:

    • "object1" "blob:d3d232ff-ab3a-4046-9ab7-930228d4c164"
    • "object2" "blob:db2e359d-4af0-4bfb-ba1d-d2fd029866a0"
    • "directory2" ""

    The omap "/directory1/directory2" will contains:

    • "object3" "blob:9ae2371c-81fc-4945-80ac-8bf7f566a5d9"
  • The MOVE is implemented by changing the reference to a specific
    blob in its parent virtual directory omap.

Todo for this WIP driver:

  • Stripes rados objects to a fixed size (e.g. 4M). The idea is
    to keep small objects (as done by RBD on the top of RADOS) that
    will be easily synchronized accross OSDs. The information of the
    original object (i.e total size of the chunks) will be stored as a
    Xattr in the first chunk object.
  • Driver tests
  • List all the keys of the omaps without a fixed limit of keys (used
    to list virtual directories).

Related: #40
Dependencies: dotnwat/go-ceph#15, dotnwat/go-ceph#16 and dotnwat/go-ceph#19 (merged)

Signed-off-by: Vincent Giersch vincent.giersch@ovh.net

@gierschv
Copy link
Contributor Author

@simon3z @noahdesu you might be interested :)

@stevvooe
Copy link
Collaborator

@gierschv This is looking promising. Can't wait to see the testsuites passing.

Will you be able to maintain this in the future?
How can we test this with circleci (or other ci)?

@gierschv gierschv force-pushed the driver-rados branch 11 times, most recently from a10d23a to 287ebfc Compare April 30, 2015 16:09
@gierschv
Copy link
Contributor Author

@stevvooe Yes, I can maintain it in the future. For the CI, I installed a ceph micro cluster in Circle CI, as done in go-ceph for travis and it works pretty fine:

ok      github.com/docker/distribution/registry/storage/driver/rados    58.569s coverage: 78.3% of statements

// Remove a file from the files hierarchy
func (d *driver) DeleteOid(path string) error {
// Remove object reference
directory := filepath.Dir(path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that we don't want the path layout to change when running on unix or windows, this should use the path package rather than filepath.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I replaced filepath by path.

@gierschv
Copy link
Contributor Author

gierschv commented May 4, 2015

Added dotnwat/go-ceph#19 (which is now merged) for the third todo ("List all the keys of the omaps without a fixed limit of keys"). I'll work on it tomorrow.

}

// Reference a object and its hierarchy
func (d *driver) PutOid(objectPath string, oid string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these methods need to be exported?

@stevvooe
Copy link
Collaborator

stevvooe commented May 5, 2015

@gierschv Another thought here: Will a user require to the librados libraries to be available to build the registry? If so, should we hide rados support behind a compilation flag. We'll build the official images with rados built-in but developers shouldn't be required to build with it.

@gierschv gierschv changed the title [WIP] Storage Driver: Ceph Object Storage (RADOS) Storage Driver: Ceph Object Storage (RADOS) May 5, 2015
@gierschv gierschv changed the title Storage Driver: Ceph Object Storage (RADOS) [WIP] Storage Driver: Ceph Object Storage (RADOS) May 5, 2015
@gierschv
Copy link
Contributor Author

gierschv commented May 5, 2015

@stevvooe Indeed, for now it requires the librados to build it.
I thought about adding a build tag using -tags. Do you guys prefer an environment variable passed when building, or a check if rados/librados.h is available? If so, should I add a separate shell script as done in the docker engine (i.e. hack/make.sh), or add it here directly in the Makefile (e.g. by adding something like DOCKER_BUILDTAGS=$(shell echo '\#include <rados/librados.h>' | gcc -E - &> /dev/null || echo 'exclude_rados'))

@stevvooe
Copy link
Collaborator

stevvooe commented May 5, 2015

@gierschv I think explicit build tags are the right approach. No need for a separate build script, as that is outside the scope of this PR. Just make sure the build tag is easy to use and let's add some documentation to building.md.

@dotnwat
Copy link

dotnwat commented May 5, 2015

@gierschv is it possible to reference a specific tag or branch for go-ceph from dependencies such as this pull request? I would like to avoid cutting a stable release since the API is still be hashed out, but would be happy to cut a branch or tag since it looks like we have more than a couple users now.

@gierschv gierschv force-pushed the driver-rados branch 4 times, most recently from 2abc046 to 3bc9587 Compare May 20, 2015 01:25
@gierschv
Copy link
Contributor Author

@noahdesu @dmp42 @stevvooe Finally fixed setup script for circle. Thanks Olivier for the debug access :-)

This driver implements the storagedriver.StorageDriver interface and
uses Ceph Object Storage as storage backend.

Since RADOS is an object storage and no hierarchy notion, the
following convention is used to keep the filesystem notions stored in
this backend:

* All the objects data are stored with opaque UUID names prefixed
  (e.g. "blob:d3d232ff-ab3a-4046-9ab7-930228d4c164).
* All the hierarchy information are stored in rados omaps, where the
  omap object identifier is the virtual directory name, the keys in
  a specific are the relative filenames and the values the blob
  object identifier (or empty value for a sub directory).

  e.g. For the following hierarchy:

     /directory1
     /directory1/object1
     /directory1/object2
     /directory1/directory2/object3

  The omap "/directory1" will contains the following key / values:
    - "object1" "blob:d3d232ff-ab3a-4046-9ab7-930228d4c164"
    - "object2" "blob:db2e359d-4af0-4bfb-ba1d-d2fd029866a0"
    - "directory2" ""

  The omap "/directory1/directory2" will contains:
    - "object3" "blob:9ae2371c-81fc-4945-80ac-8bf7f566a5d9"

* The MOVE is implemented by changing the reference to a specific
  blob in its parent virtual directory omap.

This driver stripes rados objects to a fixed size (e.g. 4M). The idea
is to keep small objects (as done by RBD on the top of RADOS) that
will be easily synchronized accross OSDs. The information of the
original object (i.e total size of the chunks) is stored as a Xattr
in the first chunk object.

Signed-off-by: Vincent Giersch <vincent.giersch@ovh.net>
@stevvooe
Copy link
Collaborator

LGTM!

Do we want this to ship with the official registry? Do we need to make adjustments to the dockerfile to ensure this works?

@gierschv
Copy link
Contributor Author

@stevvooe I can change the Dockerfile if we ship the drive with the registry :) Please let me know, I'll make the changes.

@stevvooe
Copy link
Collaborator

@gierschv Want to do that in a separate PR?

@gierschv
Copy link
Contributor Author

@stevvooe ok, I'll do that.

stevvooe added a commit that referenced this pull request May 30, 2015
Storage Driver: Ceph Object Storage (RADOS)
@stevvooe stevvooe merged commit 318af0b into distribution:master May 30, 2015
@gierschv gierschv deleted the driver-rados branch June 1, 2015 09:40
@RyanDeng
Copy link

RyanDeng commented Jun 8, 2015

@gierschv I still got error while make

../github.com/noahdesu/go-ceph/rados/conn.go:5:29: fatal error: rados/librados.h: No such file or directory

Is that you missed add // +build include_rados in /registry/storage/driver/rados/rados.go and rados_test.go? Since the error didn't appear after I added this line

@gierschv
Copy link
Contributor Author

gierschv commented Jun 8, 2015

@RyanDeng This tag is present in the package main, so the rados package should only be imported if the tag is present. I'll check for the test.

@RyanDeng
Copy link

RyanDeng commented Jun 8, 2015

@gierschv Thanks for looking into this. I saw the tag in distribution/cmd/registry/rados.go so I'm also curious why here the error appeared. Could be some missing in my GOPATH

@stevvooe
Copy link
Collaborator

stevvooe commented Jun 8, 2015

@RyanDeng @gierschv I think the issue is that the tests are still built when using the makefile. Perhaps, the build flag needs to be added to the test files. You can safely ignore this error when running a build.

@RyanDeng
Copy link

RyanDeng commented Jun 9, 2015

@stevvooe that makes sense. Thanks for your advice.

@stevvooe
Copy link
Collaborator

stevvooe commented Jun 9, 2015

@gierschv @RyanDeng Would it be possible to get this worked out in a PR?

@RyanDeng
Copy link

RyanDeng commented Jun 9, 2015

@stevvooe @gierschv Please review it. Thanks

@farcaller
Copy link

Would be nice to have some basic documentation along with this, in terms of what's needed to run the backend properly.

So far I've tried adding /etc/ceph/ceph.conf from my cluster and making a one-user keychain at /etc/ceph/keychain, passing in pool and user names, and getting stuck at api error -1.

@stevvooe
Copy link
Collaborator

stevvooe commented Aug 3, 2015

@farcaller @yadutaf Please don't comment on closed or merged issues.

thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Apr 22, 2021
Storage Driver: Ceph Object Storage (RADOS)
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Jan 19, 2022
Storage Driver: Ceph Object Storage (RADOS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.