Handle X-Copy-From header in account_quota mw

Content length of the copied object
is checked before allowing the copy
request according to the account
quota set by Reseller.

Fixes: bug #1200271
Change-Id: Ie4700f23466dd149ea5a497e6c72438cf52940fd
Optimizations to Ring.get_more_nodes()

When we're looking for handoffs, we first try to span all the regions,
then zones, then devices. However, the search loops would always go
over a big subset of the ring, regardless of whether or not there was
anything left to find.

In particular, this would result in long runtimes for the first call
to get_more_nodes() if you didn't have more regions than replicas, as
the region-search loop would chew through a ton of devices and not
find any (since there weren't any). Now we do a little arithmetic,
think about the pigeonhole principle a little bit, and bail out when
there's nothing left to find, rather than waiting until there's no
space left to search.

Similar changes were made for the different-zone and different-device
search loops.

On a 4800-device test ring (4 regions, 5 zones each, 20 node each, 12
drives each), the time to get all handoffs dropped to about 5% of its
previous value (a 95% improvement).

More usefully, on a 1200-device test ring (same as above but only 1
region), the time to get just the first 6 handoffs dropped to about
0.01% of its original runtime, or a 10,000x speedup.

Fixes bug 1225018.

Change-Id: I4c77094186f0032a3e19a099a1a0e71b2ba06719
Add a user variable to templates

This is a common configuration option and allows devstack (and others)
to configure a mod_wsgi user to run the daemon process.

Change-Id: Idf134b3bc6b08e3c3a80dde8830d5a4f3da5a06c
Fixes: bug 1226346
Refactor common/utils methods to common/ondisk

Place all the methods related to on-disk layout and / or configuration
into a new common module that can be shared by the various modules
using the same on-disk layout.

Change-Id: I27ffd4665d5115ffdde649c48a4d18e12017e6a9
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Add HTTPSeeOther(303) and HTTPTemporaryRedirect(307) to swob

RFC 1945 and RFC 2068 specify that the client is not allowed to change the
method on the redirected request.  However, most existing user agent
implementations treat 302 as if it were a 303 response, performing a GET on
the Location field-value regardless of the original request method. The status
codes 303 and 307 have been added for servers that wish to make unambiguously
clear which kind of reaction is expected of the client.

HTTP/1.1 RFC for 302: http://tools.ietf.org/html/rfc2616#section-10.3.4
HTTP/1.1 RFC for 307: http://tools.ietf.org/html/rfc2616#section-10.3.8

Change-Id: I354e2f4f3e3eb6a1553b3d9c60b613d8f0c37531
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Merge "Optimizations to Ring.get_more_nodes()"
Merge "Handle X-Copy-From header in account_quota mw"
Merge "Refactor common/utils methods to common/ondisk"
Merge "Add HTTPSeeOther(303) and HTTPTemporaryRedirect(307) to swob"
Fix probe tests

Change-Id: I03573bf24baf031b1874c3ff2e2d89d34473c266
add seek() to CompressingFileReader

Change-Id: I33d9119684497b53101db3bc380953e86bdf25f0
Log x-copy-from when it could be useful

Change-Id: Ia28a9b47213f848ab5ea59572e14ac710ed881e3
Merge "add seek() to CompressingFileReader"
Merge "Add a user variable to templates"
SLOs broken for range requests

Change-Id: I21175a4be0cda9a8a98c425bff11c80895cd6d3e
Fix unsuitable assertTrue

assertTrue accepts a parameter msg which will be printed when
assertion fails, usually msg is a str. This patch fixes unsuitable
usage of assertTrue which set msg to bool type True.

Change-Id: I731f8ea553c935eba0e112ffded16f41a5ea86c0
Fixes-Bug: #1226374
Merge "SLOs broken for range requests"
Merge "Log x-copy-from when it could be useful"