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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>