Let eventlet.wsgi.server log tracebacks when eventlet_debug is enabled

The "logging" available in eventlet.wsgi.server/BaseHTTPServer doesn't
generally suite our needs, so it should be bypassed using a NullLogger in
production.  But in development it can be useful if tracebacks generated from
inside eventlet.wsgi (say a NameError in DiskFile.__iter__) end up in logs.
Since we already have eventlet_debug parsed inside of run_server we can skip
the NullLogger bypass and let stuff blast out to STDERR when configured for
development/debug logging.

Change-Id: I20a9e82c7fed8948bf649f1f8571b4145fca201d
Add new features to swift-drive-audit

This patch adds two new features to swift-drive-audit. The first
is an option in the drive-audit.conf file that allows the operator
to prevent the drives ever being unmounted automatically,
regardless of the amount of errors present. This could be of
benefit in very small systems consisting of only one or two drives
where the operator would like to manually unmount/fix the
particular drive(s) and minimise any potential downtime.

The second is another option in drive-audit.conf that allows the
operator to select a recon directory. This directory will then
have a drive.recon file which will keep an up-to-date record of
the swift drives and any errors associated with them. An example
of the output would be as follows:

{"/srv/node/disk2": "0", "/srv/node/disk3": "25", "/srv/node/disk0": "0",
"/srv/node/disk1": "0", "/srv/node/disk10": "0", "/srv/node/disk7": "0",
"/srv/node/disk4": "137", "/srv/node/disk5": "0", "/srv/node/disk8": "0",
"/srv/node/disk9": "0", "/srv/node/disk6": "0", "/srv/node/disk11": "60"}

This would allow the operator to monitor the errors on the swift
drives without having to spend time searching through logs. Also, if
this is accepted, it should be possible to add an option to
swift-recon that would keep track of this at a system level.

Change-Id: Ib5dacf8622b7363e070c274c7c30c8ead448a055
updated hacking rules

1) Added comment for H231, which we were already enforcing. H231
is for Python 3.x compatible except statements.

2) Added check for H201, which we were enforcing in reviews
but waiting on hacking checks to be updated. H201 is for bare
except statements, and the update in upstream hacking is to
support the "  # noqa" flag on it.

The H201 check catches some existing bare excepts that are fixed.

Change-Id: I68638aa9ea925ef62f9035a426548c2c804911a8
Provides proper error handling on builder unpickle

This patch provides the necessary error handling while unpickling
a builder file. Earlier if a builder file is empty/invalid/corrupted,
the stacktrace was shown to user with an exit code of 1. This fixes it
to show a user-friendly message and also returns the exit code of 2,
indicating there was a failure.

Change-Id: I51eb24702c422299629f8053d4591dd10f5863f8
Closes-Bug: #1370680
Fix up the return value of launch()

This is "obviously" the right thing to do, except of course it's
pure sugar: the return value is not used anywhere. Except if someone
has a script that imports the whole thing somehow and then does
isinstance(dict). Because that is so much easier than submitting
a patch, I can imagine someone, somewhere doing that.

The fix came in a patch by dfg, see review 121851.

Change-Id: I39ddf70dc2d027b7db6e31097400248dc66eb137
Limit partition movement when adding a new tier

When adding a new tier (region, zone, node, device) to an existing,
already balanced ring all existing partitions in the existing tiers of
the same level are gathered for reassigning, even when there is
not enough space in the new tier. This will create a lot of unnecessary
replication traffic in the backend network.

For example, when only one region exists in the ring and a new region is
added, all existing parts are selected to reassign, even when the new
region has a total weight of 0. Same for zones, nodes and devices.

This patch limits the number of partitions that are choosen to reassign
by checking for devices on other tiers that are asking for more
partitions.

Failed devices are not considered when applying the limit.

Co-Authored By: Florent Flament <florent.flament-ext@cloudwatt.com>
Change-Id: I6178452e47492da4677a8ffe4fb24917b5968cd9
Closes-Bug: 1367826
Fix ring-builder crash.

If you adjust the replica count after adding devices but before the
first rebalance, the ring builder would crash.

To reproduce:

    $ swift-ring-builder crashy.builder create 8 3 1
    $ swift-ring-builder crashy.builder add r1z1-10.1.1.1:6000/sda1 1
    $ swift-ring-builder crashy.builder set_replicas 5
    $ swift-ring-builder crashy.builder rebalance

Change-Id: Id91cf8680961ccf6e3db153577e99cad545bee9d
Ensure sys.exit called in fork_child after exception

Currently, the fork_child() function in auditor.py does not
handle the case where run_audit() encounters an exception
properly.

A simple case is where the /srv directory is set
with permissions such that the 'swift' user cannot access it.
Such a situation causes a os.listdir() to return an OSError
exception.  When this happens the fork_child() process does not
run to completion and sys.exit() is not executed.  The process
that was forked off continues to run as a result.  Execution goes
back up to the audit_loop function which restarts the whole process.  The
end result is an increasing number of processes on the system
until the parent is terminated.  This can quickly exhaust the
process descriptors on a system.

This change wraps run_audit() in a try block and adds an
exception handler that prints what exception was encountered.
The sys.exit() was moved to a finally: block so that it will
always be run, avoiding the creation of zombies.

Change-Id: I89d7cd27112445893852e62df857c3d5262c27b3
Closes-bug: 1375348
Fix metadata overall limits bug

Currently metadata limits are checked on a per request basis. If
multiple requests are sent within the per request limits, it is
possible to exceed the overall limits.  This patch adds an overall
metadata check to ensure that multiple requests to add metadata to
an account/container will check overall limits before adding
the additional metadata.

Change-Id: Ib9401a4ee05a9cb737939541bd9b84e8dc239c70
Closes-Bug: 1365350
Merge "Ensure sys.exit called in fork_child after exception"
Merge "updated hacking rules"
Merge "Fix metadata overall limits bug"
Merge "Limit partition movement when adding a new tier"
updated AUTHORS and CHANGELOG for 2.2.0

Change-Id: I6c0bc1570f6a48439de5a029a86f1b582f30f8a6
Merge "Let eventlet.wsgi.server log tracebacks when eventlet_debug is enabled"
Merge "Fix up the return value of launch()"
Merge "Provides proper error handling on builder unpickle"
Merge "updated AUTHORS and CHANGELOG for 2.2.0"
Imported Translations from Transifex

Change-Id: I31b5e6b0f2922150902e1bfa52144302ee0c7a8e
Fix minor typo

Fixes minor typo in one method and adds missing parameter in other
method. Only checked swift/container/reconciler.py for now.

Change-Id: I5c648010f09b6e4b1fb0380bc97b266e680602f8