Copy the RHEL6 eventlet workaround from Oslo

Tests in oslo-incubator now need the horrendous hack to workaround an
issue with eventlet on RHEL6. We've moved the patch_tox_venv tool
and redhat-eventlet.patch into oslo-incubator, so add them to
openstack-common.conf.

Change-Id: I1acfec282b64d7582144b155119bedb1741db2f7
Include list of attached volumes with instance info

Fixes bug 1112998

Change-Id: I1c3eb578339aabbcfed107043f39e30daf633c4a
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
Optimize db.instance_floating_address_get_all method

Optimize db.instance_floating_address_get_all
Was:
Get FixedIps with corresponding instance_uuid
For each FixedIp get associated FloatIp (N request)
Now:
Get only list of FixedIps ids
Get all corresponding FloatingIp with one query (select in)
Get only addresses from FloatingIps (because we are using only it)

Add temporary test for db.instance_floating_address_get_all to
ensure that it works as expected.

Change-Id: Id3c515de0ca35707bbfe46b991c2d7cf591e431b
Architecture property updated in snapshot libvirt

During an instance snapshot if the architecture property is defined
in the image it is updated twice in the snapshot image.
The snapshot is created with the metadata values from the
"instance_system_metadata" table and then, if defined, the architecure
property is updated from the value in the base image in that moment.

There is no reason to treat this property differently from others.
Also, it didn't respect the "non_inheritable_image_properties" option.

This change removes the special behavior for the architecture property
in the libvirt driver during a snapshot.

Fixes: bug #1176173
Change-Id: Ic5b4e3d462c08df167e14522fa25a7cf857c6aad
Extract getting instance's AZ into a helper module.

An instance's availability zone logic may used by many modules,
so move it from extend API into helper module `nova.availability_zones`.
Also add some tests for the new method.

part of bp: different-availability-zone-filter

Change-Id: I5916a0b09d5dddec338e8e36503953720dfd6bcd
Fix header issue for baremetal_deploy_helper.py

Fix header issue

baremetal_deploy_helper.py is not a python script which can not
be run directly, so there is no need to keep "#!/usr/bin/env python"
but change it to "# vim: tabstop=4 shiftwidth=4 softtabstop=4"

Change-Id: Ic4957673605cd71dc19fc38a2626bdaa35d102c0
Sync service and threadgroup modules from oslo

blueprint use-oslo-services

Change-Id: I8641dbed0a83a6d57c0b6c1a02796eb3e633fafd
Detach volume fails when using multipath iscsi

Enabled multipath for libvirt iscsi volume driver. Attach volume worked,
however, detach volume failed. It failed because it can't find multipath
device "/dev/mapper/xxxxxxxx" from connection_info and block device
mapping table.

The fix is to retrieve multipath device info dynamically at detach time.

Fixes: bug #1178893

Change-Id: I53a3888daef93b57bf7f57438f74cee05e794b52
Convert Nova to use Oslo service infrastructure.

Convert Nova to use the Oslo versions of:
* Service
* Launchers

Also add Service timers to the Service ThreadGroup.

blueprint use-oslo-services

Change-Id: Id8ab017f4525afd69fed322311f2d5cc3b6d6f98
Test for remote directory creation before shutting down instance

This patch moves the creation of the directory on the migration target
earlier in the code path so we can catch failures like missing or incorrect
keypairs on the source and destination node.

This fixes part of bug #1061024 but not all of it yet.

Change-Id: I097cf007cdd8de0c9c3a9390cbc6dc202eddb2b5
Refactor nova.volume.cinder.API to reduce roundtrips with Cinder

Make cinder.API methods accept volume_id instead of the whole volume object.
This will remove redundant roundtrip to get the volume before
passing it to other methods as in fact they only need the id.

Fixes bug 1172297

Change-Id: I5e7f944c1c29b2f211ece2ef86c0959c81e806df
Refactored tests for db.key_pair_*() functions.

All tests for db.key_pair_*() functions are in KeyPairTestCase class now.

blueprint test-db-api

Change-Id: I92358bcda157c95290b31e3b7997e3432a65b404
Add missing unique constraint to KeyPair model.

Added a missing unique constraint ("name", "user_id") to KeyPair model
(this constraint was in db schema but not in model definition).

blueprint db-enforce-unique-keys

Change-Id: Id231bca256e0cb39fcd8068acc7039240326fde2
Remove "#!/usr/bin/env python" from .py files under nova/cmd

Fix bug 1178543

Now in Havana, all nova service script start up logic are moved to
nova/cmd and those files are not simply python script but python
files, so there is no need to still keep "#!/usr/bin/env python"
for those files since they won't be run directly as scripts.

Change-Id: Ic102215dc0200ec1f6b47951bef31d58b08022ef
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
Handle IPMI transient failures better.

Sometimes, IPMI "power status" doesn't return either "on" or "off".
When this happens, the IPMI driver shouldn't assume what the state is,
and the baremetal driver shouldn't assume that NOSTATE means SHUTDOWN.

This patch also improves the doc strings for the IPMI driver.

Fix bug 1178378.

Change-Id: I54a5e6309f68ab8e5601e65039366d7d87c03478
Use Oslo's `bool_from_string`

Oslo provides an equivalent implmentation of `bool_from_str` so we
should switch the code to use that instead.

Change-Id: I382f23af2468e276ae4342dff18cf06e1c24b755
Reverse path SNAT for DNAT floating-ip.

This patch applies a reverse SNAT rule to allow instances that have an
assigned floating IP to communicate with other instances in the same
OpenStack deployment, security group rules permitting. The patch
allows members of the same private network to communicate with each
other using their floating-ips in a more consistent fashion. The rule
also addresses the situation where the target is on another private
network.

This will only work for interaction between two servers that both have
floating IPs assigned to them.

Specifically, this patch solves the problem where a target server
"sees" the private address of the client. By SNAT'ing to the client's
floating-IP, the "sees" the correct reply address and the reverse
route follows the same path that an actual external connection would
take. The SNAT ONLY occurs if a DNAT occurred before hand, allowing
communication on private networks using private IPs to remain fully
private and internal. The limitation is of course if a DNAT occurs for
other reasons, there may be issues.

Resolves bug 1178745

Change-Id: I55b7131cff5fd5a2ebf826945370d4d550e74136
Fix quantum security group driver to accept none for from/to_port

The quantum security group driver did not accept none values for
from_port/to_port which the nova security group api supports. This
patch allows None values to be passed in for those params and adds a unit test.

In addition the from/to_port responses would be different if using quantum
instead of nova. This patch fixes that and adds unit tests.

Fixes bug 1176027

Change-Id: Id57e253c9dd1787ee25fc5cbb562743692d7abe4