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
Add instanceset info to StopInstance response

Currently stopinstance response missing the instanceset
information with InstanceID, current state and previous
state details. It just returns the "True".

As per the AWS EC2 API reference document, the StopInstance
response elements should include the instanceset information
as below:
<StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
  <requestId>req-a7326465-5ce2-4ed6-ab89-394b38cca85f</requestId>
  <instancesSet>
    <item>
      <instanceId>i-00000001</instanceId>
      <currentState>
        <code>80</code>
        <name>stopped</name>
      </currentState>
      <previousState>
        <code>16</code>
        <name>running</name>
      </previousState>
    </item>
  </instancesSet>
</StopInstancesResponse>

Included the instanceset into stopinstance response elements
and updated the test cases for stopinstance response elements
in nova/tests/api/ec2/test_cloud.py file.

Closes-bug: #1321239

Change-Id: I4d8a6faf2689a7df71920183682fd1e403ce2a42
Send compute.instance.create.end after launched_at is set

Downstream consumers of notifications want to know when an instance was
launched from the compute.instance.create.end notification.  This value
was previously set in the notification but commit
70196c4854e6cc1cb566dc9fc5b1a3397a4b69ab changed things so that it was
no longer set.  It will now be set, and is tested to be set.

Change-Id: If5ac00529d52e3898cda7fd942535ed3ba2039d5
Closes-bug: 1338736
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
Fix extra metadata didn't assign into snapshot image

create_image action API accept metadata parameter to add extra
metadata into snapshot image. But the current code doesn't work
for snapshot of volume based instance. This error is because the
code use var 'props' to store extra metadatas, and the code use
same var to store root bdm metadata later, then the extra metadata
is overwritten by root bdm metadata. This patch use another var
'properties' to store root bdm metadata to avoid overwrite the
extra metadata.

Change-Id: I2224905f596690e22aa71dc6541284f005ebba9d
Closes-Bug: #1347355
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