Fix unbalanced rings after initial creation.

Sometimes you'd make a ring that should have a good balance (~= 1),
but it would come out with a poor balance (>= 90). Rebalancing a
couple times would fix it, but it shouldn't be necessary to do that.

This was due to a bug in the ring builder's rebalance() method where,
when placing a replica for a partition, it would pick *one of* the
tiers with the lowest number of replicas, but the choice was made
without regard to parts_wanted.  Now rebalancing pays attention to the
drives' parts_wanted attributes, so the tier with the emptiest drive
gets the replica.

(Also fixed a typo in a completely unrelated comment.)

Change-Id: I1821f15170f0ed212b0ad7c81b97031540ab4460
[tempauth] update token if its value changes or expires

In current codes, tempauth token will be updated only when it expires. In
token's lifetime, any changes in tempauth config file doesn't update token,
which means if you update your config file and restart proxy server, the
role in runtime might not change. So a good fix is updating token when
it changes or expires.

fixes bug #1201678

Change-Id: Ieb080e87268e16d0a2e5896431aa41fcedc7a900
Defer computation of available methods until needed.

In practice this data is almost only ever needed if we're throwing an
HTTPMethodNotAllowed error, so we can avoid computing on every single
request to the proxy server.

Change-Id: I2abafa3aeb63ca6974dfcf6f31c864c049681f37
Small test cleanups from b63089d.

There was nothing there worth holding up the review over, but there
were a couple little things in the test that confused me.

Change-Id: I85c9c1bdb12de210c198d0d38404a1cf9f73adbb
Only set PYTHON_EGG_CACHE if it isn't already set

Change-Id: I6503c80a236a1720562377d04313ee2688336c85
Fix changes in XML that broke old clients

Certain old clients that shall not be named do not like some of the
recent changes to the xml output for container listings.  This fixes
those changes.  If we want to change any of the xml output, then we
should do it in another API version.  I'm not sure if any of these
changes in the XML were put in any documentation, but if they were, they
should be changed back.

DocImpact

Change-Id: I983332ca9d620a9a539be26bc6655df9b2ef87ed
Two small performance improvements to header generation

These both apply to the proxy servers:

First, instead of consturction a dict just to use with `.update()` simply set a
set of keys in the headers dict.

Second, generating the headers for proxy requests once, no matter how many
backend servers are accessed (instead of once per backend server), they all get
the same headers.

Change-Id: Ib42bf7750e175a6ad9b777fa35655380feeafb93
Merge "Small test cleanups from b63089d."
Merge "Two small performance improvements to header generation"
Made the signature of HeaderKeyDict.__init__ match dict's

Change-Id: I75dc6228bc39de44f58d7ae9beb8ca3bf24b100f
Allow users to extract tars to containers with ACLs set

This fixes bug: https://bugs.launchpad.net/swift/+bug/1203182 (well
it should :) I don't have keystone installed but the same issue
existed with tempauth).

Change-Id: I6f4045f484b27c0153a9244e0dbf2641cbc9e84e
Fix string format error in DiskFile close

Add a 'get_lines_for_level' method to FakeLogger in order to actually
validate the log line format string is valid for the given args.

Change-Id: Ib2559ddf5c9d89e17c6ac08d26cc46a4193a2df2
Always format messages sent to FakeLogger

Change-Id: I0268587cce0d47b69470b7c4f9224e180fb98f77
Pep8 the probe tests (1 of 12)

Change-Id: I20571816d9838e125a60a2775219b2f3cbb36ddd
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 the functional tests (2 of 12)

Change-Id: Id8a9ae0c82052baccf8bdacd6aaeb76a76ad2ce1
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 the functionalnosetests tests (3 of 12)

Change-Id: Ia88356d6d36d1c4914f706652aaac5c840a79f13
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 unit test modules for hacking and one liners (4 of 12)

Address all the "hacking" lines that are flagged, and all the modules
that just have one item flagged.

Change-Id: I372a4bdf9c7748f73e38c4fd55e5954f1afade5b
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 unit test modules w/ <= 10 violations (5 of 12)

Change-Id: I8e82c14ada52d44df5a31e08982ac79cd7e5c969
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 unit test modules w/ <= 20 violations (6 of 12)

Change-Id: I7317beb97e1530cb18c62da55ccf4c64206ff362
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 unit tests in middleware > 20 violations (7 of 12)

Change-Id: I9dfae1a473a8212ef25dcc01e338d8bdade7ef4e
Signed-off-by: Peter Portante <peter.portante@redhat.com>