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
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
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
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
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
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
VMware: Always upload a snapshot as a preallocated disk

Currently, a snapshot operation always produces a preallocated
disk type. When the snapshot is uploaded to glance, the source
image metadata is uploaded with the new snapshot and then some
of the metadata properties are updated. The update doesn't
include the disk_type property, this can be problematic. If
the original image has a sparse disk type and a snapshot is
taken, then the snapshot which is a preallocated disk type is
uploaded to glance with the disk_type property set to sparse,
which creates a disk type mismatch and causes errors when a vm
is spawned from that snapshot. This patch addresses the issue
by correcting the image metadata used when uploading a snapshot
to glance.

Also, the image_upload function in vmwareapi/fake.py has been
modified to address the change. Any function call to
image_upload (from the unit tests) will assert that the
metadata for the image to be uploaded must have the disk_type
value to be preallocated.

Closes-Bug: 1247296
Change-Id: I71cfa8d4d1eb7911abb489153292fb0d1e614765
Clean up how test env variables are parsed

Oslo and cookiecutter and other projects were using
variable to parse test environment vaiables. Let us
do this in Nova

This is copied from 739627bf79619f8 Use cleaner version from
cookiecutter OpenStack template

Change-Id: I4c2b4072981985e7632fc775ffc98216fbfc0508
VMware: add support for VM diagnostics

The drivers now return diagnostics for a requested VM.

Implements blueprint vmware-vm-diagnostics

VMware specific keys will be namespaced.

DocImpact

Change-Id: I08f199f7e3b4edafe60ce73d2fc833f8c5a5574e
Removes os-personalities extension from the V3 API

As per the discussion on the mailing list here:

http://lists.openstack.org/pipermail/openstack-dev/2013-September/015490.html

and discussions at summit, this patch removes the os-personalities
from the V3 API.

DocImpact

Part of blueprint v3-api-remove-extensions

Change-Id: I1a57ca812a9d71c0b1bab5d16ffad8eb82cba539
Remove traces of V3 personality extension from api samples

Removes occurences of the personality extension from the V3 API
samples as the extension has been removed. Cleanup of consistency
of image and flavor ref examples for the api samples.

DocImpact

Partially implements blueprint v3-api-remove-extensions

Change-Id: I43a34097904d3d7e280039c3d5d76479a49e92d0
Check if reboot request type is None

If the reboot request type is None, raise HTTPBadRequest like if the
argument was missing.

Change-Id: I75b1791b7a6c9304c3a78e869fe63d72302fc9d8
Closes-Bug: #1247735
Removes check CONF.dhcp_options_enabled from nova

* Neutron supports extra_dhcp_opts since Havana
* Hence remove boolean check dhcp_options_enabled

Closes-Bug: #1214162
DocImpact
Change-Id: I9af217a87a237e078e70332cbed1c80ad4d5db0a
ComputeFilter shouldn't generate a warning for disabled hosts

Disabling a service is a normal operation, so this state should
not be included in the same log statement as a host that fails
the service_is_up() check.

A service which is enabled but not up deserved a warning rather
than debug entry.

By separating out the checks we also avoid the service check on
disabled hosts.

Change-Id: I1a398bc033ebe71f42ac117af7dae39502aceede
Closes-Bug: 1254356
fakevirt: return hypervisor_version as an int instead of a string

The compute_nodes.hypervisor_version type in the database is an integer
not a string. This is only caught in postgres and not MySQL. Changing
the fakevirt driver to return the proper type allows for the
test_virt_drivers test to make check this for all drivers it currently
tests.

Change-Id: I25e4dba855b954a2451bced9a53172b51eb47238
Fix logic in LibvirtConnTestCase._check_xml_and_uri

The _check_xml_and_uri method has two loops making it
iterate over different hypervisor types. By default it
will iterate over qemu, kvm, xen and lxc, but it can be
made to only check xen by setting the 'xen_only' param
or the 'expect_xen_hvm' parameters.

Unfortunately the second loop is only filtered if the
'expect_xen_hvm' parameter is set, not if only the
'xen_only' parameter is set. This flaw hasn't showed
up before, due to a flaw elsewhere in the libvirt
driver code, cancelling it out.

Change-Id: If70faa05975b726067ab6edaa505ca8d0c230a38
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>