Take a vm out of SNAPSHOTTING after Glance error

If a snapshot is attempted to be taken when Glance can't find the
underlying image (usually because it's been deleted), then ImageNotFound
is raised to nova.compute.manager.ComputeManager._snapshot_instance. The
error path for this leaves the instance in a snapshotting state; after
which "operator intervention" is required.

This simply reverts the instance state under that specific circumstance.

DocImpact: previously a snapshot that failed for this reason would leave
the instance in a spurious snapshotting task state indefinitely. Now,
the task state is reverted. At the moment that revert is 'silent'
(although the failure to snapshot will be evident to the user).

Fixes-bug: #1267097
(cherry picked from commit 96dba50737819c24b4ddd9cb1078da305638abc9)

Conflicts:

	nova/compute/manager.py

Change-Id: I9623cfaed31e8337ab65bc1eab85ad3b51b1a5ca
Explicity teardown on error in libguestfs setup()

Previously, in the setup method of the libguestfs driver
for Nova's VFS, on an error the handle object was simply
dereferenced (set to None), and then an new error was thrown.
This relied on an implicit close() on the handle being called
by GC.  However, in some cases the setup progresses far enough
that the implicit close is not enough, and leaves an "orphaned"
libguestfs VM.

Now, the teardown() method is called explicitly, which ensures that
no "orphaned" VMs are left around in case of an error.

Change-Id: I7fbe470046ce6c76bc13d77d8df360351a3ef715
Fixes: bug #1270304
(cherry picked from commit fa62cfe15fd6dddecf657966d166a2d3a2bdd317)
neutron_metadata_proxy_shared_secret should not be written to log file

This patch sets secret=True for the following config option
neutron_metadata_proxy_shared_secret

Conflicts:

	nova/api/metadata/handler.py

Change-Id: I381ea9e89f76beac11b03def6e3ccfee2a55e48f
Closes-bug: #1288463
(cherry picked from commit fa73a5d037471dbec11893ad83bd93276968b9af)
VMware: fix the VNC port allocation

There is small chance for VNC port collisions with the current
implementation which choose the port number based on the MoRef id
of the VM.
This patch fixes this by running a query for all allocated ports
and then selects one which is not taken.

Closes-Bug: #1255609
(cherry picked from commit 2f49ed4b5dbb5c954fc7a9b42ee7b170c38c775c)

Conflicts:

	nova/exception.py
	nova/tests/virt/vmwareapi/test_vmwareapi.py
	nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py
	nova/virt/vmwareapi/vm_util.py
	nova/virt/vmwareapi/vmops.py

Change-Id: If7c3b14dd49ed05c5fde819c5a36d5608650cbbc
Merge "neutron_metadata_proxy_shared_secret should not be written to log file" into stable/havana
Merge "VMware: fix the VNC port allocation" into stable/havana
Merge "Explicity teardown on error in libguestfs setup()" into stable/havana
Merge "Take a vm out of SNAPSHOTTING after Glance error" into stable/havana