Adding ability to specify the libvirt cache mode for disk devices

In past versions of Nova it was possible to explicitly configure
the cache mode of disks via the libvirt XML template. The current approach
makes this a derived setting of either “none” or “writethrough” based
on the support of O_DIRECT. Whilst this provides a good set of default
settings it removes the ability of the cloud provider to use other
modes such as “writeback” and “unsafe” which are valuable in certain
configurations.

This change allows the cache mode to be specified on a per-disk type
basis. If a disk type does not have a cache mode specified then the
default behaviour remains unchanged.

DocImpact

bug 1086386

Change-Id: I3d296fe0b4b9b976db02db90ad69fd299cd2096a
sync oslo log updates

this helps address the issue where syslog gets overloaded and we
loose the ability to figure out what's going on in clients like
nova-manage

Change-Id: Iedde5ed4e8e23e204be4fa7a19e9514acf2ebf86
Use a fake coverage module instead of real one.

Actually loading the coverage module was leading to odd concurrency
conditions where it was interfering with mocked calls. This changes
to stub out the coverage class with a fake one so that we don't have
to worry about collisions. It also modifies the coverage class to be
created lazily so it isn't automatically started at import time.
Finally it removes the hack in run_tests.sh ignoring the coverage
tests.

Fixes bug 1131023

Change-Id: I39de434454f8b0903f6311e731e215a93027bc91
Add module prefix to exception types

Change-Id: If1b0eccc9c75553fdbb3280ab742b1f4d6ea7861
Migration 144: Fix drop index statement

When dropping an index related to a column, we need to make sure that
the `Index` object is removed the `Table` object, otherwise a subsequent
`drop_column` call to that same column will error out as it tries to
re-drop the index.

Change-Id: Ie6533b011ead1bc5dd2542041d50eb82e5654a55
BM Migrations 2 & 3: Fix drop_column statements

`drop_column` takes a string not a `Column` object.

Change-Id: I01d537f78e40a20b762439087a13e104b9d18d46
Fix migration snake-walk.

The original code was not actually running `downgrade` because it
attempt to `downgrade` to the current version.

The fix is to downgrade to the current_version - 1.

Change-Id: I69484039269a17e343404bff195a6f84af56972c
Add `post_downgrade` hook for migration tests.

This can be used by tests to assert the state of the database after a
`downgrade` has been run.

This patch also renames `_prerun_#` to `_pre_upgrade` to match.

Change-Id: Id2a100a8270835d1ef6f9908ff5b89e2b531bb3c
Migration 146: Execute delete call.

The original code constructed but did not execute the call to delete the
availability zone metadata records.

The fix is to call `execute`.

Change-Id: I3a5e2e7fd6e96b66b2073a35b55eec2002c6ae58
Removes unnecessary qemu-img dependency on powervm driver

Fixes bug 1131033

Power VM driver is using qemu-img through the fetch_to_raw call
No need to attempt a conversion since power images can only
be represented with the raw format, removing thus the need for
any conversions by calling fetch instead of fetch_to_raw.

Change-Id: I94b46e184cb87924a4754a0a48d9c2013a3eb756
Don't set filter name if we use Noop driver

If we are using the Noop firewall driver we don't set a filter name.

Fixes: bug #1131358
Change-Id: I5e8a92baa6838ed51b55ffd6af1e98da6dd662c2
Enable VM DHCP request to reach DHCP agent

When using the firewall driver IptablesFirewallDriver and the
default INPUT and FORWARD rules are DISCARD then the DHCP
request from the VM is discarded prior to getting to the dnsmasq.

A new rule will be added that enables DHCP requests to pass.

This fixes bug 1131223

Change-Id: I50fad5b63c3c4b22a5d828e3e89353c1ed723332
Make LibvirtDriver.uri() a staticmethod.

LibvirtDriver's uri() function seems to be the most logical place
where one can access the libvirt URL used by Nova. I would like
access to this outside the scope of the internal libvirt
driver (for libguestfs) so exposing it as a static
resource seems to make sense.

Partial fix for LP Bug #1131768.

Change-Id: I653296414716b4e799d68f6bfc868e6039d6ea4a
Make guestfs use same libvirt URI as Nova.

Updates our libguestfs vfs implementation so that it makes use of
the same libvirt connection URI as Nova does when using
attach mode 'libvirt'. Previously when libguestfs used attach
mode 'libvirt' (the default on some newer distros like Fedora 18)
you could get permissions issues and ultimately get a libvirt
connection error from libguestfs:

  could not connect to libvirt (URI = NULL)

Docs on guestfs attach method can be found here:

  http://libguestfs.org/guestfs.3.html#attach-method

Having libguestfs use the same connection URL as Nova makes sense
and gets past these permission issues. (avoiding things like forcing
you to create a $HOME dir for the nova user among other things)

Full thread on this is here:

  https://bugzilla.redhat.com/show_bug.cgi?id=913345

Note that on most distros the default libguestfs attach method
is still 'appliance' so this would have no affect unless explicitly
enabled via LIBGUESTFS_ATTACH_METHOD.

Fixes LP Bug #1131768.

Change-Id: I7e9f010022731a43e8d793cf8415ec12b346fdb4
Fix exception handling in baremetal API.

In patch ab9f8667c63d901f37d1662c5204fb2938be44fe, several
baremetal/db/api methods' exceptions were changed from InstanceNotFound
to NodeNotFound. The API extension for baremetal was not updated to
catch these, and this was not caught by unit testing. This resulted in
unhandled exceptions within nova-api if any baremetal node lacked an
associated interface.

While fixing that bug, a few other unit tests for the baremetal API
were added, and a missing exception was added to db/api bm_node_destroy.

Fixes bug 1131430.

Change-Id: I15f7624723754f9d7b217b609663a2d709acb056
Remove compat cfg wrapper

This wrapper was there to allow oslo-config changes through the gate
while keystoneclient hadn't been updated.

Change-Id: I3d48673af58ae379e8e4d2c7fb4b4d81f3ed67dd
Updates to OSAPI sizelimit middleware.

Updates the OSAPI sizelimit middleware so that we use avoid calling
len on a request body which could cause a really large request
to get buffered into memory.

Also updates the middleware to return HTTP 413 which is a more
correct error code in this case (previously it returned just 400).

Fixes LP Bug #1131857.

Change-Id: Id8bc5eeb0fba9482809edd12543a75163e1227e9
Add processutils from oslo.

RPC now depends on processutils.
Fixes bug 1131872.

Change-Id: I2c24f70aa37e56c2d12df370386629c76d89e4be
Merge "Migration 144: Fix drop index statement"
Merge "BM Migrations 2 & 3: Fix drop_column statements"