InvalidCPUInfo exception added to except block

When a live migration between two nodes with different
CPU info features is launched, an InvalidCPUInfo exception
is raised and not captured. That lets the vm in an
unusable state because the task_state rollback is not
executed.

Change-Id: Ib418fa324964cabd5f342d1b764f9ac7608b7ade
Closes-Bug: #1294210
(cherry picked from commit 7a3b4033f07f8c2144a36c1f12b1b9281cfb9a69)
VMWare: add power off vm before detach disk during unrescue

Non Hot Plug type disk like IDE can only be detached when the VM is power off.

Change-Id: Ib1f387a41abe2b52357854e90c2535ebb7b43f18
Close-bug: #1279199
(cherry picked from commit 1e1915aaaca38b5691794e0e052a42b9d95dd3c2)
VMWare - Check for compute node before triggering destroy

While booting an instance, if Claim on that compute node is not successful
compute manager triggers a call to destroy instance. Destroy fails since the
compute node (Cluster/ESX host) is set only after claim is successful.
Hence the check for node is made before destroy, to ensure that exception
does not get thrown. This ensures that the instance gets rescheduled
Closes-Bug: #1307408

Change-Id: Iaaf931e9c1e6cf046497e2c64952f92e802ad4be
(cherry picked from commit aadfffaaa69c6a8939f6c88cfbaeb026c7604163)
Fixes arguments parsing when executing command

A regression was caused by changing the eventlet.subprocess.Popen
with the builtin subprocess.Popen (by using the nova.utils execute
method) without changing the way the arguments were parsed.

In the v1 volume utilities module, the execution args were parsed
separated by whitespaces, which is not allowed by the builtin
subprocess.Popen, causing a "not found" error.

This error is returned for example when attaching a volume, at the
point where iscsicli tool is used to login the iSCSI target or portal.

This patch fixes the issue by simply splitting the args.

Closes-bug: #1317180

Change-Id: Iee7d5de0dde8b68d8f2bab4214e9b6779ad9f722
(cherry picked from commit 40a790c32ee4ea7b9d79e259545f07409fd618fa)
Reap child processes gracefully if greenlet thread gets killed

If ProcessLauncher is run from within a thread we should be able to
call wait after the thread is killed to reap the child processes.
Catching this exception and then proceeding to the cleanup phase
accomplishes this.

Conflicts:
	nova/openstack/common/service.py

Closes-Bug: #1282206
Change-Id: I9c863864c25c0478b720fc57cf0dccbe9bc9d9f6
(cherry picked from commit a6fec438abe61d40fc4fb6907ea1fefd4dd93e22)
Do not wait for neutron event if not powering on libvirt domain

When resizing/migrating a stopped instance, the power_on flag is False
in _create_domain_and_network so virtual interfaces are not plugged and
we are waiting for an event callback from Neutron that won't happen.
This leads to an eventlet timeout and subsequent attempt to destroy the
non-running domain, which results in a libvirtError.

This change just adds the power_on flag to the list of conditions for
determining if we should wait for an event callback from Neutron.

Closes-Bug: #1321872

Change-Id: Id87ed125db8b1e807b7fa0d99180d0820edbed3e
(cherry picked from commit e0228eb7e739956978f002f58edf35bc4d698022)
Catch InstanceNotFound exception if migration fails

When a VM with an attached iSCSI disk fails to migrate, the rollback methods
does not detach the disk from target host. What happens is _lookup_by_name()
fails, since the VM does not exist on the target host. In detach_volume(), it
is supposed to print a warning based on the correct error code being returned,
instead of throwing the exception. However, this is not happening, because
_lookup_by_name() throws an InstanceNotFound exception, rather than a
libvirt.libvirtError exception. So we also need to catch InstanceNotFound
exception, so that detach_volume() can continue to execute as expected.

Change-Id: I396c23d8137bf1e2834769c5483d2494506949ad
Closes-Bug: #1321082
(cherry picked from commit 52b57e82c7ef972508777a8bd3c7b937a3673d2d)
VMware: uncaught exception during snapshot deletion

During the image upload of the snapshot to glance, an exception is
thrown that ends up getting ignored.  As a result, the instance gets
stuck in the "Image Uploading" state.

Change-Id: Id2cb3c244edd831939794da9dcc1fd9fce59991c
Closes-bug: #1249519
(cherry picked from commit 56607f9af4495e76edf6675a984a66da907c89f8)
Add info_cache as expected attribute when evacuate instance

Nova evacuates instance failed with neutron. The reason is
when nova-conductor try to get network info for instance, it
need instance include 'info_cache', but the instance dict which
passed didn't include it. This patch adds 'info_cache' as the
expected attribute for get instance.

Change-Id: I6f110c607e32b0ab536916741605b25d572331dc
Closes-Bug: #1284709
(cherry picked from commit 4c68f19cd8d1f045bde02be7eec50c34c1d87932)
VMware: Log additional details of suds faults

When a suds requests results in a fault response, the current
code loses details on that fault in the sequence of exceptions
propagated through the driver.  A NoPermission fault will contain
additional metadata on the privilegeId and object type which
needs to be logged.  The fault string will be propagated with this
fix, along with details of a NoPermission fault.

An example of the new exception:
NoPermissionException: Permission to perform this operation was denied.
{u'privilegeId': Resource.AssignVMToPool, u'object': domain-c7}

An example of new exception within retrieveproperties_fault_checker:
Error(s) NoPermission occurred in the call to RetrievePropertiesEx
{'privilegeId': System.Read, 'object': datacenter-16}

Change-Id: Iafbf052750c2835f304b2edf21d7300d1fbd7e5a
Closes-bug: #1289627
(cherry picked from commit 62cb0dc6257daac5ec9fd1a90ee5721e6543dd76)
VMware: ensure rescue instance is deleted when instance is deleted

If the user creates a rescue instance and then proceeded to delete
the original instance then the rescue instance would still be up
and running on the backend.

This patch ensures that the rescue instance is cleaned up if
necessary.

The vmops unrescue method has a new parameter indicating if
the original VM should be powered on.

Closes-bug: 1269418
(cherry picked from commit efb66531bc37ee416778a70d46c657608ca767af)

Conflicts:

	nova/virt/vmwareapi/vmops.py

Change-Id: I3c1d0b1d003392b306094b80ea1ac99377441fbf
Merge "VMWare: add power off vm before detach disk during unrescue" into stable/icehouse
Merge "VMware: ensure rescue instance is deleted when instance is deleted" into stable/icehouse
Merge "Fixes arguments parsing when executing command" into stable/icehouse
Merge "InvalidCPUInfo exception added to except block" into stable/icehouse
Merge "Catch InstanceNotFound exception if migration fails" into stable/icehouse
Merge "Do not wait for neutron event if not powering on libvirt domain" into stable/icehouse
Merge "VMware: Log additional details of suds faults" into stable/icehouse
Merge "VMware: uncaught exception during snapshot deletion" into stable/icehouse
Merge "Add info_cache as expected attribute when evacuate instance" into stable/icehouse