Fix launching libvirt instances with swap

The code in

  commit 7be531fe9462f2b07d4a1abf6687f649d1dfbb89
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Tue Jan 15 20:43:48 2013 +0000

    Refactor code for setting up libvirt disk mappings

accidentally broken launching of instances where
the flavor had non-zero swap specified. This was
not caught due to complete lack of test coverage
for the '_create_image' method. This adds two
test cases for that method, exercising this bug.
It also fixes a bug in netutils which was not
handling a NULL network mapping, which is a valid
scenario for several callers.

Fixes bug #1131306
Change-Id: I214561ba3ec6440d11a5afb0665e6b6f990bd148
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
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
Merge "Fix launching libvirt instances with swap"
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
Merge "Migration 144: Fix drop index statement"
Merge "BM Migrations 2 & 3: Fix drop_column statements"
Merge "Fix migration snake-walk."
Merge "Add `post_downgrade` hook for migration tests."
Merge "Migration 146: Execute delete call."
Add missing import_opt for flat_injected

Fixes bug 1131891

Change-Id: I993798abea27b8d37efe5d3c122a490d85e192a8