Users with admin role in Nova should not re-auth with Neutron

A recent change to the way Nova creates a Neutron clients
https://review.openstack.org/#/c/52954/4 changed the conditions
under which it re-authenticates using the neutron admin credentials
from "if admin" to "if admin or context.is_admin".

This means that any user with admin role in Nova now interacts
with Neutron as a different tenant.  Not only does this cause an
unnecessary re-authentication (The user may/should also have an admin
role in Neutron) it means that they can no longer allocate and assign
a floating IP to their instance via Nova (as the floating ip will now
always be allocated in the context of neutron_admin_tenant).

This change removes the context.is_admin check to revert to the
previous behaviour where the used of admin creds is determined just
on the explicit use of "admin=True" parameter to get_client().

Change-Id: Ib1720420c778960bc90c5b7d703de936ebb7d6b5
Closes-Bug: 1250763
Fix up spelling mistake

Fixes bug 1253510

This was causing a KeyError when e2label didn't work

Change-Id: I0646409cdffa4d6d5d8b2c7a9e3c300022d1c9b8
docker: return hypervisor_version as an int rather than a string

The compute_nodes.hypervisor_version type in the database is an integer
so the docker driver needs to return the hypervisor_version as an
integer rather than a string.

Also adds the missing unit test for get_available_resource.

Closes-Bug: #1253960

Change-Id: I4e2ac13f9203b54e71f1f5cd8e15311921dd85c5
Move flags in libvirt's imagebackend to the libvirt group

This change continues moving libvirt specific flags into a libvirt
specific configuration group.

Progresses blueprint libvirt-opts-group.

DocImpact: the following flags move into the libvirt group:
    libvirt_images_type (now images_type)
    images_volume_group
    sparse_logical_volumes
    lvm_snapshot_types
    images_rbd_pool
    images_rbd_cepf_conf

Change-Id: Ic1bb8076b139787fe5acbc0574b0c75b52bf3bd7
Move flag in libvirt's utils to the libvirt group

This change continues moving libvirt specific flags into a libvirt
specific configuration group.

Progresses blueprint libvirt-opts-group.

DocImpact: the following flag is now in the libvirt group:
    snapshot_compression (formerly libvirt_snapshot_compression)

Change-Id: I9eddec5cdb72a1313e044a3c7c6d75e8ad34533a
Move flag in libvirt's vif to the libvirt group

This change continues moving libvirt specific flags into a libvirt
specific configuration group.

Progresses blueprint libvirt-opts-group.

DocImpact: the following flag has been moved into the libvirt
group:
    use_virtio_for_bridges (formerly libvirt_use_virtio_for_bridges)

Change-Id: I755139f0a470a091e36760836c9200f15aa72c37
Use 204 instead of 202 for delete of keypairs v3

The delete of keypairs will access db directly. It isn't async call.
So correct it to return 204.

Closes-bug: 1252169
DocImpact

Change-Id: Ie36c16e1773fa7f61b22bd6735342c7308c7ba35
Rename instance_type parameter in migrate_disk_and_power_off to flavor

Renames the 'instance_type' parameter in the nova virt driver's
migrate_disk_and_power_off method to 'flavor' and handles the immediate
related code changes, i.e. the method itself, the implementations in the
various virt drivers, the tests, and anything called solely from
migrate_disk_and_power_off. This patch does not adjust for everything
that calls into migrate_disk_and_power_off, like from the nova compute
manager code.  That will be handled in a later patch in the series.

Part of blueprint flavor-instance-type-dedup

Change-Id: I47f2b9f6597556dca632d94f83cc1428ad73ae74
Do not hide exception in update_instance_cache_with_nw_info

From time to time an exception is raised in this method causing
the nw_info cache not to be saved. If this occurs we should raise
as this error will cause later errors to occur. For example, one
won't be able to associate a floatingip with the instance as there
is no nw_info found in this table. In addition, the fixed_ips on
the instance won't be returned via the api.

This patch also stubs out update_instance_cache_with_nw_info in a
few tests where an exception was being raised previously but went
unnoticed as it was not reraised but now is.

Related-Bug: #1252849
Related-Bug: #1249065

Change-Id: Ic860f72210ba736e11c10df21c4cb7625e9c0928
Don't gate on E125

E125 overreaches on what pep8 specifies. See
https://github.com/jcrocholl/pep8/issues/126

In practice E125 can be a pain as compliance requires
manual indenting if using emacs and refactoring tools
don't always get it right.

There's a bit of a discussion about it here (on a tempest
changeset):

https://review.openstack.org/#/c/36788/

Change-Id: Ic73ab3c4a47f33de9145e0c7db2d8674230c2fe0
Fix incorrect argument position in DbQuotaDriver

The prototype of db.quota_get is:
`quota_get(context, project_id, resource, user_id=None)`
However, in DbQuotaDriver::get_by_project_and_user(), the `user_id`
is incorrectly used as a positional argument.

Closes-Bug: #1255035

Change-Id: I5b6a4c59efe6d9bdc8380e50b7f7c1ff0d2029b1
Add v3 of compute rpc API

Add support for the 3.0 compute rpc API.  This commit retains compatibility
with the older 2.X API to allow continuous deployment without any downtime.

The v3 rev of this API was determined primarily by copying the current API
in nova.compute.rpcapi.  That class always reflects the latest rev of the
API that is actually being used.

UpgradeImpact - Deployments doing continuous deployment should follow this
process to upgrade without any downtime with the consoleauth service:

1) Set [upgrade_levels] compute=havana in your config.

2) Upgrade to this commit.

3) Once everything has been upgraded, remove the entry in
[upgrade_levels] so that all rpc clients to the nova-compute service
start sending the new 3.0 messages.

Part of blueprint rpc-major-version-updates-icehouse

Change-Id: I5d303445ded2342a54d8319b79df172ce50fa716
Remove compute 2.x rpc api

A previous change adding support for the 3.x rpc interface but retained
compatibility with 2.x as a transition point.  This commit removes the
old API from the server side.

The object_compat decorator is unused as of this commit.  However, I'm
leaving it, because it's going to start getting used very soon again as
more of the compute rpc api gets updated to accept Instance objects.

UpgradeImpact

Part of blueprint rpc-major-version-updates-icehouse

Change-Id: I31c21055163e94b712d337568b16b9b7a224b52f
Merge "Fix up spelling mistake"
Merge "Users with admin role in Nova should not re-auth with Neutron"
Merge "Do not hide exception in update_instance_cache_with_nw_info"
Merge "Fix incorrect argument position in DbQuotaDriver"
Merge "Don't gate on E125"
Merge "Move flags in libvirt's imagebackend to the libvirt group"
Merge "Move flag in libvirt's utils to the libvirt group"