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
Revert to prior method of executing a libvirt hard_reboot.

Fixes bug 1036826.

Using reset for hard_reboot is not reliable, even where it is supported
by libvirt. Hard reboots are one of the only ways to recover a VM in a
broken state. The reset command assumes the domain is running in some
capacity and will fail if it is not.

Hard reset is the current sledgehammer for fixing issues and it really
needs to stay that way.

Change-Id: I84705b72d79cf71adad066b18267fdfb199bc9cb
Adds Hyper-V support in nova-compute (with new network_info model), including unit tests

blueprint hyper-v-revival

Features included in ths commit:

Spawn (including CoW image option support)
Destroy
Info
List
Pause
Unpause
Suspend
Resume
Reboot
Power On
Power Off
Snapshot
Volume Attach
Volume Detach
Boot from Volume
Live Migration

Supported platforms:

Windows Server / Hyper-V Server 2008 R2
Windows Server / Hyper-V Server 2012

Unit tests:

Unit tests for all the listed features are included.
Tests can be execute on Linux as well.

nova.conf relevant flags:

Compute driver:

compute_driver=nova.virt.hyperv.driver.HyperVDriver

External vswitch to be used:

vswitch_name=an_external_vswitch

Path where the VHDs are going to be stored

instances_path=C:\Hyper-V\instances

Live migration support for hosts with etherogeneus CPUs

limit_cpu_features=true

Change-Id: Ic40adcd2d78b0ca6792d77940810f5a44de8cc37
Fix use of non-existant var pool.

This code was using pool, but this variable did not exist.  It was
erroneously removed in f50ce35c9cf2e05d205485586da1cb6d5433ba56.
This patch fixes the bug, as well as introduces unit tests for this API
that would have caught the problem.

Part of bug 1037183.

Change-Id: I0784aa314a0224198049dbcbe160084bdd1deee1
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
Merge "Adds Hyper-V support in nova-compute (with new network_info model), including unit tests"
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
Remove unused imports

Fixes bug #1037705

Change-Id: I3e55f283961b4801c863bea05d9dd36e22be0cdb
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"
Remove logging in volume tests

Fixes bug #932137

Usage of logging seems to be limited to the check_for_export() tests and
should be to cleanup. check_for_export() raises an exception if there's
a problem and it does nothing if it succeeds. The tests should just
check whether an exception was raised.

Change-Id: I411948031baeb7e36e6b15b9f31446a100da77d7
Merge "Remove unused imports"