]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
9 years agolibrgw: fix many rgw_file return codes
Matt Benjamin [Tue, 10 Nov 2015 14:23:06 +0000 (09:23 -0500)]
librgw: fix many rgw_file return codes

This should all be -(POSIX), or at any rate negative.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't abuse fs_private
Matt Benjamin [Tue, 10 Nov 2015 00:19:52 +0000 (19:19 -0500)]
librgw: don't abuse fs_private

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: introduce RGW_LOOKUP_FLAG_CREATE
Matt Benjamin [Sun, 8 Nov 2015 23:54:58 +0000 (18:54 -0500)]
librgw: introduce RGW_LOOKUP_FLAG_CREATE

The current API relies on rgw_lookup and rgw_lookup_filehandle to
return file handle instances, and like POSIX, needs to deal in some
way with the NFS/POSIX open-for-create concept.

For now, allow rgw_lookup to return the canonical instance for an
object being created, i.e., if the option RGW_LOOKUP_FLAG_CREATE
is passed.  (I added an RGW_OPEN_FLAG_CREATE also, but it doesn't
do anything.)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add getattr unit tests, restructure
Matt Benjamin [Sun, 8 Nov 2015 23:11:37 +0000 (18:11 -0500)]
librgw: add getattr unit tests, restructure

The fids1, fids2 vectors were confusing, as fids2 mapped the
objects in the union of all buckets.

Now there's a matrix of <bucket,object>, and it's trivial to
scan the objects in any one bucket.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: handle a 3 cases in rgw_getattr
Matt Benjamin [Sun, 8 Nov 2015 01:40:51 +0000 (20:40 -0500)]
librgw: handle a 3 cases in rgw_getattr

Only the object case is mostly correct.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: handle rgw_lookup in the root (minimally)
Matt Benjamin [Sun, 8 Nov 2015 01:06:08 +0000 (20:06 -0500)]
librgw: handle rgw_lookup in the root (minimally)

In addition, check real return code from RGWStatRequest.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: change validity check for rgw_lookup
Matt Benjamin [Sat, 7 Nov 2015 21:18:18 +0000 (16:18 -0500)]
librgw: change validity check for rgw_lookup

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add RGWStatObjRequest and use it
Matt Benjamin [Sat, 7 Nov 2015 20:46:52 +0000 (15:46 -0500)]
librgw: add RGWStatObjRequest and use it

* implement a stat operation over RGWGetObj (returning early)
* use stat to validate rgw_lookup
* use stat to implement rgw_getattr

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add diagnostic dump_buckets() call.
Matt Benjamin [Fri, 6 Nov 2015 21:55:57 +0000 (16:55 -0500)]
librgw: add diagnostic dump_buckets() call.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fail RGWLibFS::authorize() on user-by-id lookup failure
Matt Benjamin [Fri, 6 Nov 2015 21:55:15 +0000 (16:55 -0500)]
librgw: fail RGWLibFS::authorize() on user-by-id lookup failure

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement rgw_vfsstat
Matt Benjamin [Thu, 5 Nov 2015 16:09:24 +0000 (11:09 -0500)]
librgw: implement rgw_vfsstat

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rgw_mkdir and rgw_create return addresses
Matt Benjamin [Thu, 5 Nov 2015 15:15:41 +0000 (10:15 -0500)]
librgw: rgw_mkdir and rgw_create return addresses

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: pass struct rgw_fh_hk by reference
Matt Benjamin [Wed, 4 Nov 2015 23:26:11 +0000 (18:26 -0500)]
librgw: pass struct rgw_fh_hk by reference

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: always add struct before rgw_file_handle in rgw_file.h
Matt Benjamin [Wed, 4 Nov 2015 22:51:24 +0000 (17:51 -0500)]
librgw: always add struct before rgw_file_handle in rgw_file.h

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: bring back lookup_handle()
Matt Benjamin [Wed, 4 Nov 2015 21:20:45 +0000 (16:20 -0500)]
librgw: bring back lookup_handle()

Now as a member of RGWLibFS, and exposed via rgw_lookup_handle()
for use by library clients.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_gp: check test state before closing null fh handle
Matt Benjamin [Wed, 4 Nov 2015 17:48:03 +0000 (12:48 -0500)]
librgw_file_gp: check test state before closing null fh handle

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement intrusive filehandle cache
Matt Benjamin [Tue, 3 Nov 2015 01:31:53 +0000 (20:31 -0500)]
librgw: implement intrusive filehandle cache

The cache is keyed on a hash of bucket name, plus a hash of the
object name.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add common/cohort_lru.h
Matt Benjamin [Mon, 2 Nov 2015 19:41:26 +0000 (14:41 -0500)]
librgw: add common/cohort_lru.h

This a cache-line-friendly set of primitives for

a) shareded, intrusive maps based on boost::intrusive
b) an LRU system based on them

The system uses per-lane (shard) locks.  Lane count, front cache
size, and lock type are template params.

Initially, use this in preference to an unshareded map or hashtable,
in new RGW code.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file: release file handles
Matt Benjamin [Sat, 31 Oct 2015 00:26:58 +0000 (20:26 -0400)]
librgw_file: release file handles

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw_file_gp: don't leak a buffer::list
Matt Benjamin [Fri, 30 Oct 2015 21:41:39 +0000 (17:41 -0400)]
librgw_file_gp: don't leak a buffer::list

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: checksum verify writev/readv read-after-write
Matt Benjamin [Fri, 30 Oct 2015 21:27:22 +0000 (17:27 -0400)]
librgw: checksum verify writev/readv read-after-write

The changes to GET_OBJECT and PUT_OBJECT test options are needed,
since they are (re) writing the same object.

Sadly, READV_AFTER_WRITEV is failing at page offset 7.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: really make hexdump optional, set resid in readv unit test
Matt Benjamin [Fri, 30 Oct 2015 20:19:35 +0000 (16:19 -0400)]
librgw: really make hexdump optional, set resid in readv unit test

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix 2 dout problems
Matt Benjamin [Fri, 30 Oct 2015 17:28:25 +0000 (13:28 -0400)]
librgw: fix 2 dout problems

* rgw_file.cc needed to include include/assert.h AFTER all rgw
  includes, for some reason

* use *_dout syntax as target of bl.hexdump in lbrgw_file_gp.cc

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: try-implement rgw_readv/rgw_writev
Matt Benjamin [Thu, 29 Oct 2015 22:03:16 +0000 (18:03 -0400)]
librgw: try-implement rgw_readv/rgw_writev

The model in the rgw_readv call is the caller owns the struct rgw_uio,
and uses it to pass uio_offset.

The caller returns the rgw_uio filled out, and provides indirectly
rgw_uio->uio_vio (the full private data is at uio->uio_p1 on return,
the caller (p==private) must not touch it.  The caller returns
private data in rgw_readv_release() when finished.

Meanwhile rgw_writev is atomic.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: improve rgw_write and add WRITE_READ_VERIFY
Matt Benjamin [Thu, 29 Oct 2015 18:58:47 +0000 (14:58 -0400)]
librgw: improve rgw_write and add WRITE_READ_VERIFY

Update rgw_write to return bytes written as an OUT argument,
use and verify in PUT test.

A new WRITE_READ_VERIFY test writes 16 checksummed, 64K data pages
to the object when --bulk specified.  The returned write value is
checked, but pages not re-read (yet).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove junk prints
Matt Benjamin [Thu, 29 Oct 2015 16:42:31 +0000 (12:42 -0400)]
librgw: remove junk prints

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: set RGWGetObj::get_data = true, for great justice
Matt Benjamin [Thu, 29 Oct 2015 16:36:19 +0000 (12:36 -0400)]
librgw: set RGWGetObj::get_data = true, for great justice

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rework library CephContext* and init
Matt Benjamin [Thu, 29 Oct 2015 15:49:06 +0000 (11:49 -0400)]
librgw: rework library CephContext* and init

Remove duplicated init step.  Just reference the global
Ceph context for the library instance(s).

The immediate effect of this is to bring the (correctly initialized)
global context into all call paths, which (e.g.) fixes debug
log prints within subsystems.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: dispatch RGWDeleteRequest in object branch in rgw_unlink().
Matt Benjamin [Wed, 28 Oct 2015 23:10:10 +0000 (19:10 -0400)]
librgw: dispatch RGWDeleteRequest in object branch in rgw_unlink().

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: implement RGWGetObjRequest
Matt Benjamin [Wed, 28 Oct 2015 21:53:06 +0000 (17:53 -0400)]
librgw: implement RGWGetObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: declare RGWDeleteObjRequest
Matt Benjamin [Tue, 27 Oct 2015 21:57:13 +0000 (17:57 -0400)]
librgw: declare RGWDeleteObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: declare RGWGetObjRequest
Matt Benjamin [Tue, 27 Oct 2015 21:45:14 +0000 (17:45 -0400)]
librgw: declare RGWGetObjRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix RGWPutObj s->content_length
Matt Benjamin [Tue, 27 Oct 2015 17:02:59 +0000 (13:02 -0400)]
librgw: fix RGWPutObj s->content_length

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agoRGWPutObjRequest: fix get_data()
Matt Benjamin [Tue, 27 Oct 2015 16:23:37 +0000 (12:23 -0400)]
RGWPutObjRequest: fix get_data()

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agorgw log: disambiguate 'Read AccessControlPolicy' (logs)
Matt Benjamin [Tue, 27 Oct 2015 14:31:53 +0000 (10:31 -0400)]
rgw log: disambiguate 'Read AccessControlPolicy' (logs)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add --prelist to gp to prime cache
Matt Benjamin [Tue, 27 Oct 2015 14:08:09 +0000 (10:08 -0400)]
librgw: add --prelist to gp to prime cache

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix rgw_open param names and invocation
Matt Benjamin [Tue, 27 Oct 2015 12:41:52 +0000 (08:41 -0400)]
librgw: fix rgw_open param names and invocation

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: avoid illegal rele()
Matt Benjamin [Tue, 27 Oct 2015 00:24:26 +0000 (20:24 -0400)]
librgw: avoid illegal rele()

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't create/delete in librgw_file.cc (unit test)
Matt Benjamin [Mon, 26 Oct 2015 23:57:58 +0000 (19:57 -0400)]
librgw: don't create/delete in librgw_file.cc (unit test)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fs->root_fh is a pointer (and assign it)
Matt Benjamin [Mon, 26 Oct 2015 23:44:58 +0000 (19:44 -0400)]
librgw: fs->root_fh is a pointer (and assign it)

Assign and expose the expanded root_fh indirectly from the mounted
root filesystem structure.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: bucket names can be const
Matt Benjamin [Mon, 26 Oct 2015 22:13:46 +0000 (18:13 -0400)]
librgw: bucket names can be const

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: reify root handles
Matt Benjamin [Mon, 26 Oct 2015 21:18:06 +0000 (17:18 -0400)]
librgw: reify root handles

Reify root handle, remove traces of legacy (counter) handles.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incremental RGWPutObj work and almost-complete RGWFH refactor.
Matt Benjamin [Mon, 26 Oct 2015 20:36:56 +0000 (16:36 -0400)]
librgw: incremental RGWPutObj work and almost-complete RGWFH refactor.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agoxxHash: build internally
Matt Benjamin [Mon, 26 Oct 2015 19:56:06 +0000 (15:56 -0400)]
xxHash: build internally

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add ZPage/ZPageSet abstraction (gp unit tests)
Matt Benjamin [Mon, 26 Oct 2015 02:33:54 +0000 (22:33 -0400)]
librgw: add ZPage/ZPageSet abstraction (gp unit tests)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agoxxHash: add as submodule
Matt Benjamin [Mon, 26 Oct 2015 02:07:03 +0000 (22:07 -0400)]
xxHash: add as submodule

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rgw_file_handle refactor, plus get/put
Matt Benjamin [Sun, 25 Oct 2015 21:22:43 +0000 (17:22 -0400)]
librgw: rgw_file_handle refactor, plus get/put

Implement encapsulation of RGWFileHandle in rgw_file_handle,
so return these from rgw_lookup(), add new rgw_fh_rele() to release
internal state.

Currently the rgw_fh_rele just deletes, in future might be extended
with refcnt support.

Implement the first (atomic) stage of i/o using GET and PUT, add a
new librgw_file_gp test driver for this.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add options for bucket name, multi create, delete
Matt Benjamin [Fri, 23 Oct 2015 22:23:13 +0000 (18:23 -0400)]
librgw: add options for bucket name, multi create, delete

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix acl assignment in RGWCreateBucket_OS_Lib
Matt Benjamin [Fri, 23 Oct 2015 21:56:33 +0000 (17:56 -0400)]
librgw: fix acl assignment in RGWCreateBucket_OS_Lib

The logic to create a default S3 policy in
RGWCreateBucket_OS_Lib::get_params() was essentially correct, but
failed to store the resulting policy on the current request.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't fake hostname (real hostname isn't used yet)
Matt Benjamin [Fri, 23 Oct 2015 17:42:28 +0000 (13:42 -0400)]
librgw: don't fake hostname (real hostname isn't used yet)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: don't allow running rgwfile tests as anon
Matt Benjamin [Fri, 23 Oct 2015 17:18:12 +0000 (13:18 -0400)]
librgw: don't allow running rgwfile tests as anon

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: partial delete/unlink support
Matt Benjamin [Fri, 23 Oct 2015 16:39:05 +0000 (12:39 -0400)]
librgw: partial delete/unlink support

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: return result code from execute_request
Matt Benjamin [Thu, 8 Oct 2015 17:12:48 +0000 (13:12 -0400)]
librgw: return result code from execute_request

Update rgw_mkdir and rgw_readdir to use it.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix uri, read_permissions virtual for create-bucket
Matt Benjamin [Thu, 8 Oct 2015 15:11:40 +0000 (11:11 -0400)]
librgw: fix uri, read_permissions virtual for create-bucket

* set uri in rgw_mkdir (duh)
* RGWCreateBucketRequest should override RGWHandler::read_permissions
  to return 0

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: block in create bucket, rgw_mkdir
Matt Benjamin [Wed, 7 Oct 2015 21:19:29 +0000 (17:19 -0400)]
librgw: block in create bucket, rgw_mkdir

Unit test runs, doesn't...seem to create a bucket.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: re-derive rgw_os_lib family
Matt Benjamin [Wed, 7 Oct 2015 18:23:13 +0000 (14:23 -0400)]
librgw: re-derive rgw_os_lib family

* shorten names to match files
* remove derivation through rgw_rest intermediates

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: s/rgw_rest_lib.{h,cc}/rgw_os_lib.{h,cc}
Matt Benjamin [Wed, 7 Oct 2015 17:50:26 +0000 (13:50 -0400)]
librgw: s/rgw_rest_lib.{h,cc}/rgw_os_lib.{h,cc}

There is no longer an explicit (e.g., inherited) dependency on REST
implementations.

The remaining coupling (via RGWLibEnv, and struct req_state), can
be factored out later.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolirgw: call RGWHanlder_Lib::init_from_header
Matt Benjamin [Wed, 7 Oct 2015 17:26:19 +0000 (13:26 -0400)]
lirgw: call RGWHanlder_Lib::init_from_header

Call this from the general RGWLibRequest init() method, after
descendant header_init() has run.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: cleanups, incremental ListBuckets fixes
Matt Benjamin [Tue, 6 Oct 2015 23:29:25 +0000 (19:29 -0400)]
librgw: cleanups, incremental ListBuckets fixes

1. remove unused RGWLibRequestEnv code marked to delete
2. restore call to RGWHandler::authorize
3. provide RGWLibRequest::authorize implementing it
   ** the implementation is incomplete, and shows need to expand
      the initial mount auth to deal with keystone, etc
4. since acl check is still not quite right in verify_permissions()
   disable this again (temporarily)
5. fix dout_subsys of rgw_request.cc

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: forward cmdline args to librgw_create
Matt Benjamin [Tue, 6 Oct 2015 20:59:58 +0000 (16:59 -0400)]
librgw: forward cmdline args to librgw_create

Verified w/-d.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove disabled RGWLib RGWREST::get_handler()
Matt Benjamin [Tue, 6 Oct 2015 20:41:47 +0000 (16:41 -0400)]
librgw: remove disabled RGWLib RGWREST::get_handler()

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: cleanups in process_request
Matt Benjamin [Tue, 6 Oct 2015 20:36:06 +0000 (16:36 -0400)]
librgw: cleanups in process_request

* remove disabled S3 authorize step (user authorized on mount)
* re-enable op->verify_permission()

Skipping the latter makes RGW unhappy (1s stalls on each request),
but no objects are listing yet.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: pull RGWUserinfo user into RGWLibRequest
Matt Benjamin [Tue, 6 Oct 2015 20:14:08 +0000 (16:14 -0400)]
librgw: pull RGWUserinfo user into RGWLibRequest

Also, return result from process_request(req, io) to caller.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: cache RGWUserInfo in rgw_fs private handle
Matt Benjamin [Tue, 6 Oct 2015 19:36:32 +0000 (15:36 -0400)]
librgw: cache RGWUserInfo in rgw_fs private handle

The private RGWLibFS type holds a RGWUserInfo, and
calls rgw_get_user_info_by_access_key and verifies the returned
secret, checks for suspended user, on rgw_mount.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: split RGWUserInfo from struct req_state
Matt Benjamin [Mon, 5 Oct 2015 19:42:35 +0000 (15:42 -0400)]
librgw: split RGWUserInfo from struct req_state

The immediate purpose is to permit auth caching in RGWLib, but
it seems likely that this will be useful for general req_state
de-bloatification.

For now, all request processing paths put a RGWUserInfo on the
stack, so the lifetime of the object is unchanged from when it was
an expanded member.  A later change will introduce caching of
the objects.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: RGWFileHandle and RGWLibFS
Matt Benjamin [Mon, 5 Oct 2015 18:58:09 +0000 (14:58 -0400)]
librgw: RGWFileHandle and RGWLibFS

Experimentally reframe the C interface objects as subobjects in
private internal types.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fixes for RGWListBucketRequest callback
Matt Benjamin [Mon, 5 Oct 2015 15:13:19 +0000 (11:13 -0400)]
librgw: fixes for RGWListBucketRequest callback

The cached req_state is still not correct at RGWOp::execute().

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: untested RGWLibListBucketsRequest and caller.
Matt Benjamin [Sun, 4 Oct 2015 23:40:47 +0000 (19:40 -0400)]
librgw: untested RGWLibListBucketsRequest and caller.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fix 2 bugs in RGWListBuckets, remove scaffolding
Matt Benjamin [Sun, 4 Oct 2015 18:51:52 +0000 (14:51 -0400)]
librgw: fix 2 bugs in RGWListBuckets, remove scaffolding

1. the prior commit had authorize cognate with S3
1.1 which may be right
1.2 but maybe not for each request
1.3 and lacked priming/forged auth data

The forging of auth data is now easy, but the interesting part is
caching and efficiently attaching it so I paused, and

2. disabled auth, which was now overriding and anonymizing all
requests (good!)

3. fixed another instance of reinterpret_cast where (one of)
dynamic_cast or a saved pointer descendant request (avoids a runtime
check, so will add later) is needed

4. fixed bad offset argument to rgw_readdir

The list bucket facility now works, modulo non-auth.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: process_request prologue fixups
Matt Benjamin [Sat, 3 Oct 2015 20:28:16 +0000 (16:28 -0400)]
librgw: process_request prologue fixups

* initialize RGWEnv with required HTTP_HOST (incorrectly!)
* assign req_state::cio (not really correctly)
* remove incorrect delete of RGWOp, which no longer alloc'd

Now runs, but don't see buckets.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: reprocess process_request
Matt Benjamin [Sat, 3 Oct 2015 17:58:24 +0000 (13:58 -0400)]
librgw: reprocess process_request

Refactor RGWLib variant of process_request(...) as a (actually 2,
one which puts an RGWLibIO on the stack) member function of
RGWLibProcess.

Also replace extern abort_early with static inline abort_req(),
since the rgw_rest extern assumes HTTP/REST.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: wire up RGWLibFrontend enqueue and exec operations
Matt Benjamin [Fri, 2 Oct 2015 21:51:22 +0000 (17:51 -0400)]
librgw: wire up RGWLibFrontend enqueue and exec operations

Adds the missing bits of RGWLibProcess and RGWLibFrontend, and
calls them from rgw_readdir().

Clients can call enqueue_req() to route a request through the
work queue, or execute_req() to run it inline.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove RGWLibRequestEnv
Matt Benjamin [Fri, 2 Oct 2015 20:30:21 +0000 (16:30 -0400)]
librgw: remove RGWLibRequestEnv

The REST cognates of this class largely deal with HTTP, and is 1-1
w/request, client-io, op, etc.  At worst, its functions can be absorbed
into one of those (client-io, initially).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: wire up request initializers
Matt Benjamin [Fri, 2 Oct 2015 16:50:47 +0000 (12:50 -0400)]
librgw: wire up request initializers

There's some tricky overloading induced by multiple inheritance,
also this design makes repeatedly shared handles in current framework
very visible.

The most important non-boilerplate is in descendant RGWRequest
initializers (rgw_lib.h), which need to set up req_state appropriately
for their action/op.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: re-derive RGWLibRequest
Matt Benjamin [Thu, 1 Oct 2015 22:26:37 +0000 (18:26 -0400)]
librgw: re-derive RGWLibRequest

Derive RGWLibRequest from RGWRequest, RGWHandler.

This strategy defines the dialect of ops following the derivation
pattern for RGWLib actions to be their handler.

On the negative side, RGWLibRequest has struct req_state* s from two
ancestors.  Since we don't use virtal inheritance, the only overhead is
the extra copy, and need for disambiguation in the direct descendants
(this is only 1 method in 1 file, atm).

The motivation is as follows.  RGWHandler currently has 3 responsibilities:
1) op-chasing; 2) to hold authorize() and read_permissions() methods
3) to initialize req_state

RGWLib actions have no use for the op-chasing behavior, and authorize()
and read_permissions() methods are arguably more naturally expressed as
methods on the actions.  Meanwhile struct req_state appears to be a
candidate for refactoring into the RGWRequest class hierarchy, which would
mean that initalization probably should move from hanlder to request, as
well.  Refactoring req_state is would be quite intrusive, so this change
defers that for later, but keeps the 1-1 mappings from request to
handler at 0 cost.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: rename RGWHandler_REST_Lib (sic), inherit from RGWHandler
Matt Benjamin [Thu, 1 Oct 2015 20:53:23 +0000 (16:53 -0400)]
librgw: rename RGWHandler_REST_Lib (sic), inherit from RGWHandler

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove dead code, add comments in RGWLib
Matt Benjamin [Thu, 1 Oct 2015 20:35:30 +0000 (16:35 -0400)]
librgw: remove dead code, add comments in RGWLib

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: refactor RGWHandler HTTP/REST methods into _REST
Matt Benjamin [Thu, 1 Oct 2015 19:58:27 +0000 (15:58 -0400)]
librgw: refactor RGWHandler HTTP/REST methods into _REST

This change renames RGWHandler_ObjStore to RGWHandler_REST, and
moves the following protected, virtual, RESTful methods:

  virtual bool is_obj_update_op() { return false; }
  virtual RGWOp *op_get() { return NULL; }
  virtual RGWOp *op_put() { return NULL; }
  virtual RGWOp *op_delete() { return NULL; }
  virtual RGWOp *op_head() { return NULL; }
  virtual RGWOp *op_post() { return NULL; }
  virtual RGWOp *op_copy() { return NULL; }
  virtual RGWOp *op_options() { return NULL; }

and the following public, virtual methods not needed by the
prototyped RGWLibHandler:

  virtual RGWOp *get_op(RGWRados *store);
  virtual void put_op(RGWOp *op);

from RGWHandler into the renamed class.

The motivation for this change is to allow a (maybe) transitional
refactoring stage which allows to implement the RGWHandler
interface, without implementing get_handler() or get_op(), put_op(),
or op_*().

Prior refactoring (which could be reversed) moved authorize() and
read_permissions() into the precursor RGWHandler_ObjStore

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: call rcb in RGWListBucketsRequest operator()
Matt Benjamin [Sat, 23 Jan 2016 19:27:39 +0000 (14:27 -0500)]
librgw: call rcb in RGWListBucketsRequest operator()

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add user_id to RGWListBucketsRequest
Matt Benjamin [Thu, 1 Oct 2015 16:53:00 +0000 (12:53 -0400)]
librgw: add user_id to RGWListBucketsRequest

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: header inclusion fix, actually call callbacks
Matt Benjamin [Thu, 1 Oct 2015 12:52:07 +0000 (08:52 -0400)]
librgw: header inclusion fix, actually call callbacks

Fix public header inclusion from rgw_file.h internal header, which
of course needs to see the public interface.

Finish up the minimal RGWListBucketsRequest callback functor.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incremental
Matt Benjamin [Wed, 30 Sep 2015 21:34:50 +0000 (17:34 -0400)]
librgw: incremental

* move RGWLibRequest decls into rgw_file.h
* revise include guard token in rados/rgw_file.h (avoid conflict)
* save CephContext* in RGWLibRequest
* initialize RGWLibRequest cct in ctor, req_state in process_request

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: s/gen_request/enqueue_req/;
Matt Benjamin [Wed, 30 Sep 2015 20:15:59 +0000 (16:15 -0400)]
librgw: s/gen_request/enqueue_req/;

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: replace RGWHandler::put_op() in RGWLib path
Matt Benjamin [Wed, 30 Sep 2015 18:46:04 +0000 (14:46 -0400)]
librgw: replace RGWHandler::put_op() in RGWLib path

The method just called delete on the RGWOp pointer.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: move authorize() and read_permissions()
Matt Benjamin [Wed, 30 Sep 2015 17:55:26 +0000 (13:55 -0400)]
librgw: move authorize() and read_permissions()

all RGW_Auth_S3::authorize() from process_request().  Add a
read_permissions() primitive replacing RGWHandler's version in
RGWLibRequest.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: pre-assign req->op (as self), avoid dynamic_cast
Matt Benjamin [Wed, 30 Sep 2015 14:00:14 +0000 (10:00 -0400)]
librgw: pre-assign req->op (as self), avoid dynamic_cast

It would be nice to have some compile-type assistance w/the
dual RGWOp & RGWLibRequest boilerplate.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: breakthrough cleanups (I think)
Matt Benjamin [Wed, 30 Sep 2015 00:46:18 +0000 (20:46 -0400)]
librgw: breakthrough cleanups (I think)

* RGWLib bucket ops prototyped
* progress made on RGWOp+RGWRequest unification (RGWLib only)
* mostly-harmlessness of RGWHandler-free operation try-checked

The replacement for process_request is the next code to prototype--
RGWHandler-free operation, for great justice.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: incremental rgw_rest_lib internals
Matt Benjamin [Fri, 25 Sep 2015 18:27:09 +0000 (14:27 -0400)]
librgw: incremental rgw_rest_lib internals

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: include rgw_lib.h from rgw_rest.cc
Matt Benjamin [Wed, 23 Sep 2015 22:27:04 +0000 (18:27 -0400)]
librgw: include rgw_lib.h from rgw_rest.cc

RGWLibIO is forward declared in rgw_rest.h.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: tweaks to RGWREST::preprocess and fix a typo in RGWHandler_ObjStore_Lib defn.
Matt Benjamin [Fri, 11 Sep 2015 20:03:09 +0000 (16:03 -0400)]
librgw: tweaks to RGWREST::preprocess and fix a typo in RGWHandler_ObjStore_Lib defn.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agorefactor RGWClientIO
Matt Benjamin [Thu, 10 Sep 2015 17:21:17 +0000 (13:21 -0400)]
refactor RGWClientIO

In order to support direct/library clients, we want to
more fully decouple RGWOp processing from client HTTP
processing, since in the direct case, there is no HTTP
client.

This change tackles essentially just RGWClientIO, by moving
stream operations to a new subclass RGWStreamIO, and updating
the stream backends (e.g., SWIFT, S3) and REST handlers
accordingly.

In addition, the RGWLib backend is incrementally updated, with
RGWLibIO still deriving from the base RGWClientIO.  The RGWLib
path is incomplete as of this change, but is moving in the
direction of its own process_request call path (incomplete,
partly due to header conflicts that will be resolved in
subsequent commits).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: comments
Matt Benjamin [Wed, 9 Sep 2015 22:20:36 +0000 (18:20 -0400)]
librgw: comments

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: widen rgw_mount, open-code list buckets
Matt Benjamin [Wed, 9 Sep 2015 18:11:28 +0000 (14:11 -0400)]
librgw: widen rgw_mount, open-code list buckets

Widen rgw_mount(...) to take the library context, which from
there on follows struct rgw_fs.

Implement an open-coded version of list buckets in rgw_readdir(...),
which now...lists buckets.

The future home of this and the rest of the rgw_file impl. logic
looks to be a more fully elaborated RGWLib* class family.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add LOOKUP_BUCKETS and LIST_OBJECTS
Matt Benjamin [Wed, 9 Sep 2015 13:11:46 +0000 (09:11 -0400)]
librgw: add LOOKUP_BUCKETS and LIST_OBJECTS

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: add list bucket test
Matt Benjamin [Tue, 8 Sep 2015 23:46:33 +0000 (19:46 -0400)]
librgw: add list bucket test

The operation on store is missing, but interface works.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: test rgw_(u)mount(...)
Matt Benjamin [Tue, 8 Sep 2015 23:26:18 +0000 (19:26 -0400)]
librgw: test rgw_(u)mount(...)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: take keys in test
Matt Benjamin [Tue, 8 Sep 2015 23:12:24 +0000 (19:12 -0400)]
librgw: take keys in test

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: fe::init must create RGWLibProcess
Matt Benjamin [Tue, 8 Sep 2015 22:51:55 +0000 (18:51 -0400)]
librgw: fe::init must create RGWLibProcess

All evidence suggests RGWLibFrontend::init needs to create
an RGWLibProcess, and assign to pprocess.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: introduce struct rgw_fs
Matt Benjamin [Tue, 8 Sep 2015 21:48:11 +0000 (17:48 -0400)]
librgw: introduce struct rgw_fs

Pretending for a moment that we can definitely use the "mount"
based model, rgw_file like libcephfs requires a context reprsenting
the mounted fs.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
9 years agolibrgw: remove classes from extern, argv
Matt Benjamin [Tue, 8 Sep 2015 14:56:30 +0000 (10:56 -0400)]
librgw: remove classes from extern, argv

Remove class definitions from extern "C" block, which was
illogical.

Block in support for passing a C-style argument list to the
librgw_create library initializer, so code won't be tempted to
use one from librados.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>