ensure atomic manipulation of libvirt disk images

This pattern could probably be used elsewhere,
but only libvirt disk images are considered for now.
This change ensures there are no stale files left
anywhere in the path from glance, through the libvirt image cache.
These could cause subsequent operational errors either
directly or indirectly through disk wastage.

* nova/utils.py: Add a new remove_path_on_error() context manager
that is used to remove the passed PATH on a raised exception.
* nova/virt/images.py: Ensure temporary downloaded and
converted images are protected.
* nova/virt/libvirt/connection.py: Ensure all the images in
the image cache and instance dirs are protected.

Change-Id: I81a5407665a6998128c0dee41387ef00ebddeb4d
Clean up read_deleted support in host aggregates code

tl;dr - this is a cleaner fix for bug #949038

It seems clear to me that all of the DB APIs should not explicitly pass
read_deleted='no' or read_deleted='yes' to model_query without good
reason.

We want to allow callers to specify read_deleted via the context and
that only works if we don't explicitly pass it to model_query().

If we don't explicitly specify it to model_query(), we use the value
from the context which defaults to 'no'.

Given all that, there is no need to support read_deleted to any of the
DB API calls because they should support specifying the flag via the
context. There should also be no need to pass read_deleted='no' because
that is the default.

Really, the only place there should be any mention of read_deleted is
where we want read_deleted='yes' behaviour e.g.

  - In tests, where we want to check the operational_state of an
    aggregate after it has been deleted

  - Where we want to support undeleting an aggregate or aggreate host

Change-Id: I916a8d189a33d7f30838cccb26531a024066ef96
Remove auth_uri, already have auth_host, auth_port

Remove to clarify config

From keystone docs:
`auth_uri``: (optional, defaults to `auth_protocol`://`auth_host`:`auth_port`)

Change-Id: I4349cd9545c571b37886ae38416c27b841e797f8
adjust logging levels for linux_net

Change-Id: Ifb199d644ce47c5a222f1f1bfc22a14a42f75686
remove unused flag:
baremetal_injected_network_template
baremetal_uri
baremetal_allow_project_net_traffic

Change-Id: I9766924cc7621e14fc52088a558b95cfd5d7ce8d
fix TypeError with unstarted threads in nova-network

(nova): TRACE: File "/usr/lib64/python2.6/site-packages/nova/utils.py",
line 860, in __init__
(nova): TRACE: self.tname = "-%x-%x" % (ident & 0xffffffff, gident &
0xffffffff)
(nova): TRACE: TypeError: unsupported operand type(s) for &: 'NoneType'
and 'int'

Fixes: bug 971629

Change-Id: I3d34816c36a11cd6fc2dd9c889c93c5872133a2c
Do not fail to build a snapshot if base image is not found

This fixes bug #968066

Change-Id: I1959e4dd7cb19acef54f0e857f4d8b3d40985b77
add libvirt_inject_key flag
fix bug #971640

Change-Id: I48efc5babdd9b233342a33c87c461aabf5f5915b
Sync openstack.common.cfg from openstack-common.

Change-Id: I54c7afc1c20f5fbec02dc879f7a753d07adfb5db
Remove nova.rpc.impl_carrot.

This module was marked as deprecated and scheduled for removal in Essex.
Remove it now that Folsom development is open.  nova.rpc.impl_kombu
should be used instead.

This patch also removes nova.testing.fake.rabbit, since as far as I can
tell, it isn't used anymore and was the last thing still using the
carrot dependency.

Change-Id: I8cfb2d09ee5eed439ec1d152261f7097faf08ad6
Merge "Remove nova.rpc.impl_carrot."
Allow unprivileged RADOS users to access rbd volumes.

This makes it possible to access rbd volumes with RADOS users with
restricted privileges. Previously, the admin user was always used.

This requires libvirt 0.9.8 or higher.

Change-Id: Ia4665c2a93a58a1c1290f467a3d9cd6cd22d7bd5
Corrects an AttributeError in the quota API.

Fixes bug 972001.

Change-Id: Iaf833bb6dae9cc17689e9f13eff917e91a2b722a
Merge "Remove auth_uri, already have auth_host, auth_port"
Grab the vif directly on release instead of lookup

 * adds extra error handling and logging
 * safer fix for bug 968457

Change-Id: I6d8c27c642e70dc701548550c0d94a8e0e64ce99
Merge "ensure atomic manipulation of libvirt disk images"
Auto-confirming resizes would bail on exceptions

Fixes bug 971939

Fixes a few things.  If instance went to error, we should set the
migration to error so we don't retry.  Also, if we get any other
exceptions when trying to confirm resizes, we should not bail out of the
loop.  Also: be nice to other greenthreads and yield on each iteration.

Includes complete unit test for xenapi poll_unconfirmed_resizes which
didn't exist prior to this patch.

Change-Id: I6f7c1ccfd4be0f1497727d817130a821902d134d
Treat -1 quotas as unlimited.

Updates quota db API calls so they treat -1 quotas as unlimited
for consistency with the Nova flags.

Fixes LP Bug #972034.

Change-Id: I56456c2780110f8fd55afa9d1fe30193bf99d928
Make sure cloudpipe extension can retrieve network

 * includes failing test
 * fixes bug 972583

Change-Id: Idadac82c6a0fda8a1b912fb974e5754a1e82df39
Get unit tests functional in OS X

* Add detection for directio to ensure the python runtime is built with O_DIRECT
* Extend stubbing in test_libvirt to also stub out _supports_direct_io

Change-Id: Id793d4039311396f0b3c3a52d2a1d951ec3c5e48