Optimize instance queries in compute manager

Some instance queries against the db through the conductor can be
optimized to return a reduced set of instances as needed for the job
at hand. Most of these are part of periodic tasks, so the win is
kind of big.

Compute methods where queries can be made more efficient:

_get_instances_on_driver
_poll_rebooting_instances
_poll_rescued_instances
_reclaim_queued_deletes
_run_image_cache_manager_pass

Resolves bug 1169970.

Change-Id: I7c2fab48944e34765b3fff8ce10bc64a5cd826c8
Improve unit tests for DB archiving.

Test all tables that have a uuid column and no constraints that make
generic testing difficult, rather than just a couple of tables.

Make the teardown code more generic.

Add test_archive_deleted_rows_2_tables, which tests that we can
archive rows from two tables in one call.

Change-Id: If08aac3c6869820c72dfcb1bf6d22d19c2995c8a
Fix whitespace issue in indent

Extra whitespace cleanup in nova/cells/messaging.py

Change-Id: I000b2585ab9018af42f25bc83e7e0b0c2bd92e5a
Don't raise unnecessary stack traces in EC2 API

exception.EC2APIError exceptions are always expected, so no reason to have a
LOG.exception when one is raised.  Furthermore nova.api.ec2.ec2_error already
logs the exception so the duplicate log statement is just removed

Fix Bug 1180973

Change-Id: I4b42a9a764f6e15bb94a383e8a725d52d7436bd7
Cast `size` to int before comparison

`_get_and_check_image_metadata` pulls `size` from the image, which
comes in as string, but fails to convert it to an integer before
comparing with the flavor's `root_gb` size. This patch adds the cast
along with some test coverage for this method.

Fixes bug 1180159

Change-Id: I92bc9d6a808e49173d806e434cb145c751c8314a
Remove locals() from messages in virt/disk/api.py

No functional changes, just removing something which annoyed me
when I read the code.

Change-Id: Ia2d232d6ee2e61d3785b57798391474b8e99dee1
The vm_state should not be modified until the task is complete.

Several methods in nova.compute.api alter the vm_state value before
proceeding with the actual work. The initial vm_state may be changed to
something other than the initial vm_state (which is a problem: since we
do not know what the initial state actually was, we cannot reasonably
recover and set the corresponding ERROR if a problem with the operation
occurs).

Actually done:

Removed vm_state update before executing task

Changed methods:
- reboot
- pause
- unpause
- suspend
- resume
- rescue
- unrescue

Fixes: bug #1158509
Change-Id: I5ee7aebf3c4831dd577ed5ab9aa155095152f8a8
baremetal: drop 'prov_mac_address' column

bm_nodes.prov_mac_address is no longer used. So drop it.

Change-Id: I3c7294da8f62581aba8c948171cb02f80cf054ef
Merge "Remove locals() from messages in virt/disk/api.py"
Fix flake8 errors in anticipation of flake8.

Change-Id: I7c713f95eb974d5998d2be50722df7d6f64a234e
Switch to flake8+hacking.

Remove a bunch of local custom scripts. Replace with configurable
external tools.
Use local hacking checks for nova specifics.

Change-Id: I75a01375ba0ec36d2ff05abc47abe0a3f225eda5
Remove usage of locals() for formatting from nova.api.*

Using of locals() for formatting string is a nasty thing because:
1) It is not so clear as using explicit dicts
2) It could produce hidden errors during refactoring
3) Changing name of variable causes change in message
4) Creating a lot of unused variables

fixes bug 1171936
Change-Id: I293d7ebb875f65cce322d4938d1ae323f3aded8d
Merge "Fix flake8 errors in anticipation of flake8."
Merge "Switch to flake8+hacking."
Merge "Remove usage of locals() for formatting from nova.api.*"
Use strict=True instead of `is_valid_boolstr`

Oslo's `bool_from_string` learned the `strict` keyword which allows
callers to detect invalid boolean values, so we can use that instead
of having a new Nova-specific function.

Change-Id: I61bfa4029897c7304bd54d6cdae9f9a9bc4c1f78
Remove unnecessary parens in test_volumes

Return statements were using unnecessary parens, this removes them.

Change-Id: Iee63ffa826d323a89493e16c1b9592bae74e350f
Clean up test_api_samples a bit

Remove all unnecessary return statements in our tests

Change-Id: Ic01a211e48781241cac3fdef75760a3a6dafadc6
Strip exec_dirs prefix from rootwrap filters

Make the rootwrap filters more portable by removing
the explicit exec_dirs prefix from them. This allows
a binary to be installed in any of the exec_dirs and
still be used by rootwrap, which improves cross-distro
portability.

Change-Id: Ieccb8c480e0e116a976d0920ab900305a5615015
Update mailmap

Update mailmap to reflect new email address that I will be committing
under

Change-Id: I9f8610ad982ed678c0b367b3a1768578739b2543