Extract quorum-size calculation to utility method.

The behavior's the same as before; this just makes the code (IMHO) a
little easier to read.

Change-Id: Ie54d836d81af7410057219f60b72b840c9ce51b9
Refactor and add tests for db_replicator

* Create class for testing _repl_to_not and replicate_object fuctions to
  prevent duplication code by adding all preparation into setUp function.
* Move existed test function which testin _repl_to_not and
  replicate_object into created classes.
* Add tests for replicate_object and _repl_to_node functions.

Change-Id: I75ac7c6f0230e71bfb24328e44c33734b520b4cd
Record some simple object stats in the object auditor

Change-Id: I043a80c38091f59ce6707730363a4b43b29ae6ec
Revert "docfix apache2 now supports client chunked encodin"

This reverts commit 68cb91097b75a92237bd90caffcd405c3e83cb53

Just so this is not get forgotten in the tree...

We are using daemon mode and chunked is not supported in this mode.
Merge "Record some simple object stats in the object auditor"
Don't allow users to delete their own account.

- In keystoneauth we allowed authenticated users to delete their own
  account we are disallowing that and only allow users with reseller
  admin to do that for its own or for the others.
- Fixes bug 1177526.

Change-Id: I825c5a968e8eae0991915056825fe0e0c195647e
Fix flaky test.

test_DELETE_x_container_headers_with_more_container_replicas() would
sometimes fail, and it's because a test helper method was defaulting
to sorting the captured headers by X-Container-Partition. Well, in
tests we use FakeRing, and the partition is always 1, so that sorting
didn't buy us much. Now the sorting is done by X-Container-Device,
which actually differs meaningfully.

Change-Id: Ibe5b2fcd3f23280ed2caaa703111a98861331866
Make keystoneauth reseller_prefix check for _

- Automatically add underscore if there wasn't one already.
- This makes consistent with tempauth.
- Fixes bug 1198878.
- This should probably need to be mentioned in the release changelog for
  upgrades.

Change-Id: Ia82f14f82c380c7ed2ddd190116f1493e410cfbe
Allow floating point value for dispersion_coverage

For systems with very large numbers of partitions, 1% dispersion
coverage may simply be too much/take too long. This fix allows <1
values to be used for dispersion_coverage.

DocImpact

Change-Id: I5ed35b69754d55a410e66e658b3854de57c7666b
Merge "Revert "docfix apache2 now supports client chunked encodin""
make internal client metadata methods return dicts with lower case keys

Change-Id: I19ced30b6e92133766310f8e41286202607c5b4c
Move replication allow method to decorators

Remove logic of allowed methods list from object, container and account
servers. Instead of it add replicator decorator to utils and use new
decorator for REPLICATE methods in object/account/container servers.
This decorator mark method as special for usfor use only by the
replication.

If the option replication_server is not used, then this mechanism is not
enabled. If the replicaton_server option is set (not None) then the
respective server is a replicator (option value is True) and should use
ONLY the methods marked for replication server using the decorator, or
it is a normal server type and should NOT use methods marked for the
replication server.

Change-Id: I1041b31413cd0c39000317cc57a8c27816e1dfe8
Merge "Make keystoneauth reseller_prefix check for _"
Merge "Extract quorum-size calculation to utility method."
Start using Hacking

Instead of blacklisting Hacking globally,
only blacklist those that currently occur frequently
(for a later followup patch), and fix the rest. In
detail:

H101  Use TODO(NAME)
H201  no 'except:' at least use 'except Exception:'
H231  octal number 022 should be written as 0o22
H401  docstring should not start with a space
H701  Empty localization string

Change-Id: Ib3b3d56b68d1cf15d3b67ac9749fcbdb876dc52a
Fix make_pre_authed_request function to not fail when path arg is None.

The default value for the path arg to the function is None. However, if
the path arg is not set or is set to None an exception is generated when
the path value is passed to urllib.unquote(). The function doc states that
if path is not provided then the value in the env is used, so fix is to
implement this behaviour.

Change-Id: I085124acb6ef3cecb2375bb97d27996e0c6fd36e
Fixes: bug #1198149
Add documentation about flake8+hacking.

- Fixes bug 1201431.

Change-Id: If025a41caf3a629b9efb4d67c53c423796d37a91
Fix unit tests to properly marked deleted files

The unit tests were playing fast and loose with the tombstone marker,
where the test framework was setting up a DiskFile object which had
its data written to the .ts file, not the .data file. This behavior
did not reflect how the interfaces to DiskFile were supposed to
work.

Change-Id: Idd6e8882e062ba2e13489f14189223ab4158677c
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Refactor auditors to rely on expected gen names

Refactor the various auditors to rely on the audit_location_generator
yielding tuples containing paths with the expected suffix.

We also fix the exception handling for container_sync to not expect a
broker object (since the act of creating a broker object can raise an
exception).

For the object auditor we removed an unneeded check for disk_file
since get_data_file_size() will raise DiskFileNotExist under the same
condition (raises code coverage slightly).

Change-Id: I11d405e629063177ef21543b75e9076da1a03b61
Merge "Move replication allow method to decorators"