Return a NetworkInfo object instead of a list

This return a NetworkInfo object instead of a list when there are no
configured networks available.

Fixes bug #1222781

Change-Id: I59c88944253ed5ff8b567d79046c3065fdfed9ab
Add flag to make baremetal.pxe file injection optional

File injection is slow and risky, So make it optional. File injection
was used for getting networking configuration into the baremetal nodes,
but neutron can do this now. File injection is also used for general
file injection and password injection, but those should be optional as
well.

Change-Id: If59641952255e5aaf3767524e2b3c566eefe2b74
Related-Bug: #1178103
xenapi: refactor: move UpdateGlanceImage to common

During the review of https://review.openstack.org/41651 it was
recommended to move UpdateGlanceImage to a common library. A bug was
filed to deal with the refactors. This change fixes the first part.

Fixes bug 1220596

Change-Id: I95ae89525b7e6768c5a70364945d5a10cb906d88
Always filter out multicast from reflection

Instances will try IPv6 neighbour discovery via multicast
even in an IPv4-only cloud and can throw errors
if they see inbound packets from their own MAC address

Closes-bug: #1229625

Change-Id: I3539e788fe07519d87ce7c3800c5d38b7bd99d3b
Adds v3 API samples for hide server addresses and keypairs

Adds the v3 API samples for the hide server addresses and
keypairs extensions. Bundled together to reduce review load

Partially implements blueprint v3-api-specification

+DocImpact

Change-Id: If331d79a878af7543c8792ab4d675fc996c3cd04
Move call to _default_block_device_names() inside try block

During instance builds, a call to _default_block_device_names() is
made which contains a db call to update the instance. In case the
instance is gone it will throw an unhandled InstanceNotFound exception.

To properly handle this, move the call to _default_block_device_names()
inside the existing try block next to it that handles this exception.

Change-Id: I3503029f02669e6ae31441653096fa69cba76d45
Closes-Bug: #1224677
Fix HTTP response for PortNotFound during boot (v3 API)

If a non-existent Neutron port is passed as a network parameter during create
instance, Nova API should return a 404 error. This was fixed for the V2
API in commit 4721408ea861a66af1ad1df5a45c42addcd8a95f (though with a 400).
This applies the corresponding fix to the V3 API.

Fixes bug 1212137

Change-Id: I27dfba636635eb8ac257785b833b240bc439f9ff
Fix v3 server rebuild deserializer checking with wrong access_ip key

When rebuild server with xml format, the xml deserializer code
are checking with wrong key. So rebuilding with access_ips doesn't
make any effect. So correct the wrong key 'access_ipv4', 'access_ipv6'
to 'access_ip_v4', 'access_ip_v6'.

Change-Id: I8fccf3727f193bf9142dc814a76a32d5ab1a1b0a
Closes-bug: #1221646
Fix V3 API flavor returning empty string for attributes

Fixes cases where in the V3 API the ephemeral, swap and vcpus
attributes for flavors were returned as the empty string
when they had a value of 0. Also removes default setting for
the disabled attribute as it is always set in the db.

Fixes up some associated testcase data as it was using data which
could not exist in the db.

Change-Id: I90f48956411f792037b1cd744c4fa8d287f9e752
Closes-Bug: #1216929
Add notification on deleting instance without host

If an instance which does not have a host associated is deleted, the
corresponding notifications were not being sent. Fixed the issue.

Closes-Bug: #1211742

Change-Id: I56482ab38725e6f1ddfb14350637d329f35095b3
Adds V3 API samples for srvcs, tenant usage, server_diagnostics

Adds V3 API samples for the services, simple tenant usage and
server_diagnostics extensions. Bundling them together to save
on review load

Partially implements blueprint v3-api-unittests
Partially implements blueprint v3-api-specification

Change-Id: I91edc6500acbe92221427383b4bcd3d00a8faadd
fix the an Unexpected API Error issue in flavor API

The flavors.add_flavor_access and flavors.remove_flavor_access
require admin privilege in DB level but the policy doesn't
require it and the exception isn't catched in the api. So the
bug arise. The privilege check in DB level is not necessary,
but it need more tests and can be remove in other patch or
blue-print.

This use extension_authorizer instead of soft_extension_authorizer
in the action of flavor_access, in order to raise exception.

Closes-Bug: #1217679
DocImpact

Change-Id: I0b1231f47fffaf99f330de02956bfe8d7cd4b920
Forced scheduling should be logged as Audit not Debug

Forced scheduling to a node is a privileged operation which bypasses
resource checks. As such the log entries should be Audit not Debug

Fixed Bug: 1231983

Change-Id: Id2016b7bf2ba5f7af4896b5f8df481437d2ee956
Fix incorrect exception raised during evacuate

This change creates a new exception 'ComputeServiceInUse'
to better represent the error when trying to evacuate
an instance with a running compute service. Also, it adds
a missing test for evacuate API v3.

Closes-Bug: #1230282

Change-Id: I1c4edb01e84cd2a89879bca9c99f5e38f47e16fb
Fixes rescue doesn't honor enable password conf for v3

The rescue api should honor enable_instance_password conf
setting just like server creation and rebuild api does,
enables this flag will returning the instance password from
server API call rescue, If the hypervisor does not support
password injection then the password returned will not be
correct, this patch just fixes v3 rescue api, since change
return value of v2 could potentially break apps which depend
on this being returned.

DocImpact
Closes-bug #1213866

Change-Id: Ie8422979940bbde8c5749fcd3d6c735e88f78c6a
Adds V3 API specific urlmap tests

Adds V3 API versions of the urlmap unittests. These test that
the V3 content is returned when expected in the format expected.

Adds the extension plugin as being discoverage in the fake policy
files for the unitests to provide some easily known data to check
for the urlmap tests.

Updates extension info api sample tests

Partially implements v3-api-unittests

Change-Id: I67f2a3516ffee02b6dbf258ee35e1fd084ba060c
Adds missing entry in setup.cfg for V3 API shelve plugin

Adds the missing entry in setup.cfg which allows the V3 API
shelve plugin to be loaded. Also adds a v3 version of the unittests
for the shelve plugin.

Change-Id: I737ca0cae503b726b0103a4ae169ffca91188c87
Closes-Bug: #1233454
baremetal: Fix misuse of "instance" parameter of attach/detach_volume

Some parts of baremetal driver treat "instance" parameter as if it is
the name of an instance, but actually it is the instance itself (dict).

Closes-Bug: #1221244
Change-Id: I01a296a6ac0bbf7c5fec3434ddf1197828b849b6
Libvirt: default device bus for floppy block devs

Even though 'floppy' is a valid device type, libvirt driver was
not supporting it.

This patch makes the bus for floppy devices be defaulted to 'fdc' if not
specified, when running libvirt with KVM.

Also it makes the device name prefix for devices on the fdc bus default
to 'fd' so that it is possible to default device names for floppy
devices. It also makes the fdc count as valid bus for kvm/qemu
hypervisors.

This effectively adds support for the floppy devices in the libvirt
driver.

Closes-bug: #1229273

Change-Id: If030109fa16a2518a550fc0dc31341442262756c
Sync three-part RPC versions support from Oslo

Change-Id: Ia93e7a6d978374e0dcf49c2be230c67e41a7bd14