Let resource_tracker report right migration status

A shutoff instance can be resized, but resource_tracker only think
active instance is in migration state. This patch let it report
right migration status.

Closes-Bug: #1247610

Change-Id: Ic6ce9c7d8fdecaf812831eb302186133f0ee71b1
add hints to api_samples documentation

Based on my own experience and questions I recently answered in
the openstack-nova channel, these hints could help developers.

Change-Id: Id7350f1a6a834b0de8456fdc28c2db890f2971de
baremetal: Make volume driver use a correct source device

attach_volume() have to take the source device path from returning of
LibVirtVolumeDriver.connect_volume() rather than connection_info.

It also adds a test for attach_volume().

Change-Id: I3bee80560342104e2df614066301171624497a04
Closes-Bug: #1208707
Allow configuring the wsgi pool size

Expose the number of greenthreads in wsgi pool to configuration. This
allows to put a limit to the number of resources like memcache
connections used.

DocImpact
Change-Id: I6e53d6e12661ed2f42a6b543891b13eec0c8300c
Fix AttributeError(s) from get_v4/6_ips_by_interface

Add some defensive code to prevent AttributeError especially
when virtual_interface_get_by_uuid returns None. Add some basic
tests for good and bad data returned from
virtual_interface_get_by_uuid

Change-Id: I0ee1bb2087a6ed2619ac343534e4ade84e08d9bd
Closes-Bug: 1246087
Add flavor-access to core for V3 API

Adds the flavor-access plugin to the core list for the V3 API.
This is part of the process of adding all of the flavor related
extensions to core, with the exception of rxtx, as per the discussion
here: https://etherpad.openstack.org/p/NovaV3APICore

Note that since the alias changes from os-flavor-access to flavor-access
the api samples move directory and quite a few of other api samples
as well as flavor access is included by default.

Partially implements blueprint nova-v3-api

DocImpact

Change-Id: I9abc7df8f4620d462b0d381a2c0ed180c48f220e
Add flavor-extra-specs to core for V3 API

Adds the flavor-extra-specs plugin to the core list for the V3 API.
This is part of the process of adding all of the flavor related
extensions to core, with the exception of rxtx, as per the discussion
here: https://etherpad.openstack.org/p/NovaV3APICore

Partially implements blueprint nova-v3-api

Change-Id: Id4b4fad5e584bdf2bbbaaae579a07e28c312ef34
Remove used_limits extension from the V3 API

Remove the used_limits extension from the V3 API because
it shows usage for limits which are no longer going to be displayed
by the limits extension. See https://review.openstack.org/#/c/39872/
The limits are not being displayed there because they are already
available through the quotas extension.

Although the quotas extension currently only displays the quota limit
and not usage, the following proposed changeset adds display
of usage: https://review.openstack.org/#/c/32303/. And this is done
in a way which is much more consistent in terms of naming and interface
than used_limits does.

So we no longer need the used_limits extension

Partially implements blueprint nova-v3-api

Change-Id: I8ec1f300335ca4fc3b86323cc3af6bc1591da7bb
Fix limits v3 follow API v3 rules

* Add expected_errors decorator.
* Remove 'absolute_limit' from response, that already return by
extension quota_sets. And update api samples.

Partially implements bp nova-v3-api

Change-Id: Iea3ff494b8abed77fdc4b9e5e552784ed3733c34
Use 400 instead of 422 for invalid input in v3 servers core

We return 400 when input is invalid for v3 api. This patch fix
this case for servers core.

DocImpact

Change-Id: If802d4dcba6ed25f7e9cb9d568a3ffd78f0f6c68
Closes-Bug: 1251538
Removed unused instance object helper function

Remove code that is no longer used

Change-Id: Iaf99824ad28aa03206a997e69d9f6097ba034941
Enforce metadata string type on key/value pairs

The compute API is currently enforcing quota limits for user metadata
and length restrictions on the dict entries, but is not enforcing that
they are string types. This patch adds the checks for string type on the
keys and values in the metadata dict.

Closes-Bug: #1240319

Change-Id: Ic4aacc342cf37d929871287e6e4917f4f48b63e8
Use 201 instead of 200 for action create of flavor-manage v3

All of v3 create action should return 201. Fix this for flavor-manage v3

Closes-bug: 1252162
DocImpact

Change-Id: I4fc698abdf89c93cb6ea0990ae43960f8c651d95
Remove V3 API version of coverage extension

As discussed at the summit in the QA session, this removes
the coverage extension from the V3 API. The coverage extension
doesn't work properly and has security issues. An alternative technique,
though more limited in nature will soon be proposed.

Partially implements blueprint nova-v3-api

Change-Id: Ib4296288fefeb7e1e11bb6e44bd1cf355f29b9b9
Remove V2 API version of coverage extensions

As discussed at the summit in the QA stream, this removes
the coverage extension from the V2 API.

According to the API Change Guidelines
https://wiki.openstack.org/wiki/APIChangeGuidelines
we should not be doing this. However the coverage
extension is a rather special case. It has security issues
such that it shouldn't be used in a production cloud
environment. It also doesn't work properly so its usefulness
to measure API coverage is limited. And in the past the presence of
this plugin has been used as a reason not to accept
an alternative technique to measure API coverage.

This is the proposed replacement

https://review.openstack.org/#/c/25882/

Change-Id: I07d798129ee277a6f7691c25f88c07a5204c0943
Add a driver method to toggle instance booting

Add a driver method to toggle the ability to boot an instance.

The only implementation provided is for the xenapi virt driver.  Other
drivers will log a warning and treat the method as a no-op.

Implements: blueprint cleanup-running-deleted-shutdown

Change-Id: Ie448c681d653b126cb12d3a48d79ab4febde8828
Clean up unused variables

This just removes a few variables that were unused and makes my linter
happy.

Change-Id: I0bc9fc1474e15801e4df84f78636c96ea1f916ff
Fix sample parameter of agent API

The parameter of agent update API has been changed from "para" to
"agent" since Nova v3 API, and this patch fixes the sample doc.

Partially implements blueprint v3-api-specification

Change-Id: Ic9c0f11a637e48daa9457ab9ae923fefc0fb350d
Libvirt:Instance resize confirm issue against NFS

when I test resize-confirm on NFS (KVM) using at least two
compute nodes, OSError will occur when try to cleanup the
backup instance directory and will make instance status
"Error".

One way to cleanup resize is using delay_on_retry and
maximum attempts setting. Replace rmtree() because
execute() have more parameters choices.

Closes-Bug: #1248019

Change-Id: Ifb9a500bbba805af0317307c2e7d6903dcd02ad1
Fix empty selector XML bug

The XML serialization fails when it's trying to create a datum selector with no
values. In that case the obj is an empty string so the selection of datum from
it just fails.
Instead of raising an exception the fix is returning an empty string, that
allows to serialize Selector with an empty object.

Fixes bug 1223358

Change-Id: If5d564c9b037eb0a107f4688ffa1aceb5281dc42