image cache clean-up to clean swap disk

Currently swap backing files are never removed from the system.
The image clean-up code should recognise at least obsolete unused files
need to be removed.

Change-Id: I09519a73c7233f2dc6f46f6cd094a3e1cc3dc395
Partial-Bug: 1253991a
Get EC2 metadata localip return controller node ip

When Get EC2 metadata localip, it will return
<instanceIP, Controller_Local_IP>, but for ec2
metadata localip, it expects to return instanceIP.
This patch fixes the issue.

Change-Id: I6c42e713265ebb3138f7a94df5ee996e6f68d02f
Closes-Bug: #1334857
Fixes Hyper-V agent IDE/SCSI related refactoring

Hyper-V Server 2012 R2 introduces a new feature for virtual
machines named "generation 2".

Generation 2 VMs don't support IDE devices, meaning that VHDs
and DVD Drives must be attached as SCSI, instead of IDE.

Since the Virtual Hard Disks and Virtual CD/DVD Disks can be
attached to IDE controllers or SCSI controllers (generation 2
only), some constants, variables and methods have been
improperly named, having the IDE prefix.

Partially implements: blueprint hyper-v-generation-2-vms

Change-Id: Ic281d7548dfe6b2f65290f687ea0ca694db1a4d0
Sync latest from oslo-incubator

Changes include:
1523f00 threadgroup: don't log GreenletExit
a99c5f1 Report: Support Sequences and Mappings as Data
4ca5091 Fixes nits in module policy
411ba35 Simplify is_user_context method
5d43644 cliutils restore python3 string decode
a3220c5 add list_opts to all modules with configuration options
df774ff Import PublishErrorsHandler from oslo.messaging
d0a1fde Switch fileutils to use python logging
b2d35ee Use list.pop(0) to keep the code simpler
262fc82 Correct default rule name for policy.Enforcer
046bc2a Mask secrets when output conf

Removed fixtures that are no longer in oslo-incubator as the
previous reviews in this series switched to using the equivalent
fixtures in oslo libraries.

Cleaned up openstack-common.conf to include only the modules
that are still in oslo-incubator.

Change-Id: Ifd2d5bd506aeb2a9400c5075c3ca24b3c02d1cb6
Make multiple_create unit tests share between v2 and v2.1

Now there is a lot of duplicated test code between v2 and v2.1 API
tests and it is better to share them for the code cleanup.
This pach makes multiple_create unit tests share.

Partially implements blueprint v2-on-v3-api

Change-Id: Icf646efeaa8e13c6a3ec48e16523122b5af1658d
Removing the headroom calculation from db layer

It's odd that this is happening in the DB API because it's dealing
with instance quotas but maybe I'm not doing anything with instance
quotas, maybe I'm doing things with security group or fixed IP quotas.

This patch moves the headroom calculation from db layer to the
calling side.

Change-Id: I8379471eea4ea7b114c2a235224f6fe61f8f981f
Closes-bug: #1369696
GET servers API sorting REST API updates

Updates the v2 and v3 /servers and /servers/detail APIs to support the
multiple sort keys and sort directions (using the 'sort_key' and
'sort_dir' parameters); these parameters can be specified multiple
times to create a list of sort keys and directions. These parameters
are passed from the API layer to the compute layer, then to the
instance layer (with updated version), then to the database layers,
and then to the common paginate_query function; the paginate_query
function already supports multiple sort keys and directions. The
function signatures in these various layers are updated with new
'sort_keys' and 'sort_dirs' parameters that represent the sort keys
and directions information as lists.

This support is enabled on the v2 API by the existence of a new
'os-server-sort-keys' API extension and is always enabled in the v3
API. The extension API sample issues 2 server creates and then ensures
that both servers are listed (name is unique) in the list reply.

DocImpact: The existing v2 and v3 servers API documentation needs to
reflect these new parameters.

The nova client will also be updated to use these parameters.

Change-Id: I02baf6c3cc7d29abab132ef1726140c57e17d9b6
Partially implements: blueprint nova-pagination
Add api validation schema for image_metadata

Add schema file to do api input validation for image_metadata api.
And some unit test case fix for the 'update' action
- create accepts 'metadata' instead of 'meta'
- update accepts 'meta' instead of 'metadata'
- update_all accepts 'metadata' instead of 'meta'

Partially implements blueprint v2-on-v3-api
Change-Id: I364860d5514d94a146b56c74ff3f3950a3b8d5b3
Merge "Add api validation schema for image_metadata"
Merge "Make multiple_create unit tests share between v2 and v2.1"
Merge "Removing the headroom calculation from db layer"
Merge "image cache clean-up to clean swap disk"
Merge "Sync latest from oslo-incubator"
Merge "Fixes Hyper-V agent IDE/SCSI related refactoring"
Merge "Get EC2 metadata localip return controller node ip"
Merge "GET servers API sorting REST API updates"