Deterministic, repeatable serialization for rings.

The (account|container|object).ring.gz files contain, among other
things, a JSON-encoded dictionary. This change simply makes the JSON
serializer sort the keys of that dictionary so that two
Python-identical rings will result in two bytewise-identical ring
files. Also, to get repeatable compression, we lock down the timestamp
in the gzip output stream to a fixed value. (There's a timestamp value
in a gzip stream header; by default, gzip.GzipFile sticks time.time()
in there.)

This only works on Python 2.7; on 2.6, the 'mtime' argument to
gzip.GzipFile() is unsupported. Don't worry, serialization still works
on 2.6. It just doesn't always produce the same bytes for the same
ring.

Change-Id: Ide446413d0aeb78536883933fd0caf440b8f54ad
Fixes 'not in' operator usage

Fixes bug 1110150

Change-Id: I6c48553564b1809a7ae5de9f778d93dccbe157ae
Merge "Deterministic, repeatable serialization for rings."
Optimize the ring builder's _reassign_parts() method.

Another ring builder optimization.  Profiling revealed hotspots in many
calls to min() and list.sort() in _reassign_parts().  That method didn't
get exercised in my last optimization pass because that pass targeted a
rebalance where nothing really moved around.

This time, I wrote a script which created a fresh ring, added a bunch of
devices, did the initial balance, deleted some devices, balanced, and
added some more back in.

Results from homebrew Python 2.7.3 on OS X 10.8.2 Macbook Pro
(bare-metal):

 BEFORE:
 Using part-power = 18, adding 600 devices, removing 100, then adding 300 more...
 NOT Profiling to 'initial_balance.prof'
   wall-time delta: 131.33s
 NOT Profiling to 'deleting_200_rebalance.prof'
   wall-time delta: 25.67s
 NOT Profiling to 'first_rebalance.prof'
   wall-time delta: 62.00s

 AFTER:
 Using part-power = 18, adding 600 devices, removing 100, then adding 300 more...
 NOT Profiling to 'initial_balance.prof'
   wall-time delta: 28.04s
 NOT Profiling to 'deleting_200_rebalance.prof'
   wall-time delta: 9.35s
 NOT Profiling to 'first_rebalance.prof'
   wall-time delta: 16.41s

The driver script I used is available here:
https://gist.github.com/adb982aec6f0709f1273

Change-Id: I17e270acb12b5e4d4bbb1e34d8867dea90678961
Basic container quotas

Add a new middleware implementing some basic container quotas.

Quotas are subject to several limitations: eventual consistency, the timeliness
of the cached container_info (60 second ttl by default), and it’s unable to
reject chunked transfer uploads that exceed the quota (though once the quota
is exceeded, new chunked transfers will be refused).

However, they get most of the way to container quotas fairly inexpensively.

Quotas are set by adding meta values to the container, and are validated when
set:

  X-Container-Meta-Quota-Bytes: Maximum size of the container, in bytes.
  X-Container-Meta-Quota-Count: Maximum object count of the container.

DocImpact

Change-Id: I77cfbf6dc231a2e522bd67328e4c082424a93eee
Merge "Basic container quotas"
Merge "Fixes 'not in' operator usage"
Merge branch 'master' of git://github.com/openstack/swift