Test for remote directory creation before shutting down instance

This patch moves the creation of the directory on the migration target
earlier in the code path so we can catch failures like missing or incorrect
keypairs on the source and destination node.

This fixes part of bug #1061024 but not all of it yet.

Change-Id: I097cf007cdd8de0c9c3a9390cbc6dc202eddb2b5
Fixes encoding issues for nova api req body.

* Ensure utf-8 encoding for POST/PUT body for api requests
* As per https://wiki.openstack.org/wiki/Encoding.

Fixes bug #1180344

Change-Id: Iea0f16b0c024795fb3aee1cd38bb54ee9da6d90d
Fix missing argument to logging warning call

Change-Id: I04ff613e785b6b39476b7766b94c831d7e22148a
Optimize SecurityGroupsOutputController by len(servers)

The following patch adds an optimization for _extend_servers() so that
it calls get_instance_security_groups() when len(servers) == 1, and
get_instances_security_groups_bindings() when > 1. In addition, this patch
adds a return statement if not len(servers) as there is no reason to
perform a query if there are no servers.

Fixes bug 1182730

Change-Id: I149bf32176d60e72d76576168d15995f7215b657
Remove path_exists from NFS/GlusterFS drivers

mkdir -p will not throw an error if the path already exists,
so this method is unneeded in these classes.

Change-Id: I65a67cb75f83f65a6f80c7a90f77c2c5133bd41b
update mailmap

Reflect new email address that I will be committing under.

Change-Id: I7358c5c8e47b4c77c8d885fe30f79c757ca943b2
Add missing tests for db.api.reservation_*

blueprint db-api-tests

Change-Id: Id191363e00f51d2c8ae0f2bac6a9c6672dfbdd65
Fix log message.

Fix a missing key in the log format.

Change-Id: I275f5e5fbfb6465b39d9ed7b4a9ace045ded4b5d
xenapi: make the xenapi agent optional per image

This adds the ability to decide, per image, if xenapi should use
the agent for servers created from that image.
This opens up the path to using config drive or the metadata
service with cloud-init to perform tasks like file injection

It uses the image properties that are copied into system metadata
to detect if "xenapi_agent_present"="true" on the image the server
was created from.
If the tag is not present, it defaults to the value
of the new conf setting "xenapi_agent_present_default".

Becuase the above setting defaults to False, it means that
the xenapi driver no longer waits for the agent by default.

DocImpact
fixes bug 1178223
part of blueprint xenapi-guest-agent-cloud-init-interop
Change-Id: Ie51a9f54e5b2e85fe4ebebb0aff975db296ba996
fix a misleading docstring

GroupAntiAffinityFilter was introduced to filter a set of hosts,
howerver the docstring saying filter a set of instances which need to be
fixed.

Change-Id: Icf66a3ad15b4135c06e2e2ccc62837a346fcfdf7
API Extensions framework for v3 API Part 2

This is the second patch for the new extension framework
which is only to be used by the Nova v3 API.

- Adds tracking of extensions loaded and allows
  extensions access to this information
- Adds core API functionality as extensions
  - 'server'
    - Adds an entry point that other extensions can
      use to modify the server create arguments without
      having to modify the server extension itself
    - TODO: Will have to add more entry points as other
      extensions are ported. Delaying adding entry points
      now so they can be tested as they are added.
- Adds port of os-keypairs extension
  - This is an example of a controller extension in the new
    framework
  - This is an example of using the server extension entry
    point to add functionality without modify the core API code
  - Ports tests for the os-keypairs extensions
    - Adds v3 API fake specific code for tests

This completes the bulk of the new extension framework. Porting
of the server tests will be done in future changesets as more
of the core API is ported across as the tests are dependent
on multiple core APIs.

Partially implements blueprint v3-api-extension-framework

Change-Id: Ibadb5bbe808c27d2f4afebe65c06a92576397085
Cells: Add filtering and weight support

This adds filtering and weighing support to the cells scheduler.

Adds the following config options to the 'cells' group:

scheduler_filter_classes -- list of filter classes
scheduler_weight_classes -- list of weight classes

Adds a couple of weighing modules as defaults (which removes the random
cell selection):

ram_by_instance_type: Select cells with the most capacity for the
instance type being requested.
weight_offset: Allows modifying the DB to weight a particular cell
(useful for disabling a cell)

Adds a filter class (TargetCellFilter) that allows specifying a scheduler
hint to direct a build to a particular cell if you're an admin.

DocImpact

Implements blueprint cells-filter-scheduler

Change-Id: I027c5734e3d6134127fcd4dd28b8ff39047416dc
Pull binary name from sys.argv[0]

Instead of inspecting the top of the stack to find the binary name, just
use sys.argv[0].  This is little cleaner then inspecting the stack.

Co-authored-by: Mark McClain <mark.mcclain@dreamhost.com>

Change-Id: I18d5233b6b0bd0ccaeeab5b7ce5006adcf4a8d40
Merge "update mailmap"
Merge "Pull binary name from sys.argv[0]"
Merge "Add missing tests for db.api.reservation_*"
Merge "xenapi: make the xenapi agent optional per image"
Merge "Optimize SecurityGroupsOutputController by len(servers)"
Merge "Fix missing argument to logging warning call"
Imported Translations from Transifex

Change-Id: I47a6645025e6a74a7205d1eadda3cb36295d341b