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
Removed unused instance object helper function

Remove code that is no longer used

Change-Id: Iaf99824ad28aa03206a997e69d9f6097ba034941
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
objects: declare some methods as static

A lot of code is composed of static methods, but they are not declared
as is.

Change-Id: I64be630b560e331aed9d1ab9a68152da52eb0d82
handle migration errors

handle errors:
   MigrationPreCheckError, NoValidHost,
   InvalidSharedStorage and InvalidLocalStorage
in _migrate_live so that the 'reason' is passed up

Closes-Bug: 1250523

Change-Id: I3d7e0626223f2606c5e7205e5022e26585506cfb
Use of logging in native thread causes deadlock connecting to libvirtd

When connecting to libvirtd daemon we were calling the _connect
method in a native thread. The use of logging in this method hit this
bug in eventlet https://bitbucket.org/eventlet/eventlet/issue/137/
causing nova-compute to hang.

Closes-Bug: #1252409

Change-Id: I0d22c3ed1b3288aeb1afae130f11a4f38dc6440a
baremetal: Make api validate mac address

Check if the address in the form of xx:xx:xx:xx:xx:xx.

Closes-Bug: 1238595
Change-Id: Idcba745a011604d7664b62d88f1dede88d10443d
Pass Instance object to spice compute rpc api

Update the get_spice_console() method of the compute rpc api to take in
an Instance object instead of a dict.  The object_compat() decorator is
used to maintain backwards compatibility with receiving a dict.

Change-Id: I0bafe18d9c8bffcd0b72629542fbf7aedacdfbb4
Remove duplicate FlavorNotFound exception handling in server create API

The v2 and v3 openstack server create APIs have duplicate handling for
the FlavorNotFound exception. This patch removes the duplicate handling
which is found in a generic catch-all block for each API.

Closes-Bug: #1256427

Change-Id: I78344cd588178c501398147f3afcd418e0744b0d
Move flags in libvirt's volume to the libvirt group

This change continues moving libvirt specific flags into a libvirt
specific configuration group.

Progresses blueprint libvirt-opts-group.

DocImpact: the following flags have moved into the libvirt group:
    num_iscsi_scan_tries
    num_iser_scan_tries
    rbd_user
    rbd_secret_uuid
    nfs_mount_point_base
    nfs_mount_options
    num_aoe_discover_tries
    glusterfs_mount_point_base
    iscsi_use_multipath (formerly libvirt_iscsi_use_multipath)
    iser_use_multipath (formerly libvirt_iser_use_multipath)
    scality_sofs_config
    scality_sofs_mount_point
    qemu_allowed_storage_drivers

Change-Id: I78941aff4bf49fc70d91a3239deff44dbaaab6c9
Remove _security_group_chain_name from nova/virt/firewall.py

The function _security_group_chain_name in nova/virt/firewall.py is
useless for now, just remove it.

Change-Id: I1ad7050115ad56ce7b152efbcfcc42aff8e6c3ed
Catch InstanceIsLocked exception on server actions

In v3, if the server is locked, a 409 error is raised, and the error msg
is like "the server is locked". In v2 now, the 409 error is raised too. But the
error msg is like "Instance is in an invalid state for \'pause(action name)\'".
The error msg is inappropriate, two points:
1. the state is valid for pause
2. the message doesn't tell that the instance is locked

The patch fixes the ploblem, and will do as v3. See the v3 commit:
2c9fca6a3c916f3f594ddbb1a8ee8946b8ea3ac7

Change-Id: I76572e37af686a4af35c31a3ea27f7070894b88a
Closes-Bug: #1255386
libvirt: host update disable/enable report HTTP 400

When disable/enable host with host-update command, end user will
get HTTP 400 error even if the host was updated(disabled/enabled)
successfully.

The root cause is that after the host was disabled/enabled, nova
api need depend on host status result to check if the host was
disabled or enabled, but libvirt driver did not return host status
to nova api.

Change-Id: I0688134eecb0628b680c8ed01741f00f80eec53f
Closes-Bug: #1251589
Correct network_device_mtu help string

This patch corrects the network_device_mtu help string. This setting
changes the mtu size for the interface not the vlan.

Change-Id: I2f3bcac42f08b70eb1649e3085c0de9af27b350c
Closes-bug: #1256696
Comply with new hacking 0.8 release

Fixes a couple of small issues to pass all PEP8 tests in
the new hacking release

H235  assert_ is deprecated, use assertTrue
H231  Python 3.x incompatible 'except x,y:' construct
H234  assertEquals is deprecated, use assertEqual
H301  one import per line
H302  import only modules
H233  Python 3.x incompatible use of print operator

Change-Id: I0e5e74944e2b034b223ada1b3d0be66f2a9a5722
Merge "Add a driver method to toggle instance booting"
Recover from build state on compute manager start-up

If a compute manager is stopped / fails during a build operation
then the instance will be left stuck with vm_state=BUILDING

During restart the one thing we can be sure about such instances
is that providing the task state is not SCHEDULING (i.e the request
is not still on the queue) then there is no thread running for this
instance.

In this case we can treat instances in this state as if they have
failed to spawn and put the into an ERROR state.

Closes-Bug: 1197024
Related to blueprint recover-stuck-state

Change-Id: I7b116d8154036c43b0feb23f5669f52358408d2b