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
Fixes the usage of PowerVMFileTransferFailed class

If it fails in the process of "Calculate file size in multiples of 512
bytes", the exception.PowerVMFileTransferFailed message is illegal.
"KeyError: u'file_path'" is occurs when there is no argument.

Change-Id: I15a7467bbc103f683d82949dc0892210cd63c4b6
Closes-Bug: #1223198
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
Replace OpenStack LLC with OpenStack Foundation

Change-Id: I5203554989bc7244cff2899d52c5764360bba60c
Fixes-Bug: #1214176
Code change for regex filter matching

Remove REGEXP_LIKE operator for oracle db backend since it's not suitable,
Such as:
Oracle: 'select xxx from xxx where REGEXP_LIKE (column, pattern)'
Mysql: 'select xxx from xxx where column REGEXP pattern'

For the simple pattern matching(LIKE operator) used for unsupported backend db,
add '%' wildcard character on both sides of the value.

Change-Id: I4682d38086a06032bb5650a14b253f6b2b859613
Closes-Bug: #1230102
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
Fix type is overwritten when UPDATE cell without type specified

If you not specified the 'cell-type' in UPDATE request,
  the value will be overwritten by the default value, 'child'.
That's not correct, you need to reserve the existing cell-type.

The issue is also involved in the new V3-api.

Fixes bug: 1224461

Change-Id: I5c5043b9e5e0c33995422094284c3f19aac78593
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
Make Instance.refresh() extra careful about recursive loads

This simply makes sure that the instance copy that we fetch to
refresh an instance can not trigger lazy loads itself due to
a bug in get_by_uuid() or below. This hasn't actually been the
cause of any recent bugs, but this makes it much more careful.

It also makes sure that obj_load_attr() refuses to do its work
if self._context is None, which was previously only being
enforced for remoted calls.

Change-Id: I76f433af34620045b079e0a2c30c60b28a4ce525
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
plug_vif raise NotImplementedError instead of pass

The Hyper-V, VMware, Docker and PowerVM drivers raise
NotImplementedError from the plug_vifs and unplug_vifs
methods rather than pass.
The compute manager handles the NotImplementedError
case when initializing the host.

Fixed bug 1218593

Change-Id: Id17a1f691f46816eadfe257d9ac0cc46502318ef
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
Ensure image property not set to None in build_request_spec()

This is in preparation for having scheduler.util.build_request_spec()
construct the request_spec in the live migration code. Specifically, this
change is needed to avoid reintroducing bug #1199811.

Change-Id: I0cc6b6ec7be7a0afbe184b208f2e16fd5cd4452c
Related-Bug: #1224014
Make LiveMigrateTask use build_request_spec()

Some filters like TrustedFilter makes use of extra_specs. Currently,
when live-migration uses the scheduler to select a host, it constructs
a request_spec that has no extra_specs in it.

By making use of the existing helper method build_request_spec(), the
request to the scheduler will include extra_specs.

Change-Id: I5bc6c6418653c256a42da7b0a343086ec9863da1
Closes-Bug: #1224014
Resource limits check sometimes enforced for forced scheduling

Resource limit checks on a compute manager are based on the
contents of filter_properites['limits'].   This in turn is
populated by the scheduler after the host has been selected by
scheduler.utils.populate_filter_properties.   The limits value
is taken from the host_state, which is maintained as a local data
in the host manager. The host_state limits values are populated
by the various filters, for example the ram filter sets
limits['memory_mb'] based on its configuration.

In the case of scheduling to a forced host the filters are
bypassed, so the contents of the host_state['limits'] value
depends on whether the scheduler has already placed a non-forced
instance onto that host (and thus run the filters to populate the
limits).   If it has then the compute manager will impose the
limits, if it hasn't then the limits will be empty and there will
be no check.

As forcing bypasses the filters and is a privileged operation the
limits should always be cleared in the filter_properties in this
case to avoid the limit check on the compute manager.

Fixed bug: 1231963

Change-Id: Ic7ff5d1fc652a8bdf6a0cf8e6ef063d9f2e7ab16