Add host to instance_faults table.

Instances can be rescheduled or migrated to different hosts; so, to make
troubleshooting easier, it's convenient to store the host in which the
failure occured with the instance fault record.

Change-Id: Ib2b9a5bab5d95739b730f0eab15884c2db33a782
Ignore auto-generated files by lintstack

Part of blueprint lintstack

Change-Id: I6ca0ec71c7fa083a86920a7ae055ef8e9d19c512
Go back to the original branch after pylint check

Previously we save the current commit hash before running lintstack.
This is no problem for Jenkins but not very friendly if we run
lintstack locally. Every time after it's done, git is in detached
HEAD mode. This patch remembers the current branch name and
automatically go back to the branch if available. Otherwise we fall
back to the commit hash.

Part of blueprint lintstack

Change-Id: I145df3027022fc9a8302bc6da9ab300f677f3386
Merge "Add host to instance_faults table."
Fix wrong quota reservation when deleting resizing instance

When we delete an instance which is resizing from m1.small to m1.tiny, we use
instance['memory_mb'] to create quota's ram reservation, if the resizing is not
'finished', the in_use value in quota_usages is NOT commited(2048M),
but the instance['memory_mb'] is updated(512M) in _finish_resize(), so the
deleting operation after updating will commit a wrong ram reservation(-512M),
and the in_use value changes to 2048-512=1536.
The cores reservation encounters the same problem.

Fixes bug #1099729

Change-Id: Ide54fc9d822041f535819c496822aeac5a8dc68d
Cells: Fix for relaying instance info_cache updates

The update_cells argument was ignored in db/api.py.  The API cell when
doing an update calls this with False to prevent relaying the request
back to itself... but it was being relayed anyway.

Change-Id: I5a40c878a547e81605dc40f0077b7c6e20ee3ad4
Refactor: extract method: driver_dict_from_config

Related to blueprint xenapi-volume-drivers

Extract method to create driver registries, so that it could be re-used
in xenapi for a similar purpose.

Change-Id: Ifd25d12335ac96a15dfea4c5ab7f315ff7ddfd8b
XenAPI: Fix volume detach

fixes bug 1101229

The code-cleanup and code-move changes from this patch:
https://review.openstack.org/#/c/19219/
introduced a problem: the volume_utils.find_sr_from_vbd method was
called after the vbd has already been destroyed. This change fixes the
issue by moving the sr discovery before the vbd destruction, and tests
the call order by using side effects.

Change-Id: Ide4f8ac810f98bb192909f5f0408affc940e7446
Remove some db calls from db servicegroup driver.

The base service code already ensures that a service record is created.
Store that in the service object.  Then down in the servicegroup db
driver, access it instead of having to go look it up again.

Part of bp no-db-compute.

Change-Id: Ife3c98c29c6f654585e14ded5a9b4c7e3bec226d
Add service_update to conductor.

Add a service_update method to the conductor API.  This will be
necessary for removing direct db access from the servicegroup db driver.

Part of bp no-db-compute.

Change-Id: Ic9a205ed4e810ee3511378742f764b2b311174a7
Use conductor in the servicegroup db driver.

This patch updates the servicegroup db driver to use the conductor API
in the cases where it was accessing the db directly before.  If the
service is allowed to do direct db access, the conductor API will
optimize the call to go straight to the db.  Otherwise, it will invoke
rpc to a remove conductor service to perform the operations.

Part of bp no-db-compute.

Change-Id: I96adffc6f80288c829d84f170414613a35b5c840
Remove restoring soft deleted entries part 1

There is no need to reuse deleted entries, because they will be archived after
db-archiving implementation. And restoring soft deleted entries produce some
problem with db-unique-keys implementation. So the best way is to remove it.

instance_type_access_add() method
Remove restoring soft deleted instance_type_access entries

instance_type_extra_specs_update_or_create() method
Remove restoring soft deleted instance_type_extra_specs entries
Add missing transaction

aggregate_host_add() method
Remove restoring soft deleted aggreagate_hosts entries
Add missing transaction

blueprint db-session-cleanup

Change-Id: Ida7db95233c40faacac55105650f52d42ad360c2
Remove restoring soft deleted entries part 2

There is no need to reuse deleted entries, because they will be archived after
db-archiving implementation. And restoring soft deleted entries produce some
problem with db-unique-keys implementation. So the best way is to remove it.

instance_type_access_add() method
Remove restoring soft deleted instance_type_access entries

Add missing tests for instance_type_access_add

blueprint db-session-cleanup

Change-Id: I82ee56b50a8422a4b620f4e58967258bac7c01c6
Merge "don't allow crs in the code"
Merge "Makes sure compute doesn't crash on failed resume."
Merge "Cells: Fix for relaying instance info_cache updates"
Directly copy a file URL from glance.

That patch allows nova to use shutil to copy a file directly from the
glance store.  For this to work glance needs to enable direct_url
descriptions in the image metadata.  This is done by setting
show_image_direct_url to True in glance-api.conf.  The path used to back
glance also must match the path used to back nova instance storage.  This
should be a large performance increase for the cases where both glance
and nova instance storage are backed by a shared file system like gluster
or ceph.

A new option has been added to nova: allowed_direct_url_schemes
This option is set to a list of schemes that can be directly accessed.
For this first simple patch only file:// is valid, and the
implementation is simple and inline.  In the future it would be better
to make this into propagation modules which are dynamically loaded
according to the scheme.

DocImpact
Implements: blueprint direct-file-copy
Change-Id: I041b5524f8a0ea59e89ece0202f0503abf2f9d8e
Merge "Save password set through xen agent."
Refactor EC2 keypairs exception

According to the following document:

http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/api-error-codes.html

The EC2 API sends specific error codes when keypair listing or
keypair generation fails, specifically the error codes are

InvalidKeyPair.Duplicate - duplicate keypair
InvalidKeyPair.Format - keypair format invalid
InvalidKeyPair.NotFound - keypair not found
ResourceLimitExceeded - keypair quota exceeded

Refactored create_key_pair and describe_key_pair so that
it throws the correct EC2 error codes according to the
public EC2 API specs.

Also removed some duplicate exceptions as well.

Fixes LP: 1072318

DocImpact

Change-Id: Ib7045e49211d9300e9cb6ca0bfe80e569d635c9b
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Merge "Remove some db calls from db servicegroup driver."