Setup localization properly

To start translation of swift, we need to initially import the
translation file - and place it at the proper place so that
the usual CI scripts can handle it.

The proper place is for all python projects
$PROJECT/locale/$PROJECT.pot, so move locale/$PROJECT.pot to the new
location and regenerate the file.

Update setup.cfg with the new paths.

Further imports will be done by the OpenStack Proposal bot.

Change-Id: Ide4da91f2af71db529f4a06d6b1e30ba79883506
Partial-Bug: #608725
Closes-Bug: #1082805
Avoid usage of insecure mktemp() function

This patch eliminates the use of the deprecated and insecure
tempfile.mktemp() function.  It has been replaced with secure
alternatives where temporary files are actually required.

Change-Id: I0a13d6d44cd1abc4b66fa33f39eea407617a01d5
SecurityImpact
Closes-bug: #1348869
fix my name in AUTHORS

My author name is my gmail account name, change it to my real name.

Change-Id: Iafd94f694f7d007c54de086941309b119683f6cb
Small Fix for FakeServerConnection

Current FakeServerConnection might cause 499 error
in some unit tests because sent (put) data will be
overridden by new one every time.
e.g. When calling conn.queue.put() twice and more in
an object PUT sequence, we can use only a last chunk as
the body. This fixes it to merge all chunks as a body.

Change-Id: I463e9e2b454e3f3eb26950b3af4c8b8167a9a971
Combine acc/cont put_* methods and fix their lock problem.

The container backend is supposed to build a pending file and,
when it gets to a certain size, flush it all at once into the
sqlite db. Before this fix, many concurrent threads would ask
what the pending file size is to see if they should flush
instead of just appending to the pending file. The problem is
that many would ask, find it's too big, and try to get a lock.
The first one wins, flushes, but all the other waiting threads
still think they have to flush- which is a much slower opertaion
than just the append. This change gets the lock first and makes
sure that merge_items is only called when the pending file is full.

Change-Id: I29cfa13a48c8f7d16dd414b2288d50461adbafd2
Fix last_modified_date_to_timestamp on non-UTC systems

Before, we were calling datetime.datetime.strftime('%s.%f') to convert
a datetime to epoch seconds + microseconds. However, the '%s' format
isn't actually part of Python's library. Rather, Python passes that on
to the system C library, which is typically glibc. Now, glibc takes
the '%s' format and helpfully* applies the current timezone as an
offset. This gives bogus results on machines where UTC is not the
system timezone. (Yes, some people really do that.)

For example:

    >>> import os
    >>> from swift.common import utils
    >>> os.environ['TZ'] = 'PST8PDT,M3.2.0,M11.1.0'
    >>> float(utils.last_modified_date_to_timestamp('1970-01-01T00:00:00.000000'))
    28800.0
    >>>

That timestamp should obviously be 0.

This patch replaces the strftime() call with datetime arithmetic,
which is entirely in Python so the system timezone doesn't mess it up.

* unhelpfully

Change-Id: I56855acd79a5d8f2c98a771fa9fd2729e4f490b1
Check for change before container replicator updates db

As described in the related bug report, unnecessary updates
to the container db during replication can impact object
object GET performance in certain circumstances.

This patch changes swift/container/replicator.py so that
calls to merge_timestamps and update_reconciler_sync
are conditional on values having actually changed.

Related-Bug: 1332025
Change-Id: If498251656500ed7a3d7ca4b109ea1079b8513c2
warn against sorting requirements

Change-Id: I64ae9191863564e278a35d42ec9cd743a233028e
Closes-Bug: 1365061
Spelling mistakes corrected in comments.

Change-Id: Ibbd7511c3a2b08519feb4db18eca6e000603ea32
Merge "fix my name in AUTHORS"
Merge "warn against sorting requirements"
Merge "Avoid usage of insecure mktemp() function"
Merge "Spelling mistakes corrected in comments."
Merge "Small Fix for FakeServerConnection"
Change method _sort_key_for to static

This method does not reference to any attribute of this class, so it's better
to change it to classstatic.

Change-Id: I3ea0ca83cb29ceae9afb20da0c9817a9b044c084
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
Error limit the right node on object PUT

If any node had an error on object PUT, the proxy would count the
error against the last-connected-to node instead of the one with the
error. Now it counts the error against the right node.

Change-Id: I884eb73cebe0c723473a6d5e390a148fcad0d3ed
Pay attention to all punctual nodes

The proxy sends requests to all storage nodes, but it only needs a
quorum of them to respond before the proxy can, in turn, respond to
the client. Thus, it gets quorum, and then briefly waits to see if the
remainder of the storage nodes respond before giving up on them.

However, the proxy was not paying any attention to the responses from
the non-quorum storage nodes. This would lead to some odd behavior,
like a container PUT where the backends returned (201, 201, 202) would
become a 201 to the client, but the permutation (201, 202, 201) would
become 202. Further, on object PUT, if the last node responded with an
error code, that error wouldn't count towards error-limiting.

The fix is quite simple: after getting quorum, the make_requests()
method was calling a method that returns responses from the remainder
of the nodes, but it was ignoring that return value and making up
responses with dummy values instead. Now, prior to making up dummy
responses, the proxy first uses the responses it already has, and only
fills in dummy responses for nodes that really didn't respond in time.

Change-Id: I0206b6b2272b0e7dcc80fb6c51840d8dae25cee2
Merge "Fix last_modified_date_to_timestamp on non-UTC systems"
Merge "Combine acc/cont put_* methods and fix their lock problem."
Merge "Error limit the right node on object PUT"