Multiple gateways
Merge branch 'master' into gateways
Fix OS-DCF:diskconfig XML handling

Removes string to bool conversion for the OS-DCF:diskconfig
attribute during XML deserialising as the diskconfig extension
expects a string (MANUAL or AUTO) not a bool.

Fixes bug 1152439

Change-Id: Id9a5c2559a2891c2a21c437c9a5a534b9885c9bf
Merge branch 'master' of https://github.com/openstack/nova into gateways
Merge branch 'master' of https://github.com/openstack/nova into gateways
fix1
Merge branch 'master' of https://github.com/openstack/nova into gateways
Merge branch 'master' of https://github.com/openstack/nova into gateways
Merge branch 'gateways' of ssh://tazik/opt/nova into gateways
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
Remove the usage of instance['extra_specs'].

Instance type extra specs is remove from instance dict, so use inst_type['extra_specs']
instead of instance['extra_specs'].

fix bug #1146253

Change-Id: I1d3542e5142f490269607b779daa507f9d7b36e4
Read instance resource quota info from "quota" namespace.

Scope all instance resource quota params such as CPU(cpu_shares,cpu_quota,
cpu_period), disk IO(disk_read_bytes_sec,disk_write_bytes_sec etc.),
network bandwidth(vif_inbound_average, vif_outbouand_average) to "quota"
scope in extra_specs, so that it doesn't conflict with compute_capabilities_filter.
after this patch, user should use:

nova flavor-key m1.tiny set quota:cpu_shares=1000 to set parameters.

Fix bug #1146322

DocImpact

Change-Id: I30e550d21f00eb949ee2f3f8fb4d952c10bf8000
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
Drop gzip flag from tar command for OVF archives

Fixes bug 1154253

Change-Id: I3880d9b187dc25d2ff44fe502eec4d1e0bce4218
Make ssh key injection work with xenapi agent

If there's 'key_data' on an instance, and instance is not Windows, use
file injection to inject /root/.ssh/authorized_keys.  If a user
specifies their own /root/.ssh/authorized_keys via 'injected files',
that will take precedence.

Fixes bug 1152713

Note: Images for Xen that use nova-agent will need to have /root/.ssh
pre-created with modes 0700 on those directories.

DocImpact

Change-Id: I190c6b3f67099061b5316baa45b8bfcd1a5e53f6
Generalize console error handling during build.

There is a race condition where you can create an instance and then
quickly request a VNC or Spice console before the instance is ready.
The way this went down was different depending on the virt driver in
use.  The libvirt driver would raise InstanceNotFound.  The xenapi
driver would raise InstanceNotReady.

This patch moves the handling of this race that was in the xenapi driver
up to the compute manager.  Now, all of the virt drivers that support
this method (libvirt, xenapi, vmware) will all raise InstanceNotFound in
this case, and the compute manager will convert it into InstanceNotReady
IFF the vm_state is BUILDING.

Related to bug 1154327.

Change-Id: I68f4a6db8aac26c6f731c985d97299ee38c34448
Don't log traceback on expected console error.

When requesting a console before an instance is read (while still
building) we will get an InstanceNotReady exception.  This exception is
raised in the compute manager.  The explanation in the exception will
include the traceback from the manager side.  If we use this as the
explanation, we end up with a traceback in the API log, even though it's
just an INFO log message.

Use a more basic explanation, which is accuately more consistent with
other cases of raising HTTP exceptions, which doesn't include a
traceback.

Fix bug 1154327.

Change-Id: Idca443165983289a0df40970f68f95d5550ce72a
Fix copyright - from LLC to Foundation

one last spot hopefully!

Change-Id: I4d557520a1a7a3e0b13bca7df6c8d06bd850b867
Fix issues with cells and resize

There are cases where compute API resizez() is called with 'flavor_id'
as a positional argument, so we need to fix up the cells_api version of
resize() to more closely match the super class.

Also: A recent change for storing instance_type info in system_metadata
happened to make an incorrect change, assuming cells_api was for child
cells.. which it's for the API cell.  It needs to pull the instance type
from the DB just like the super class does.

Fixes bug 1154843

Change-Id: Ifdf2a68c3bff6d27d5f192e2eb73f9b79804c2c7
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