Fixes a race condition on updating security group rules

During creating the instance, compute manager makes an rpc call
to "allocate_for_instance" from the network manager, which will
in turn end up making a rpc cast to each compute_manager with
an instance in the group(s) than need to be refreshed calling
refresh_instance_security_rules.

When an instance is being created is in a group that has a
rule referring to itself, that chain will end up trying to
refresh the rules for the instance which is still being created.

That call will find its way down to do_refresh_instance_rules()
in libvirt/firewall - which will in turn try to get network_info
from the global "network_infos" in firewall.

But the entry in network_infos for this instance might not of
been added yet, as that only happens when the create of the
instance calls "prepare_instance_filter which comes later in
the sequence as part of driver.spawn

The fix here adds a synchronisation lock to the incomming
refresh call so that it is blocked until any in-progress
thread on the instance is finished.

Change-Id: I550e286aa4777b011633550109e18e03d63a4bbb
Stub additional FloatingIP methods in FlatManager

Fixes bug #989746.

Added some stub methods for floating ip allocation in FlatManager in
order to prevent exceptions from being raised when they are called.

Changed get_floating_ip_by_address() in FlatManager to return a dict
with expected keys for a floating ip, rather than None.

Updated patch from Andrew Laski and added unit tests.

Change-Id: I4ee1f5cf986b6f3411605aae5c1bc4e8cc2377b1
Delete baremetal interfaces when their parent node is deleted

Change-Id: I504cbed0adea86cab840c40ea9b9f96faf299f73
Assign unique names with os-multiple-create.

This patch introduces a new configuration option,
multi_instance_display_name_template, which makes
it so that all instances are given a unique
display_name and hostname when requesting that
multiple instances get created at the same time.

Implements bp multi-boot-instance-naming

DocImpact

Change-Id: Id8e7dac1adadbb101dd1027807867ab13d3b7e80
Add image to request_spec during resize

Image is needed by ImagePropertiesFilter during scheduling.

Resolves bug 1117882.

Change-Id: Icfbba85e2fdeb609d5fdabb6a7c3167505fe23b0
Add libvirt XML schema support for resource tuning parameters

Extend the libvirt XML config classes to support for CPU, disk IO,
network traffic tuning parameters.

Blueprint: quota-instance-resource
DocImpact
original reviews https://review.openstack.org/#/c/14151/

Change-Id: I2827ea0e731fefe5bbaec6c385268a3f5b89f7f6
Add support for instance vif traffic control.

Part 2 for blueprint quota-instance-resource, by adding exposed params
"vif_inbound_average, vif_inbound_burst, vif_inbound_peak,
vif_outbound_average, vif_outbound_burst, vif_outbound_peak" through
nova flavor-set, user can implement instance net traffic control policy.
for example:
nova flavor-set m1.medium set vif_inbound_average=10240000,
then the max inbound speed is 10MB/s. The usecase details of other params
will be noted on openstack-manuals.

Partly implement blueprint quota-instance-resource
DocImpact
original reviews https://review.openstack.org/#/c/14151/

Change-Id: I9934daadbf0e136e88530f5c23b556d070395bd0
remove intermediate libvirt downloaded images

* nova/virt/images.py (fetch_to_raw): When converting a downloaded
image to raw, ensure we delete the original download image.
I.E. the .part file.  The regression was introduced in 7c265343.
* nova/tests/test_libvirt.py (test_fetch_raw_image): A new test
for this function which wasn't tested previously.

Fixes bug: 1125068
Change-Id: Ie6f2cff1a554b8500fd66f0832566ae1b317be40
Add and check data functions for test_migrations 141

Before the 141 migration test is run, _prerun_141 populates the migrations
table with a generated uuid. The _check_141 function checks that
the uuid migrated properly down to 36 char.

Partially implements: blueprint migration-testing-with-data

Change-Id: I43b47f69a94720bf9487eb30576035493700ddca
Add select_hosts to scheduler manager rpc

This adds a select_hosts(...) method to the scheduler manager
rpc that allows other services to query it for the best suited
host instead of relying on it to proxy its messages.

This can be used by extensions that need the scheduler to determine
the best-fit host but want to prepare and send their own messages
to that host.

Change-Id: I5b4760114dfcdb0464fac8ea81f46f7532ac0580
Enable multipath for libvirt iSCSI Volume Driver

Implements: blueprint libvirt-volume-multipath-iscsi

nova/virt/libvirt/volume.py:LibvirtISCSIVolumeDriver can now
make use of multipath (behavior defined by use_multipath flag)
runs a scsi inquiry to the storage vendor (iSCSI portal)
asking for more portals, logins to the discovered portals and uses a
multipath device (/dev/mapper/XX) instead of a singlepath device
(/dev/disk/by-path/ip-IP:PORT-iscsi-IQN-lun-X).

This improves IO speed and robustness, since if one iSCSI portal goes
down, there are still others to take care of IO.

Change-Id: I30489234b8329f576cf2cbb0ef390670dbee5b95
Fix hacking tests on osx

There were a few incompatibilities with the hacking tests and
OSX. Readlink -f doesn't work so use cd and pwd instead. Importing
a module with path separators doesn't work, so recursively import
the module. Finally the extra / in the find command was not needed.

Add a 'set -e' to run_pep8 to make sure test fails on any error

Ignore paste as it doesn't have an __init__ in its top level directory

Change-Id: Ifc66da7b872faa08f3be98f8b10486181ba77861
Merge "Enable multipath for libvirt iSCSI Volume Driver"
Do not use abbreviated config group names (zookeeper)

Using abbreviated config group names just makes the config file harder
to understand, so just use full name.

zk => zookeeper

Change-Id: Ia8b3ff9201365477003535600e419540deae7341
Fix _get_instance_volume_block_device_info call parameter

_get_instance_volume_block_device_info() is expecting an
instance dict-like object instead of instance_uuid

Fix bug 1129441

Change-Id: Id4d536553ce9858434c377653fa79562e1282a34
Small spelling fix in sqlalchemy utils.

Change-Id: Iabc7c3d6a3cee6496b19811ad29b336a63cd0529
Remove unused db calls

* virtual_interface_delete
* instance_get_all_by_project

Change-Id: Ie0b90802ccef72bd56d3508e7796194517f7a5ef
Remove unused db calls from nova.db.sqlalchemy.api

*  instance_metadata_get_item
*  _instance_system_metadata_get_item
*  instance_type_extra_specs_get_item
*  aggregate_metadata_get_item

Change-Id: If25db80f2fc2da1d26fd5588a5c24131fe05d24e
Remove unused nova.db.api:network_get_by_instance

Change-Id: I908aaafa149c6548271fd9a3cc91225f2cbdb841
Live migration with an auto selection of dest

Add ability to let scheduler decide on target host during live migration.

Implements: blueprint live-migration-scheduling
Change-Id: Id596fa3a0ef2b1b5faf854e4b4557b3c4b413e39