Flavor extra specs extension use instance_type id

bug 1031263

The nova database API use instance_type id as parameter to access flavor
extra spec. However, the flavor extra_specs API extension use flavor_id as
parameter wrongly.

As the instance_type ID is a purely nova internal ID, the database should
not expose it and instead use flavor_id as the parameter

Change-Id: I5f509cb7c4457d8c399df32f559a874d498be762
Signed-off-by: Yunhong, Jiang <yunhong.jiang@intel.com>
Move results filtering to  db.

This patch moves exact filter and regex filter matching on the listing of
instances to the database query. This is important so that we can eventually do
all pagination through the database.

If the db backend does not support regex matching then the SQL 'LIKE' operator
will be used instead.

Change-Id: If9dd644066787f0f3667992f23e5c33b1dc90286
xenapi: ensure all calls to agent get logged

In some cases, a call to an agent wouldn't get logged since the caller
was expected to log and not all did this. Move this to the callee so
the caller doesn't need to do anything extra.

Change-Id: Ie16a372187c9215028475522eef53bca9a5cf4d8
Compute restart causes period of network 'blackout'

Fixes bug 1034401

When a compute service is restarted each instance running on the
host has its iptables rules built and applied sequentially during
the host init stage. The impact of this, especially on a host
running many instances, can be observed as a period where some
instances are not accessible as the existing iptables rules have
been torn down and not yet re-applied.

The presented work-around for this is a configurable/flagged deferred
mode that prevents the application of the iptables rules until all
instances on the host had been initialised then the rules for all
instances are applied all at once preventing a 'blackout' period.

Change-Id: I0da90d07e54225fb63f3884897fb00a6027cd537
Fix HTTP 500 on bad server create

Fix scheduler hint extension to check for missing 'server' attribute
in the body.  Return a HTTP 400. (not 500)

bug 1035356

Change-Id: Ifdf8b85e255fd199f15781c8b6c25d421eee7878
Fix TypeError conversion in API layer

Fix conversion of TypeError to Fault in ResourceExceptionHandler.
TypeError can result when the list of extensions is inovked if the
parameters don't match the extension method's signature.

Specifically, if an empty body was sent with an HTTP POST to create a
server, a 500 error was returned.  This change is a fix to properly
return a 400 instead.

(In Python2.6, the ex_value argument of __exit__ is type string when
ex_type is a TypeError, which caused the conversion logic to get
skipped.)

bug 1035120

Change-Id: I96ad335a6338523345d28b7e744dbc7449b4753d
Merge "Compute restart causes period of network 'blackout'"
Key auto_disk_config in create server off of ext.

Implements part of blueprint disable-server-extensions

Makes sure that auto_disk_config is only accepted in the create
server request if the extension is enabled. Note that the extension
alias is OS-DCF because it also adds output to the server
request.

Change-Id: I59fafe769e1e562e6bf9f6db768acc9b0f8d2b93
Merge "xenapi: ensure all calls to agent get logged"
Merge "Flavor extra specs extension use instance_type id"
Fix type error in state comparison

vm_states.RESIZED is not a list/tuple, use == to compare instead
of in (although it did work by accident in Python).

Change-Id: Ib739e729ae79a3f68ca0eac10167982bd3a6656c
Merge "Move results filtering to  db."
Merge "Fix type error in state comparison"
Don't stuff non-db data into instance dict

The RPC API passes admin_pass and injected_files as arguments, but when
calling the driver API, those values get stuffed into the instance dict
which is otherwise all data that is stored in the database. This has
led to some bugs (such as 1034948) which could have been avoided if
the code was consistent.

Change-Id: I09a7de8eca3791a5ab27e93b22e5ccccee31cf09
Update extra specs calls to use deleted: False.

Updates the instance type extra specs and volume type extra specs
create/update functions so that 'deleted' is treated as a boolean.

This resolves issues when trying to create/update extra specs
on Postgres.

Fixes LP Bug #1036287.

Change-Id: I7f38b40122240af3254d8a817f5144ce9fafd6db
Improve bw_usage_update() performance

Fixes bug 1036084

bw_usage_update() most commonly updates rows vs creates rows.  New rows
are only created on the 1st bandwidth update for an instance or when
the audit period rolls over.  This cuts down DB queries to 1 for the
'update' case.

Added bonus:
Remove unused 'import inspect' in compute manager.

Change-Id: Ie5f6c919676046d817b842138dc9d17d1115d3c0
Avoid {} and [] as default arguments

Dict and list objects are mutable and are usually the sources of
subtle bugs when used as default arguments. Avoid them.

Change-Id: I5340c7051455a80c4adfab885d89acb46570fa52
volumes: fix check_for_export() in non-exporting volume drivers

This overrides the default check_for_export so that drivers that don't
need to export block devices on the host like Sheepdog and RBD don't
raise a NotImplemented exception when this is called.

Change-Id: I9e46f84a2a491f8e1f281b3eea86106147b27976
Reported-by: Mark Moseley <moseleymark@gmail.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Fix rpc error with live_migration.

The topic argument to live_migration was removed on the manager side in
rpc API version 1.3, but was not removed from scheduler/rpcapi.py.
Remove it now.

Change-Id: I0b1c68848f7bd55f6f10c63b9433746f0a343a63
Merge "Improve bw_usage_update() performance"