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
Fix unit tests failing in some cases

TestZeroCopy used to fail when 'localhost' resolved to an ipv6
address. https://github.com/eventlet/eventlet/issues/8

Also, "test_container_sync_realms.py:TestUtils.test_os_error"
used to fail when unit tests were run as root user. This is
because despite os.chmod(), a root user still has permission
to access the file and hence OSError is not raised.

Change-Id: Ife80b203358557999734515261814ce76c0e00cd
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Merge "Add new features to swift-drive-audit"
Merge "Fix unit tests failing in some cases"
swift-drive-audit: pass logger to get_errors

Closes-Bug: #1379767
Change-Id: Ie8ec5e9ffb977ab39aedeb878e6aae9f0b62530b
Fix rebalance crash post-2.1.0 upgrade.

If you had a builder file from an earlier version of Swift (before
6d77c37) and you attempted to rebalance it with a new version of Swift
(after 6d77c37, before this commit), you could get a crash.

Commit 6d77c37 changed the calculation for parts_wanted slightly
(round up instead of round down), so if a rebalance is attempted
without recomputing parts_wanted, then swift-ring-builder crashes.

The crash only occurs if the first command run is "rebalance". Adding
a device, removing a device, changing a device's weight, or changing
replica count (basically, anything that gives you a reason to
rebalance) will all cause parts_wanted to be recalculated, so
subsequent rebalances will succeed.

Change-Id: I6f7a69701f74546a00d3183aa7763e9e708408c9
Merge "swift-drive-audit: pass logger to get_errors"