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
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
Made the signature of HeaderKeyDict.__init__ match dict's

Change-Id: I75dc6228bc39de44f58d7ae9beb8ca3bf24b100f
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>
Pep8 remaining unit test modules in common (8 of 12)

Change-Id: I6fa3291eeacb7ee5c095ad9bccbd33f027bf11e3
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 container test_sync and test_diskfile (9 of 12)

Change-Id: I469e3b75b6846fddb5e9d2b8317506129836d0a6
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Pep8 account and proxy server unit tests (10 of 12)

Change-Id: Ib83d164997b0d98be921c8b4857caa2429344aa4
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Made the HTTP comparisons slightly more idiomatic

This way they are more obviously range tests

Change-Id: Ia782a8f5ddb5958f9da828e2caadf0a8e3c3ff11
Merge "Only set PYTHON_EGG_CACHE if it isn't already set"
Merge "Made the HTTP comparisons slightly more idiomatic"