Commit Graph

48927 Commits

Author SHA1 Message Date
Matt Benjamin
3fcdd946b6 librgw: partial delete/unlink support
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:57 -05:00
Matt Benjamin
9fb454ac61 librgw: return result code from execute_request
Update rgw_mkdir and rgw_readdir to use it.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:56 -05:00
Matt Benjamin
c43384c09d 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>
2016-02-12 12:04:55 -05:00
Matt Benjamin
460794ef1a 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>
2016-02-12 12:04:54 -05:00
Matt Benjamin
ceb2b0e97d 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>
2016-02-12 12:04:53 -05:00
Matt Benjamin
83bed47f4c 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>
2016-02-12 12:04:52 -05:00
Matt Benjamin
cbcb641ef8 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>
2016-02-12 12:04:51 -05:00
Matt Benjamin
6dae209ceb 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>
2016-02-12 12:04:50 -05:00
Matt Benjamin
e29562954b librgw: forward cmdline args to librgw_create
Verified w/-d.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:48 -05:00
Matt Benjamin
55bb8d347a librgw: remove disabled RGWLib RGWREST::get_handler()
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:47 -05:00
Matt Benjamin
ed7dc88e79 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>
2016-02-12 12:04:46 -05:00
Matt Benjamin
ec96809cd0 librgw: pull RGWUserinfo user into RGWLibRequest
Also, return result from process_request(req, io) to caller.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:45 -05:00
Matt Benjamin
7e21e2386d 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>
2016-02-12 12:04:44 -05:00
Matt Benjamin
6688bc1cce 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>
2016-02-12 12:04:43 -05:00
Matt Benjamin
290e78812f librgw: RGWFileHandle and RGWLibFS
Experimentally reframe the C interface objects as subobjects in
private internal types.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:42 -05:00
Matt Benjamin
f9382815a3 librgw: fixes for RGWListBucketRequest callback
The cached req_state is still not correct at RGWOp::execute().

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:41 -05:00
Matt Benjamin
9c4de57800 librgw: untested RGWLibListBucketsRequest and caller.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:40 -05:00
Matt Benjamin
80a56f2004 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>
2016-02-12 12:04:39 -05:00
Matt Benjamin
c44f19c438 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>
2016-02-12 12:04:38 -05:00
Matt Benjamin
0b614a1b92 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>
2016-02-12 12:04:37 -05:00
Matt Benjamin
143bd14fe8 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>
2016-02-12 12:04:35 -05:00
Matt Benjamin
84fd9aa884 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>
2016-02-12 12:04:34 -05:00
Matt Benjamin
4867148531 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>
2016-02-12 12:04:33 -05:00
Matt Benjamin
259be80cac 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>
2016-02-12 12:04:32 -05:00
Matt Benjamin
d1d4535d46 librgw: rename RGWHandler_REST_Lib (sic), inherit from RGWHandler
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:31 -05:00
Matt Benjamin
ac37941943 librgw: remove dead code, add comments in RGWLib
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:04:30 -05:00
Matt Benjamin
4af5aeacb3 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>
2016-02-12 12:02:02 -05:00
Matt Benjamin
bf10462939 librgw: call rcb in RGWListBucketsRequest operator()
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:58:14 -05:00
Matt Benjamin
748a6e56ac librgw: add user_id to RGWListBucketsRequest
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:58:12 -05:00
Matt Benjamin
adade479de 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>
2016-02-12 11:58:11 -05:00
Matt Benjamin
850873005a 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>
2016-02-12 11:58:10 -05:00
Matt Benjamin
987821c733 librgw: s/gen_request/enqueue_req/;
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:58:09 -05:00
Matt Benjamin
9d6c78ff8b 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>
2016-02-12 11:58:08 -05:00
Matt Benjamin
ab2349c492 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>
2016-02-12 11:58:07 -05:00
Matt Benjamin
7e8ecc58ac 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>
2016-02-12 11:58:06 -05:00
Matt Benjamin
f4994c84b1 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>
2016-02-12 11:58:05 -05:00
Matt Benjamin
f1720d882d librgw: incremental rgw_rest_lib internals
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:58:04 -05:00
Matt Benjamin
35a5e5016a 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>
2016-02-12 11:58:03 -05:00
Matt Benjamin
5cc096d040 librgw: tweaks to RGWREST::preprocess and fix a typo in RGWHandler_ObjStore_Lib defn.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:58:02 -05:00
Matt Benjamin
df8f3920c7 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>
2016-02-12 11:58:01 -05:00
Matt Benjamin
79d3879cf3 librgw: comments
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:59 -05:00
Matt Benjamin
2903d754dd 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>
2016-02-12 11:57:58 -05:00
Matt Benjamin
a719a0bdd3 librgw: add LOOKUP_BUCKETS and LIST_OBJECTS
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:57 -05:00
Matt Benjamin
f6a95fc19b librgw: add list bucket test
The operation on store is missing, but interface works.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:56 -05:00
Matt Benjamin
5521c7abaa librgw: test rgw_(u)mount(...)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:55 -05:00
Matt Benjamin
84e21660cb librgw: take keys in test
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:54 -05:00
Matt Benjamin
9eeba4fb28 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>
2016-02-12 11:57:53 -05:00
Matt Benjamin
d1bbfe9442 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>
2016-02-12 11:57:52 -05:00
Matt Benjamin
fae842d2a1 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>
2016-02-12 11:57:51 -05:00
Matt Benjamin
eb2ac51c07 librgw: fix type of rgw_readdir eof argument (C-11 bool)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 11:57:50 -05:00