Baremetal driver: remove unused states

NULL and INIT were not used since commit c20110d15be37948ddd9ef5f38001328aabf5b1d

Change-Id: I25c34872b100807d691e7e15f7b70be7ad1912b9
Add support for user_id based authentication with Neutron

Keystone v3 supports non-unique project/user names, so until
the Neutron client provides support for the V3 API and domain
based authentication Nova should allow user ID for admin
authentication.

Change-Id: Idad27ff4206d6ba0bb9aedbbff5172c3144ad3c6
DocImpact: Adds new flag, neutron.admin_user_id
Remove pause/unpause NotImplementedError API layer

There are 2 kinds of RPC call from API layer to compute layer,
one is cast and another is call. For cast, the RPC message will
be posted and the API service will not wait for the message to
be processed. So it won't be able to catch the exception raised
in compute layer, so catch and handle the exception is useless
and error leading. This patch removes code in API layer for
pause and unpause functions.

Change-Id: I7cbb8179b3eec8496b90ff5cf07397522d52c5de
Commit quota when deallocate floating ip

It seems that when you allocate a floating-ip in a tenant with nova-network,
its quota is never returned after calling 'nova floating-ip-delete'
even though 'nova floating-ip-list' shows it gone.
This behavior applies to each tenant individually. The gate tests are passing
because they all run with tenant isolation.

The root cause of the problem is cooperation between
commit 23a27e47 and cbbb9de5. db layer code return floatingip_ref
but object layer didn't. This patch fixed the problem by adding return
value from object layer.

Change-Id: Ide1a338b6c33676311028e8738150e146324a8ee
Closes-Bug: #1347156
Downgrade the warn log in network to debug

Downgrade the log from warn to debug for overquota.
Didn't remove it because it's called internally and it might
be helpful for operater to take a look.

Change-Id: I1d3c27a8d97085d9919180a28018b234392f28e4
Live migration is broken for NFS shared storage

One of the new checks, introduced in
I2755c59b4db736151000dae351fd776d3c15ca39
is missing a check against filebased shared storage,
leading to live migration being broken.

Closes-Bug: #1346385
Change-Id: I096ecd6eadc3b13ef918ca1e6c98acdd01556c0d
Remove useless check in _add_retry_host

In populate_retry, the code already check the case with force_hosts
and force_nodes. (https://github.com/openstack/nova/blob/418398dcca5
52497c8488dbbf54a06e21202b295/nova/scheduler/utils.py#L134)
If the retry is disable, populate_retry won't add retry info into
filter_properties.

_add_retry_host is called later than populate_retry. It also check
the force_hosts and force_nodes, that is useless. (https://github.com
/openstack/nova/blob/418398dcca552497c8488dbbf54a06e21202b295/nova/
scheduler/utils.py#L193) It only need check whether retry info exist
in filter_properties or not.

Change-Id: I1f83b4b584d36aa6f894180d43aee24f096b4f78
Handle NotImplementedError in server_diagnostics v3 api

In libvirt driver, it doesn't implement the function of
get_instance_diagnostics().it returns http 500 error No.
we expect http 501 if the function is not implemented.

Change-Id: I59bfaa27b96284bd56917096e0c3fab0d277ba96
Closes-Bug: 1349680
Allow to unshelve instance booted from volume

When we shelve an instance, volumes are not detached from cinder to kept
them 'In-Use' in cinder
But when you unshelve this instance, nova ask cinder the reattach theses
volumes. This fails, because volume cannot be attached twice.

This patch permits when we ask the libvirt DriverBlockDevice to attach a
device to the instance to bypass the cinder attachement code that is not needed
when we unshelve an instance, because the cinder volume is kept 'In-use'
during the 'shelved' state.

Co-Authored-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
Closes-bug: #1305399
Change-Id: I780a9407feeb48ecd3e295508ce3e6bc3b09d3e6
Convert network/api.py get calls to use Network object

This makes the network api module use the Network objects for
get() and get_all() operations. There were no tests for these methods,
so this patch adds them in the process.

Related to blueprint compute-manager-objects-juno

Change-Id: Iea1104a111e50a796077cdf0ed5b0f4e75bfcbcb
Convert network/api.py fixedip calls to use FixedIP object

This makes the network/api.py module use the FixedIP object for
fetching fixedip information instead of direct database access.
There was not complete test coverage for these calls, so it is added
here.

Note that this includes a change to the FixedIP object, which allows
for the case that fixed_ip_get_by_floating_address() can return
None. This is technically an RPC-visible change that would normally
require a version bump. However, I don't think it's worth bumping
the version here since this bug would cause calls to explode in a
non-useful way, thus preventing callers from being able to tolerate
the case where the DB call returns None.

Change-Id: Id8a9c8d2d10ddfaf0990258ac496da7c48a9b28c
Remove duplicate index from block_device_mapping table

Migration 186 (doesn't exist anymore) deleted the column virtual_name
from the the block_device_mapping table. This ended up modifying an
index (block_device_mapping_instance_uuid_virtual_name_device_name_idx)
to be identical to (block_device_mapping_instance_uuid_device_name_idx)

Closes-Bug: 1265839
Change-Id: Ib293220eb764e9810212d121ce7889e6aefc266e
Update scheduler after instance delete

Previously deleting an instance would update the scheduler resources
fairly quickly. There is now a delay when deleting an instance until the
scheduler makes the resources available again. This appears to be due to
the fact that the delete code path used to call resource tracker to
update the compute_node record but this no longer happens.

Closes-Bug: 1336080
Change-Id: I837b70ce06843ff83481d4985c9c08b74d20cab0
EndpointNotFound deleting volume backend instance

When there is some error in volume creating on booting from volume,
we may get the EndpointNotFound exception when deleting the error instance.
Then we can never delete the instance successfully. The exception should
be ignored.

Change-Id: Ia92b648eb18c70996747d361e227de771f33ee9c
Closes-bug: 1346866
docs - Add an index for the command line utilities

Change-Id: I03376a9159c3ef6c2b65cce417a217db68e8c246
docs - Prevent eventlet exception during docs generation

build_sphinx has a lot of spurious tracebacks, We don't
really need this check for document generation

Change-Id: Id9442c5902918592c4c242cc66975062cf9f2461
docs - Fix indentation for RPC API's

Fix ERROR(s) and WARNING(s) during docs generation because of
bad indentation, spaces etc.

Change-Id: I450e929fbc8e148491b8b0a96a8c6d2aff605ab4
docs - Fix doc build errors with SQLAlchemy 0.9

The Nova docs failed to build when using SQLAlchemy 0.9. Among
the errors that are reported is this one:

nova/db/sqlalchemy/api.py:docstring of nova.db.sqlalchemy.api.select:12:
WARNING: undefined label: coretutorial_selecting (if the link has no
caption the label must precede a section header)

nova/openstack/common/db/sqlalchemy/utils.py:docstring of
nova.openstack.common.db.sqlalchemy.utils.or_:26: WARNING: more than one target found for
cross-reference u'and_': nova.db.sqlalchemy.api.and_,
nova.virt.baremetal.db.sqlalchemy.migrate_repo.versions.006_move_prov_mac_address.and_

nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/006_move_prov_mac_address.py:
docstring of nova.virt.baremetal.db.sqlalchemy.migrate_repo.versions.
006_move_prov_mac_address.and_:35: WARNING: more than one target found for cross-reference
u'or_': nova.db.sqlalchemy.api.or_, nova.openstack.common.db.sqlalchemy.utils.or_

nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/006_move_prov_mac_address.py:
docstring of nova.virt.baremetal.db.sqlalchemy.migrate_repo.versions.
006_move_prov_mac_address.select:12: WARNING: undefined label: coretutorial_selecting
(if the link has no caption the label must precede a section header)

To fix this, the imports causing breaks were removed and changed to more specific/better
imports

Change-Id: I83cf38c03cef8bb3186160a660d30979cc303839
Only get image location attributes if including locations

Commit 155eeabbfafd4f48b47fea5b403f61a6e5c28426 added 'direct_url' and
'locations' to the list of attributes to get from an image which makes a
call back to glance if the attributes aren't on the image, and can
result in a 404 if they aren't available, which would be in the glance
v1 API case.

This change simply passes the new include_locations parameter down to
_extract_attributes so we can do the proper filtering.

Change-Id: I903fa5c781fed52183b340dc3d9bc4b6598b21ce
Partial-Bug: #1351333
Add policy on how patches and reviews go hand in hand

There is currently a misconception about how a patch gets merged:
Author proposes a patch, review team reviews it. Us, and Them. Instead
it should be a 'We.'
If the review bandwidth doesn't grow at the same rate as the patch
proposal rate then we end up with a massive backlog where people are
pinging cores for reviews.

Record a recommended policy of asking patch authors to offset the review
resources spent on their patch by reviewing other patches.

Change-Id: I50653f8ea58240fa664519f544ce16b2adf39006