rgw: clean up ops initialization, completion

ops init() was a reminiscent of an old design. Since we're
allocating new op for every request we can just init everything
in the constructor.

We now add a new complete() stage in request processing. By
default complete() will call send_response().

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: better protocols separation

This change will make it easier to add new protocol
handlers. We now determine which protocol handler to
use by querying the list of existing protocol handlers
whether the query belongs to that protocol. If so,
then just run the specific protocol's handler code.
Separated some mixed s3 and swift code into the specific
handlers.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
OSDCap: remove grants added during failed parsing

Parsing has side effects that must be undone if it fails.  A
capability string like 'allow rwx pool=bar' will add the grant for
'allow rwx' and then fail on the 'pool=bar'. Thus, the client will
effectively have 'rwx' permissions on all pools.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: fix typo in comment

The grammar uses auid, not uid.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: fix output operators for caps

OSD_CAP_ANY is not a flag, but a value (0xff) that will always
be true when treated as a mask with a non-zero rwxa_t.

Don't duplicate the rwxa_t output operator in the OSDCapSpec output
operator, just use it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCaps: fix allow_all()

OSD_CAP_ANY is not a mask. Treating it as one made any allowance
equivalent to 'allow *'.

Fixes: #3228
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
test: add more OSDCap unit tests

Check that allow_all() returns false when 'allow *' is not specified.
This would have caught #3228.
Add tests for the output operators as well.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Makefile.am: recompile small file instead of libosd for unit test

Linking with libosd requires a lot more recompilation
when testing changes to OSDCap.cc.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: parse 'pool=<poolname>' in addition to 'pool <poolname>'

This was used in releases before 0.49, and was the documented way
to use it in several places, so support it again for backwards
compatibility.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
test: remove commented out test cases

These are copied from non-commented out ones a few lines above.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: parse spaces explicitly

This is necessary to avoid matching things like "allow r poolfoo".
It's also needed to distinguish "allow r class-read" from
"allow r class -read".

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
doc: Completed a journal configuration reference. Journaler is separate.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Added journal settings to the config TOC.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Minor updates to filesystem settings.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Removed a setting we can ignore for now.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Added stack diagram for rgw. Noted NO MDS. Corrected namespace comment.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Removed languages from librados in tech-specific stack diagrams.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
FileStore: copy paste error _do_copy_range

CID 728419: Copy-paste error (COPY_PASTE_ERROR)At (2): "srcoff" in "actual !=
(int64_t)srcoff" looks like a copy-paste error. Should it say "dstoff" instead?

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: assert auth is not end in _compare_scrubmaps

This should make coverity happy.

Signed-off-by: Samuel Just <sam.just@inktank.com>
obj_bencher: fix leak in error path

CID 717076: Resource leak (RESOURCE_LEAK)At (26): Variable "newContents" going
out of scope leaks the storage it points to.

Signed-off-by: Samuel Just <sam.just@inktank.com>