Make ec2_instance_create db method consistant across db apis

Fixes bug 1079463

Also changes call to ec2_instance_create in sqlalchemy instance_create
method to go through db api as opposed to direct to sqlalchemy api.

Change-Id: I60136a2c7019bda25225d8e02e82a9ccfbb61e2f
Fix os-hosts extension can't return xml response correctly.

Also add os-hosts integrated testing template files.
fix bug 1075575
fix bug 1070167.

DocImpact

Change-Id: I6b9f9e58e7cbe10a931d2c83d9baf9dcee74de08
Send block device mappings to rebuild_instance.

Send the block device mappings for an instance to the rebuild_instance
method in the compute manager.  This moves a db read from nova-compute
up to the api service.

Part of blueprint no-db-compute.

Change-Id: I15967652cfa539fab3b55c224e8ebbc12363004a
Return an error response if the specified flavor does not exists. (v4)

'nova list --flavor <id>' command outputs empty list, if there is not
any instance or flavor. A user cannot know the reason of empty list easily.
This patch changes a response to error if the specified flavor-id does not
exist instead of empty list.

Example:
 $ nova flavor-list
 +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
 | ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
 +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
 | 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
 | 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      | {}          |
 | 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      | {}          |
 | 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      | {}          |
 | 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      | {}          |
 +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

Before applying this patch:
 $ nova list --flavor 10

 $

After applying this patch:
 $ nova list --flavor 10
 ERROR: Flavor could not be found (HTTP 422) (Request-ID: req-003d4bbc-f338-4361-9eeb-1cf18073a5a8)
 $

Changelog of v4:
 * Change a response code of NotFoundFlavor from 404 to 422.

Changelog of v3:
 * Merge patchset2(change a response of test_get_all_by_flavor) into one patch.
 * Change a response code of NotFoundFlavor from 400 to 404.

Fixes bug 1076863
Change-Id: I45f35ae6a4bf1de734c258ef819fb9b4d7f9681e
refactor: extract method: connect_volume

Related to blueprint xenapi-volume-drivers

Extract connect_volume call from attach_volume, and a test for
attach_volume. By extracting this call, it will be easier to implement
other drivers, by providing an alternate implementation for this
extracted method.

Change-Id: Ie5a17ec7fada26a9df5ba8a29ed0dadeb02516e8
Fix non-primitive uses of instance in compute/manager

We can't rely on the fact that instances are db/sqlalchemy/models
objects. This properly addresses them as dicts.

Change-Id: I7c4c01fc617c6f7e1fd2dfa428efe0b4205557bc
Merge "refactor: extract method: connect_volume"
Detect shared storage; handle base cleanup better.

If base image storage is shared, we need to care about remote
instances when we clean up. This patch "learns" which storage is
shared, and then decides what base images are in use anywhere
on the set of compute nodes which share that base storage.

This is complicated because shared instance storage doesn't have
to be per-cluster. It could for example be per rack. We need to
handle that properly.

This should resolve bug 1078594.

Change-Id: I36d0d6e965b114bb68c8f7b7fd43f8e96b2dd8f5
Merge "Send block device mappings to rebuild_instance."
Merge "Fix os-hosts extension can't return xml response correctly."
Rename sql_pool_size to sql_max_pool_size

A recent patch adds a sql_pool_size config option.  This renames it to
sql_max_pool_size and sets a default that equals SQLAlchemy's default
(5).

eventlet's db_pool allows setting a minimum size, so this is to prep for
adding a sql_min_pool_size option.  Should remove some confusion.

No need to support sql_pool_size for backwards compatibility as it
was to be a new option in Grizzly, anyway.

Also fixes the previous patch to not set pool options if using
StaticPool or NullPool.

DocImpact

Change-Id: Ic41d138a1ee4cdaf785e45091bd5668045153b90
Imported Translations from Transifex

Change-Id: Ib37e2f619ef29c33f7cd5702da1b98577573ad51
Merge "Fix non-primitive uses of instance in compute/manager"
Merge "Detect shared storage; handle base cleanup better."
Merge "Make ec2_instance_create db method consistant across db apis"
Merge "Imported Translations from Transifex"
Merge "Return an error response if the specified flavor does not exists. (v4)"
Merge "Rename sql_pool_size to sql_max_pool_size"