use REDIRECT to forward local metadata request

VMs can not get metadata when metadata_host is set to 127.0.0.1 because
packet's destination address will be changed into 127.0.0.1 by iptables.
However, linux kernel will reject packets to 127.0.0.0/8 if packets do not
come from that range. We can use REDIRECT to resolve this problem because
REDIRECT will rewrite the destination address to our own host.

Fixes bug 1015853.

Change-Id: I162fc57510ef9c8e84130b2d11eb53e10dcc5cb0
Always create the run_instance records locally

Currently a request for multiple instances issent to the scheduler,
where it is written to the database. It appears that this was done so
that more advanced schedulers could handle the request as one
batch, but the result is the scheduler is sometimes slow enough
that the call will timeout.

Instead this converts to always creating the instance records
locally and making run_instance into a casting instead of a call.

This made a small change to the rpc api for run instance, so the
version was bumped. Legacy messages are still handled properly.

Fixes bug 1036911

Co-authored-by: Chris Behrens <cbehrens@codestud.com>

Change-Id: I63bbc98c285faebec53f8e62857c01548807db68
Remove unused variables

'dialect' is unused in some functions.

Change-Id: Ibc02251f596a87776f16938ff422606b6ca49876
Merge "Always create the run_instance records locally"
xenapi: attach root disk during rescue before boot

Fixes bug 1037729

The xenapi driver attaches the root disk after the rescue instance has
booted. However, hotplugging block devices is only supported on images
that use PV drivers. Attaching the disk before the rescue instance boots
will allow rescue to work on instances that don't use PV drivers.

Change-Id: I187762e4f1ea921d81afd40fcbde0b93d7d3cbc1
Merge "use REDIRECT to forward local metadata request"
Merge "xenapi: attach root disk during rescue before boot"
Implement GET (show) in OS API keypairs extension.

Includes test for showing a keypair (existing and non-existing).

This commit also corrects the name of the KeyPairNotFound exception
in the test_keypair_delete_not_found test case.

Additionally some extra print statements in the tests were
removed.

DocImpact - need to add documentation for GET on: v2/{tenant_id}/os-keypairs/{keypair_name}

Fixes LP Bug #925731.

Change-Id: I9eeb47ccb9bf352c554aa44aa562c47e3eb33cae
Sync changes from openstack common

 * Changes to cfg to handle None overrides, tilde expansion,
   and importing opts.
 * Changes to timeutils to marshall and unmarshall datetimes.
 * Cleanups for zeromq and rpc.
 * Removal of unused imports.

Change-Id: Ica7a2e51ea38f37b315be2ff382d4a615dd67207
Revert per-user-quotas

See bug 1034384, bug 1037590.

This reverts commit https://github.com/openstack/nova/commit/391f345d,
but leaves the DB migration in place while adding a further
migration to reverse it.

The motivation for reversion is that the per-user quota logic would
totally undermine the per-project quotas set for a pre-existing
openstack install.

The per-user quota logic could be re-introduced in a fixed state
after Folsom-3.

Change-Id: Idd4b55a2404a25f43f6737b661f828c28501066f
Refactor ComputeCapabilitiesFilter test cases

With so much duplicated code in the test cases, it's really very
difficult to figure out what each of the cases are testing. DRY
the tests up to make them much more clear.

Change-Id: Ie075d44165996fc4f744a49ddbdfd7c49a0c862e
Fix regression in compute_capabilities filter

Fixes bug #1037503

Restore the previous behaviour of matching simple strings in extra
specs against compute node capabilities.

Change-Id: I485e9e63f860a83f7c9c0c41d09919eabe9e66ae
Merge "Revert per-user-quotas"