object-ify API v2 availability_zone extension

This change converts the availability_zone extension to use the
Service object instead of direct database access.

Related to blueprint compute-manager-objects-juno

Change-Id: If5baafd8ec85be1ea1cd6580ae10ef3d51366c9c
Add debug log for pci passthrough filter

Sometimes operator need information why the host doesn't pass
the check of scheduler, this patch adds information for pci
passthrough filter if it falied to pass check.

Change-Id: Ic8fe13174fda5c75ce95fc0b64391ae081b36c6d
Partial-Bug: #1301830
Add context as param to cleanup function

In nova-network, when we start
to cleanup the stuffs it did when handle exception
but the function is following in objects/fixed_ips.py
def disassociate(self, context):
so the context param is lost and it can lead to problem.

Change-Id: I66a1681f47fc69bf0fd92137ee27481659833bef
Closes-Bug: #1350268
Properly handle snatting for external gateways

Previously, snatting for netowrks with external gateways had to be
handled by manually setting:
 * public_interface = ''
 * force_snat_range = snat_range
Whereas networks with a gateway managed by nova needed:
 * public_interface = eth0
 * force_snat_range = None or ['0.0.0.0/0']

In order to support both simultaneously, we calcualate whether the
gateway is external, and use the force_snat_range and skip interface
if it is an external gateway. Otherwise, we use the setting for public
interface and 0.0.0.0/0. This allows external and internal gateways
to co-exist.

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

Change-Id: Id5ec66946c3a82841a6dd2d019404e822cdafe64
Turn on pbr's autodoc feature.

In order to make the docs index and moduleindex pages work, turn on
pbr's autodoc_index_modules feature.

Change-Id: I0ef240f4624acf11900705d1c0f4d6d6f70247bd
Remove outdated docstring for nova.network.manager

There was related-flags section to describe config options, but was
outdated and duplicated with config options' description in code.
So We should remove it.

Change-Id: Ie0e444810393c77f04c1adbafdeb83c99d970902
Add API schema for v2.1/v3 cells API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint v3-api-schema

Change-Id: Ic400a31fe2c05e07785a2dc6c4fd864e684f4965
Fix _parse_datetime in simple tenant usage extension

_parse_datetime in os-simple-tenant-usage incorrectly attempts
to parse the datetime string even when it is None. As a result
a 400 BadRequest is returned. This has the overall effect of making
the start and end datetime parameters compulsory when they are meant
to be optional.

Note that this restores the behavior where start/end are optional which is
in contradiction to the API docs, but is the long standing API behaviour.
This was an API change which was accidentally applied in commit
I8e0e870727d687da165c809ffb7a4456bff81122 as part of some nova internal
changes but not picked up by the unitests

Change-Id: I00427379dc7aa39770f9a16ff026addb6e311735
Closes-Bug: 1300972
Fix Resource tracker should report virt driver stats

If the virt driver provides any data for resource stats it is
lost whenever the resource tracker updates its own view of stats.
Moreover, if the resource tracker has not instances to track it
only reports the driver's view, which might be nothing.

This fix adds the driver's view of stats to the resource tracker
stats to make sure they are correctly handled.

Change-Id: Icb19148660bca542a8120ecab064551d67ac28af
Closes-bug: #1348288
Update dev env docs on libvirt-dev(el) requirement

Commit 8f505b85268adc226ec0a83826c2d13edcbe3d7c added
a test requirement on libvirt-python which requires
libvirt-dev(el) being installed, so update the docs
to add that package for the distro.

Change-Id: I7169d3c78a6babe6e20c0dc35874167d0bfee922
Improve logging when python-guestfs/libguestfs isn't working

Bumped from debug to warn level, as most often refers to
missing python-guestfs package or other libguestfs misconfiguration,
and the fallback path is usually not desired.

Closes-bug: 1240339
Change-Id: I5d90a3ea109e79fe17221c001f94d49d599048ba
libvirt re-define guest with wrong XML document

In the nova/virt/libvirt/driver.py file, the '_live_snapshot' and
'_swap_volume' methods have the following code flow
  xml = dom.XMLDesc(0)
  dom.undefine()
  dom.blockRebase()
  dom.defineXML(xml)
The reason for this is that 'blockRebase' requires the guest to be
transient, so we must temporarily delete the persistent config and
then re-create it later.
Unfortunately this code is using the wrong XML document when
re-creating the persistent config. 'dom.XMLDesc(0)' will return the
guest XML document based on the current guest state. Since the guest
is running in both these cases, it will get getting the *live* XML
instead of the persistent XML.So these methods are deleting the
persistent XML and replacing it with the live XML. These two
different XML documents are not guaranteed to contain the same
information.
As a second problem, it is not requesting inclusion of security
information, so any SPICE/VNC password set in the persistent XML
is getting lost.

Change-Id: I4b4e0990ca6c07a9215766f994884a1fb18f3a41
Closes-Bug: #1346191
Update devref setup docs for latest libvirt on ubuntu

Adds instructions on how to enable the ubuntu cloud-archive
and update to the latest libvirt-dev from the icehouse repo.

This is needed to run unit tests in Juno if you're still on
ubuntu precise.

Change-Id: I8c93afdd72256b2bdc487e1413bdd570a6ea59e8
Add trace logging to allocate_fixed_ip

The address is being logged as None in some cases
that are failing in grenade jobs so this adds more
trace logging to the base network manager's
allocate_fixed_ip method so we can see which paths
are being taken in the code and what the outputs
are.

Change-Id: I37de4b3bbb9e51b57eb4d048e05fc00382eed23d
Related-Bug: #1349617
Merge "object-ify API v2 availability_zone extension"
Merge "Update dev env docs on libvirt-dev(el) requirement"
Merge "Add trace logging to allocate_fixed_ip"
Merge "libvirt re-define guest with wrong XML document"
Merge "Turn on pbr's autodoc feature."
Merge "Add API schema for v2.1/v3 cells API"