basho/riak_cs — pull request #857 by kuenishi (2014-05-14 23:17:31+00:00)
Title: Ensure no mp uploads remaining in bucket creation and deletion

(rebased version of #856)

There was a security issue that flaws remaining multipart uploads,
where an newly created bucket may include unaborted or uncompleted
multipart uploads which was created in previous epoch of the bucket
with same name. This commit fixes it by:

- on creating buckets;
- check if live multipart exists
- if exists, return 500 failure to client
- on deleting buckets;
- try to clean up all live multipart remains
- check if live multipart remains (in stanchion)
- if exists, return 409 failure to client

- after upgrading from 1.4.x (or former) to 1.5.0;
- run `riak_cs_console:cleanup_orphan_multipart/0` or
`riak_cs_console:cleanup_orphan_multipart/1` in an
attached console to cleanup all buckets
- there might be a time period until above cleanup
finished, where no client can create bucket if
unfinished multipart upload remains under deleted
bucket. You can find [critical] log if such bucket
creation is attempted.

This commit also inclues:
- cut out bucket related operations from riak_cs_utils to riak_cs_bucket
- riak_test (riak_cs_buckets_test) to check bucket related tests