Run instance root device determination fix.

Legacy bdm in incoming parameters contains a number of devices
specified by their names (e.g. "vdb" or "/dev/vdc").
Current code considers "vda" as root device and doesn't work on
"/dev/vda", for example.
This fix extracts the last significant character (digits
are skipped in "..sda1")  from the name like "a", "b", "c" and
selects the root device by checking for "a".

Change-Id: Iebaa117bb747d30ac9ceabd8805740dec9d1355c
Closes-Bug: #1322180
Move oslotest to test only requirements

oslotest is only used for unit testing, so
it shouldn't be in requirements.txt

Change-Id: I5073fbd93712072cec8598663590e35fc2edd08d
Replace assert* with more suitable asserts in tests

The following replacements were done in unit tests to
 have clearer messages in case of failure:
- assertTrue(a == b or a == c) with assertIn(a, [b, c])
- assertTrue(type(a) == dict) with assertIsInstance(a, dict)
- assertTrue(type(a) == int) with assertIsInstance(a, int)

Also assertTrue with several conditions was splitted.

Change-Id: Id6e5db9ead8d8dceb9f416c1b55280855d25e604
Replace assertTrue/False with assertEqual/NotEqual

The following replacements were done in tests to have
clearer messages in case of failure:
- assertTrue(* == *) with assertEqual
- assertTrue(* != *) with assertNotEqual
- assertFalse(* == *) with assertNotEqual

Change-Id: Idbb1a292cf8545b87728fa2b815c67f923ef6efa
api: remove unused function

Change-Id: I2ef2711d2ceffd3a3c375a137ff07f9ad0e18aeb
Clean conntrack records when removing floating ip

Established connections via floating ip won't get disconnected after
disassociating.
This patch move clean_conntrack from migration code to remove_floating_ip to
make sure that established connections on floating ip will get interrupted
immediately after disassociating.

Change-Id: I88d258ea39ea7c76e4cc60a636eb1e3e6aaa6f22
Closes-Bug: #1334938
Use mtu setting from table instead of flag

Adds mtu to argument lists of key methods and configuration of vlan
interface. Also adds deprecation notice to the "help" info for the file
based network_device_mtu configuration property.

Partially-implements blueprint better-support-for-multiple-networks

Change-Id: Ia401eb95ce8c81d104e59b0348e3474655b9a992
sync periodic_task fix from incubator

Set the value of time the periodic task was last run to a multiple of the
spacing value rather than the actual last time run. This ensures tasks runs
regularly but avoids synchronizing that interval with other nodes.

This patch also removes the coalescing of tasks which are _nearby_ (0.2
seconds away).

4dbd3aa Make periodic tasks run on regular spacing interval
21249f1 Fix parenthesis typo misunderstanding in periodic_task

Change-Id: I8873545578f104fd204fbc25493350128b2bc8d4
Object-ify APIv2 agents extension

This makes the APIv2 agents extension use the Agent object instead
of direct database access.

Related to blueprint compute-manager-objects-juno

Change-Id: I79d68be5d14c8af0f96164608f6c535530ef6d5e
Object-ify APIv3 agents extension

This converts the APIv3 agents extension to use the Agent object
instead of direct-to-database queries.

Related to blueprint compute-manager-objects-juno

Change-Id: I780c96bc32e7d457f8af73d941894b7d3ba08d98
Improve BlockDeviceMapping object cells awareness

This patch makes BlockDeviceMapping object methods that are creating and
updating the database more aware of the cells. There are 2 changes that
are good to distinguish between:

 - create() will _never_ work in the API cell and will raise an
   ObjectActionError.
 - save() and destroy() are now aware in which cell they are being
   called and do not attempt to propagate it upwards

This is currently a no-op change as we don not currently use objects in
any of the code that will run in the top cell. This is in fact
preparation for transiting the API code to using BlockDeviceMapping
objects.

Change-Id: Ic5806c844f2deab734011d68f5da316903000f67
Resolve import dependency in consoleauth service

If you attempt to access an instance's noVNC console on the
horizon dashboard, an AttributeError is thrown, complaining
about 'module' object having no attribute 'InstanceInfoCache'.
This is because the objects are not registered by the consoleauth
service. This patch fixes this import dependency by registering
all objects so it could be used by the consoleauth service.

Change-Id: I4f9b922a077076b156833590762106d5cd2ad276
Closes-Bug: #1337447
Fix duplicate definitions of variables/methods

Found these with a static analysis tool. Removed a bad
cut-n-paste of 2 test methods. Changed test method names
slightly to ensure they run

Change-Id: I15a90d0447e8038683a36766138d8db088cb4136
Remove duplicate keys from dictionaries

Found using a static analysis tool. Removed the duplicate key/value
pair as it was unnecessary.

Change-Id: Iab6374031c2af65d66c9d54fcb68c3a94603d43b
libvirt: more efficient method to list domains on host

The current libvirt driver code uses the legacy APIs for
enumerating domains on a host. These have a number of
problems

 - O(N) APIs calls are required to list N domains which
   is slow as number of domains increases
 - Race wrt start/stop of guests gives many problems
     - Domains guest lost between listDomainsIDs() and
       listDefinedDomains()
     - Domains disappear before lookupById/Name is
       called
     - Disagreement between numOfDomains and listDomainsIDs
       and numOfDefinedDomains and listDefinedDomains

Blueprint: libvirt-domain-listing-speedup
Change-Id: Id31f3071dfb10e33c51501b860a03f8975bbe812
Remove duplicate python-pip from Fedora devref setup doc

This just removes the duplicate python-pip from the list
of packages to install via yum when setting up a development
environment on Fedora/RHEL.

Change-Id: I3bd0aa7230c29a97845d744f6522bd2ffd1bf130
Add aggregates.rst to devref index

aggregates.rst was the only devref document that wasn't included in any
toctree.

Change-Id: I3e4392d2571b954d4553ca8e50b02053db4b5d99
Prevent max_count > 1 and specified ip address as input

Previously, if one did:
   nova boot --num-instances 2 --nic net-id=<net_id>,v4-fixed-ip=10.0.0.17
this would result in all of the instances failing to boot because neither
nova-network or neutron allows multiple instances to have the same ip_address.
This patch fixes this from occuring by checking for this and raising an error
to the caller from nova-api.

Change-Id: I7e44d58e66aeb10fb15c3553072f988f65ab823b
Closes-bug: 1318754
virt: add method for formatting CPU sets to strings

Add a format_cpu_spec method to nova.virt.hardware to
act as the inverse to parse_cpu_spec, by converting a
set/list of CPU indexes into a range string.

Blueprint: virt-driver-numa-placement
Blueprint: virt-driver-cpu-pinning
Change-Id: I3d4f38456111dd44f0ce6f9dd9cbcd2a8cf7d485
libvirt: convert cpuset XML handling to use set instead of string

The libvirt guest XML config class allowed the cpuset to be
specified as a string. Convert this to use a set() and the
standard CPU set parsing/formatting routines

Blueprint: virt-driver-numa-placement
Blueprint: virt-driver-cpu-pinning
Change-Id: Ice69de4dd6ce0b52b0eb7b4cbdc4e28d1111f4bf