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
VMware: remove local variable

Make use of the instance.root_gb instead of reading the value
into a local variable.

TrivialFix

Change-Id: I2ae4a9d2f5383ff05f47d00550c1c917fedc5db9
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
Parse unicode cpu_info as json before using it

If the extra specs are some of this:
- (capabilities:cpu_info:vendor, Intel)
- (capabilities:cpu_info:topology:cores, 2)
- (capabilities:cpu_info:features, <in> rdtscp)

It doesn't work because the cpu_info is loaded as unicode in HostState.
The patch fix these cases by parsing the cpu_info to dict.
Update: use six.string_types instead of unicode.

Change-Id: Ieabf95b1e3e5893ced16c0571c29b13b252df5d1
Closes-Bug: #1331176
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
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
Fix ownership checking in get_networks_by_uuid

The code was elevating context before requesting networks which
means that the project_only code is skipped and all networks
could be retrieved. This means that the default networks returned
by FlatDhcpManager could include networks that belong to other
projects.

This fixes the issue by requesting the network without elevating
the context, re-enabling the proper project checking. It includes
tests to verify that the proper exception is raised when an
illegal network is requested and that the context has not been
elevated by the compute manager.

Partially-implements blueprint better-support-for-multiple-networks

Change-Id: Icd3bc521003725cc3da9875dfd6532d5c5524f43
Closes-Bug: 1331092
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 - fix missing references

Change-Id: Ia33fc8a3495ef6d4b929aa88efccc002616475fc
docs - Add an index for the command line utilities

Change-Id: I03376a9159c3ef6c2b65cce417a217db68e8c246