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
api: remove unused function

Change-Id: I2ef2711d2ceffd3a3c375a137ff07f9ad0e18aeb
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
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
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
Add host_ip to compute node object

This adds host_ip to the compute_node object as an IPAddress
typed field. The property is already present in the database
and is required to enable use of the compute_node object in
the resource tracker.

This is part of: blueprint make-resource-tracker-use-objects

Change-Id: Id238538a51b5a7a8014fc991def7817959904a95
Fix more re-definitions and enable F811/F813 in gate

Additional issues found by flake8 by enabling F811 and
F813. There was only one F813 list comprehension redefinition.
The rest of the changes were F811 redefinition of unused name
violations.

Change-Id: Iad5406c149ab21d360b7e98899a92082197c8c17
synchronize 'stop' and power state periodic task

This change adds the synchronized decorator to the stop function and
_sync_instance_power_state to address a race condition when powering
off and updating the database for an instance. The power off and
database update should be protected so the periodic task sees a
consistent view when it checks power state from the driver and
VM state from the database in order to take action.

In the bug, a stopped instance is in the middle of being rebuilt,
and while it is in the process of being returned to the original
STOPPED state, _sync_power_states sees the combination of the
power state from the driver being 'on' and the vm_state from
the database as being STOPPED. This patch aims to ensure power
'off' and vm_state set to STOPPED happen atomically in the
stop_instance function. Thus, the read by _sync_power_states
must also be synced on the instance UUID.

Change-Id: I8aa83ab8dca35878cf792ae2d46feaa9912ffd38
Closes-Bug: #1320628
Catch image and flavor exceptions in _build_and_run_instance

If a user selects a flavor with a disk size that is smaller than
the requested image, a FlavorDiskTooSmall exception is thrown.
However, this exception is not specifically caught in
_build_and_run_instance, but is caught as generic exception,
causing a RescheduledException to be thrown. This forces the
instance to be rescheduled a few times before finally throwing
a NoValidHost exception. It causes confusion because the actual
cause of it is that the disk size is smaller than the requested
image. The following patch properly catches exceptions thrown by
_check_requested_image in _build_and_run_instance.

Change-Id: Ic8b435ba7e8721aa8ca54f29c1ad808833a7608d
Closes-Bug: #1330856
Make the block device mapping retries configurable

When booting instances passing in block-device and increasing the
volume size, instances can go in to error state if the volume takes
longer to create than the hard code value (max_tries(180)/wait_between(1))
set in nova/compute/manager.py

def _await_block_device_map_created(self,
                                    context,
                                    vol_id,
                                    max_tries=180,
                                    wait_between=1):

To fix this, max_retries/wait_between should be made configurable.
Looking through the different releases, Grizzly was 30, Havana was
60 , IceHouse is 180.

This change adds two configuration options:
a)  `block_device_allocate_retries` which can be set in nova.conf
by the user to configure the number of block device mapping retries.
It defaults to 60 and replaces the max_tries argument in the above method.
b) `block_device_allocate_retries_interval` which allows the user
to specify the time interval between consecutive retries. It defaults to 3
and replaces wait_between argument in the above method.

DocImpact
Closes-Bug: #1332382
Change-Id: I16e4cd1a572bc5c2cd91fc94be85e72f576a8c26
Merge "Remove duplicate python-pip from Fedora devref setup doc"
Merge "libvirt: more efficient method to list domains on host"
Merge "Fix more re-definitions and enable F811/F813 in gate"
Merge "api: remove unused function"