Remove a couple of unused stubs

Found a couple of unused stub functions in API fakes when grepping for
something else related to volumes.  Remove these.

Change-Id: I02412f586465d8f628af0a16af969035d779ff1e
Safe db.api.compute_node_get_all() performance improvement

Scheduler stores the essential information for its work in DB in 3
tables: 'services', 'compute_nodes' and 'compute_node_stats'. For
each compute node, there is 1 record in 'services', 1 record in
'compute_nodes' and about 10 records in 'compute_node_stats'.

Each user request to scheduler to schedule an instance results
in a call to the db.api.compute_node_get_all() method which fetches
the information about all the compute nodes, their services and
corresponding stats in a single list.

There were 2 problems with the previous implementation of this
method. The first one was connected with network traffic: the
use of JOIN operation resulted in redundant informaion
returned from the DB in the resulting denormalized table. The
second one was a performance problem in the SQLAlchemy ORM's
implementation of data processing (slow model mappings in JOINs).

As we are just returning all the data from these 3 tables, we
have implemented a lower-level approach to solve these problems:
to reduce the network traffic, the new implementation of this
method fetches all the necessary data from 3 tables separately,
querying only for those columns that will be actually needed by
the scheduler ('created_at', 'deleted_at', 'updated_at' and
'deleted' columns get removed if the 'no_date_fields' parameter is
set to True). It then joins these tables manually, which allows
to avoid using the slow SQLAlchemy ORM's model mapping and thus
enables to speed up the whole process significantly.

We have tested the new implementation against the old one (with
the 'no_date_fields' parameter set to True). In our test example,
we have 10k services, 10k compute_nodes and 100k records in the
compute_node_stats (each key and each value is 15 characters in
length) database. The results are as follows:

+---------------------------------------+-----------+---------+---------------+
| Approach                              | Time      | Traffic | Python memory |
+---------------------------------------+-----------+---------+---------------+
| ORM joinedload (all columns)          | 15.58 sec | 26.8 MB | 579.9 MB      |
+---------------------------------------+-----------+---------+---------------+
| ORM joinedload (filtered columns)     | n/a       | 17.2 MB | n/a           |
+---------------------------------------+-----------+---------+---------------+
| core + manual join (all columns)      | 7.67 sec  | 9.4 MB  | 223.6 MB      |
+---------------------------------------+-----------+---------+---------------+
| core + manual join (filtered columns) | 5.15 sec  | 5.6 MB  | 112.5 MB      |
+---------------------------------------+-----------+---------+---------------+

So our new implementation has 3 times better performance, uses 5 times
less traffic and yields 5 times less memory usage than the old one.

Test data was edited slightly here to reflect the real-world system
behaviour (services corresponding to compute nodes come with
binary='nova-compute').

Change-Id: Ie5ef00c974b810336787e88c78c93c15ca2890d3
Partial-Bug: #1212428
Improve db_sqlalchemy_api test coverage

Added new tests and improved coverage for methods:

 instance_group_*
 migration_*
 task_log_*
 agent_build_*

Blueprint: db-api-tests

Change-Id: Idbf704b3e6aa8df1d4f927e67d108e6a8489b9d2
Merge "Make xenapi capabilities['enabled'] use service enabled"
Merge "Add PCI stats"
Merge "PCI alias support"
Correct default ratelimits for v3

* 'change-since' was changed to 'change_since' for v3
* Use the ratelimits middleware that is in v3 limits

fix bug 1216467

Change-Id: I8c466cf2ad8a1f00f002050db01ab68404f607e5
Disconnect from iSCSI volume sessions after live migration

The live migration source host will now disconnect from
iSCSI volume sessions after the VM is successfully migrated
to the destination host.

Fixes bug 1132146
Change-Id: I132869612bdf2baa810756586e643ea68ea8d8f6
Merge "Add env to make_subprocess"
Merge "Fix Instance object issues"
Improve parameter related EC2 error codes

This patch replaces parameter/attribute related raises of EC2APIError
with specific exceptions.

 * Introduce new MissingParameter exception with 'MissingParameter'
   ec2_code.
 * Introduce new InvalidAttribute exception which isn't a valid EC2
   error code but it's needed nonetheless as the nova EC2 API isn't
   fully compatible.
 * Add 'InvalidParameterValue' ec2_code to existing
   InvalidParameterValue exception and use it where appropriate. Also
   add it to existing InvalidPortRange exception.

Implements: blueprint ec2-error-codes

Change-Id: I7820edfd9045fdc817a8538a754c9add20b68cf4
Introduce Invalid* EC2 error codes

ec2_code attribute with valid EC2 error code was added to several
Nova exceptions to allow simple error code mapping in EC2 API.

Implements: blueprint ec2-error-codes

Change-Id: Ica5cdf4a9662b4b569ded1f1b1931b9a3cdaa9f3
Merge "fix volume swap exception cases"
Use implicit nullable=True in sqlalchemy model

In sqlalchemy nullable defaults to True, so we don't need to explicitly
set the value to the default.  By removing all nullable=True everywhere
it makes it easier to spot the nullable=False and also should lead to
less confusion when adding a new column (do I need to add nullable or
not, only some other columns do it)

Change-Id: I22fe2d0caca77005553a6a6f0c7cc2d3e8ea5512
Merge "Add DocStrings for function allocate_for_instance"
fix bad usage of exc_info=True

To use parameter exc_info in logging, here
(https://review.openstack.org/#/c/38077/) also uses some bad usage of
that. This patch will fix:
* use trackback.stacktrace() instead of exc_info
* use "Error: %s" % exc_info[1] (removing .message to follow PEP352)

Change-Id: Ia661ea9ce760f51359193904b77f7323434ed463
Merge "Object support for instance groups"
Merge "Fix untranslated log messages in libvirt driver"
Fix race when running initialize_gateway_device()

If multiple calls that result in initialize_gateway_device() being
run occur at roughly the same time then there is a race between the
ip route commands being run at the same time. This will cause
instances to go into an error state. This commit adds a global lock
to the initialize_gateway_device() method to prevent it from being
run at the same time to avoid this issue.

The race condition is not directly testable in unit tests because it
requires a multithreaded environment to run
initialize_gateway_device() at the same time. It was uncovered
with tempest in parallel.

Fixes bug 1217163

Change-Id: Ib750381636d1341062928d0abc8d3518e327935e
Merge "Raises masked AssertionError in _test_network_api"