Fixes instance task_state being left as migrating

In a cross-hypervisor environment, such as KVM + Hyper-v. After negative test
which live migrate a KVM instance to Hyper-v host, there will be an exception
InvalidHypervisorType. As a result, the instance task_state is being
left as migrating. That leaves the instance in a broken state and most of the
requests on the instance will fail.

Actually, there are some other exceptions will cause this issue as well, such
as UnableToMigrateToSelf, DestinationHypervisorTooOld. All of them are thrown
from the driver of scheduler during live migration. But obviously, if the live
migration fails at the schedule stage, the task_state of the target instance
should be updated to None.

Fixes Bug: 1153283

Change-Id: Ide4b48653268c8dbe31de6964814830d2e82a5ba
Do cleaning up resource before rescheduling.

Fix bug: #1153964

If some exception raised when spawn instance, the instance will be
rescheduled to other host. But just deallocate network before
rescheduling is not enough, like security group filters and volumes
will stay on old host.

So shutdown instance and clean up volumes instead of just deallocate
network before rescheduling.

Change-Id: Ieb6220ae66f0b97a92c50f6998f456968b516fcb
Fixes Hyper-V live migration with attached volumes

Fixes bug: 1153429

The previous Hyper-V driver live migration implementation expects to find iSCSI
devices mounted on the same path on source and destination, which is not an
option in this context.

In order to be able to live migrate instances with attached volumes, this fix
provides the following behavior, based on the creation of a staged VM on the
target, so called "planned" in the Hyper-V documentation and in this patch.

pre_live_migration

The target host logs into the storage targets.

live_migration

The source host:

1) checks and removes a previously created planned VM for the current
   instance if present on the target
2) creates a planned VM on the target by using the Hyper-V WMI API
3) maps the volume devices on the planned VM based on the target host
   devices
4) live migrates the source VM on the planned VM
5) logs off the storage targets on the source

This solution provides live migration of volumes without needing to pause
the VM and detach / attach the volumes, preserving also the atomicity of the
live operation.

In the case in which no volumes are attached to the VM, live migration is
performed without creating explicitly a planned VM, starting from step 4
on the source in the above list.

Unit tests have been added for this scenario.

Change-Id: Ib634b77894f492896d86dce65a7269ece8f3d55b
Add quotas for fixed ips.

DocImpact: there is now a default quota of 10 fixed ips per tenant.
This will need to be adjusted by deployers if that number does not
meet their needs.

Resolves bug 1125468.

Change-Id: Iffa19583340f80cb2a13ba5fce31f7ff724a52d6
Add the serial to connection info for boot volumes

The serial parameter wasn't being added to volumes specified at
boot time. Added tests. Also cleaned up import in test_compute
to match the rest of the file.

Fixes bug 1148734

Change-Id: I05a623849680c5d0bb530fba4c4e6051d3b000aa
Fix system_metadata "None" and created_at values

The ill-fated migration 153 converted None instance_type values to
"None" in the database instead of properly making them NULL. This
corrects that by sweeping all of the likely instance_type_% values and
converting "None" to NULL. Also, it adds a belated created_at stamp
to all of the items, which was missing in 153 as well.

It also corrects the 153 migration to avoid polluting things in the
first place for systems that haven't rolled through that yet.

Fixes bug 1152546

Change-Id: I3585463ae15abfd534f2ff070e2974f3cb51d7e8
Add missing API doc for networks-post-req.

Part of the os-tenant-networks API extension.

Fixes LP Bug #1155303.

Change-Id: Ic71a3d108f9401ec81d2c59a6f7ba3ec6ab59dd8
Fix exception message in Networks API extension

Raise exception indicating VLAN is disabled when
trying to associate a network w/ a tenant in cases where
VLAN is not the network manager
Added unit test case
Fixes bug 1075790

Change-Id: I3dcac09fbf06d9f64b18cc52d0b069dc9c0a7370
Don't include traceback when wrapping exceptions

The fix in fa52cb09b2270876c9d9a03106f961be6c9db834 strips tracebacks
from exceptions when returning them to the user, but it still spams
the log with a long traceback. We shouldn't be including the traceback
when we wrap the exception in the first place. Instead we just
include the message.

It also updates the error code to 409 for device in use since this
is actually a conflict.

Fix for:

  bug 1155315
  bug 1103324
  bug 1092610

Change-Id: I95019a3022eb52e0335c455009c13fe229475d03
Merge "Add the serial to connection info for boot volumes"
Merge "Don't include traceback when wrapping exceptions"
Merge "Fix system_metadata "None" and created_at values"
Merge "Do cleaning up resource before rescheduling."
Imported Translations from Transifex

Change-Id: I9e57c57edc56e0bf68797ccfc920a119bb57905f
Merge "Add quotas for fixed ips."
Merge "Fixes Hyper-V live migration with attached volumes"
Merge "Imported Translations from Transifex"
Merge "Fix exception message in Networks API extension"
Merge "Add missing API doc for networks-post-req."
Merge "Fixes instance task_state being left as migrating"