Clean up db.sqla.api.instance_* methods

Remove session parameter from public db methods:
instance_get_all_by_filters
instance_metadata_get
instance_metadata_update
instance_system_metadata_get
instance_system_metadata_update

They were never called with session parameter and they
are fully covered by tests so we are able just to remove
session parameter.

Clean up instance_metadata_get and instance_system_metadata_get
Convert rows to dict in one line instead of 4.

blueprint db-session-cleanup

Change-Id: Ib2f50cc4b5a7a2e283d891141a88c7b1ff9f7d43
Clean up session in db.sqla.api.get_ec2 methods

Remove session parameter from public methods

  get_ec2_volume_id_by_uuid
  get_volume_uuid_by_ec2_id
  get_ec2_snapshot_id_by_uuid
  get_snapshot_uuid_by_ec2_id
  get_ec2_instance_id_by_uuid
  get_instance_uuid_by_ec2_id

Because they are never called with session parameter
we could just remove it.

blueprint db-session-cleanup

Change-Id: Iecced3cf144de4f58a1169ed2d8f6940e229bedb
Convert camelCase attribute naming to camel_case

Convert cases of camelCase attribute naming to camel_case in the
security groups V3 API to make the v3 API as whole consistent in the naming
of attributes

Partially implements blueprint nova-v3-api

Change-Id: I3def0508d62194545a506ce845cfbfa2b87fd6f9
Convert CamelCase attribute naming to camel_case for servers V3 API

Convert cases of CamelCase attribute naming to camel_case in the
servers V3 API to make the v3 API as whole consistent in the naming
of attributes

Partially implements blueprint nova-v3-api

Change-Id: Ie2c790ae8eb01f02d754911b0a10c4061d0b4a92
Clean up session in db.sqla.api.network_* and sec_groups_* methods

Remove session parameter from network_get():
Create _network_get() that contains same logic that old network_get(),
for internal usage, and new network_get() doesn't contains session
parameter.

Remove session parameter from:
security_group_default_rule_get()
and
security_group_default_rule_list()

They are never called with session parameter.

blueprint db-session-cleanup

Change-Id: If09d13112a35ca40dd288705cfb727d3c7a74774
Clean up session in db.sqla.api.migration_* methods

Remove session parameter from migration_get():
Add _migration_get() that contains same logic that old migration_get(),
for internal usage, and new migration_get() that doesn't contains session
parameter.

Remove session parameters from:
migration_get_unconfirmed_by_dest_compute()
migration_get_in_progress_by_host_and_node()

They are never called with session parameter.

blueprint db-session-cleanup

Change-Id: I3664c78b6aba4c0640903d0f935bc261d5d2129b
Finish DB session cleanup

Remove session parameter from:
 agent_build_get_by_triple()
 bw_usage_update()
They are never called with session parameter

Rename aggregate_get_query() -> _aggregate_get_query()
because it is private method

Enable N309

implement blueprint db-session-cleanup

Change-Id: Idd43d230105cb140d8825a251f03a58ea28cce90
Do not use context in db.sqla.api private methods

We shouldn't check context in private methods,
because context are already checked by public
methods.

Change-Id: I5582c7761c4fb2b2fbfee6e5a2ba77a4c7dd8583
xenapi: retry when plugin killed by signal

Sometimes the glance upload will get killed because of a signal. We
should retry the upload on these types of errors.

It is currently unclear where the signal comes from, so further
investigation is required to determine why the signal gets raised. It
does not appear that any services are restarting at the time the signal
gets raised.

This change has also increased the coverage around the unit tests for
the glance upload, so we now test the try logic.

Fixes bug 1207746
Change-Id: I116be92e153cf27c353cb20168a67b2c0b3cd595
Retry failed instance file deletes

This change adds a new column to the instances table named "cleaned".
This column indicates that the instance files on disk have been
deleted for that instance, assuming that the virt driver you are
using supports that feature (which only libvirt does for now).

Then the flag instance_delete_interval specifies how often to
retry deletes. The default is five minutes. A value of zero will
disable retries.

The number of attempts to delete instance files is tracked in
system metadata. We give up after maximum_instance_delete_attempts
attempts at cleaning up the files.

This change is done in this way because cleaning will become a more
generic concept in the next patch.

DocImpact: the following new flags are added...

 - instance_delete_interval: how often to try to clean up instance
   files

 - maximum_instance_delete_attempts: how many attempts to have before
   giving up

Resolves bug 1040110.

Change-Id: I895869e18f92ed57bd2f8c1683cf9a398d88b680
xenapi: remove dup code in make_step_decorator

There is duplicate code in the VMOps class and the make_step_decorator
function. This change makes the make_step_decorator class share code
with the VMOps class for updating progress.

Part of the steps towards unifying spawn and finish_migration.

Change-Id: I98ea9998ba5968f438b69e2b90331ae25cade3e6
Avoid extra glance v2 locations call!

In 7df1c911 we added code to attempt to direct download
images from glance locations. This feature is meant to be off
by default however when it is disabled it adds an unnecessary
glance V2 API call.

This patch removes the extra get_locations call when
CONF.allowed_direct_url_schemes is empty (disabled). This effectively
fixes Nova on Python some 2.6 distros which fail to work with the
recent Glance V2 schema code.

Fixes LP Bug #1208656

Change-Id: I0989ed4f248cd1126d4703ad6498cfd66685ae31
Merge "Convert camelCase attribute naming to camel_case"
Merge "xenapi: retry when plugin killed by signal"
Merge "Avoid extra glance v2 locations call!"
Imported Translations from Transifex

Change-Id: Iee5d22a1cdd1491725d755fe918e36fbdeb89d18
Merge "Retry failed instance file deletes"
Make NovaObject.get() avoid lazy-load when defaulting

Right now, NovaObject.get() will not properly emulate the dict
get() operation where a default value is returned if unset.

This makes it do that, and avoid attempting a lazy-load in the case
where a default is passed for a not-loaded value.

Related to blueprint compute-api-objects

Change-Id: I298d44b82591c14e877b56744eace5d9ddb93198
Merge "Clean up db.sqla.api.instance_* methods"
Merge "Clean up session in db.sqla.api.get_ec2 methods"