VMware: prevent race condition with VNC port allocation

When spawning some instances, nova VMware driver could have a race condition
in VNC port allocation. This fix ensures that the lock is done on the
actual setting in the VM configuration spec.

Co-authored-by: Marcio Roberto Starke <marcio.starke@serpro.gov.br>

Change-Id: I70fab021bbf2df418df53e5f47e19cf16dbe45ac
Closes-bug: #1357372
Ironic driver must wait for power state changes

The Ironic virt driver was previously returning from power_on,
power_off, and reboot calls immediately after making the request to
Ironic -- but before Ironic had necessarily acted upon it. This could
lead to Nova acting as though the state change was complete before it
actually was.

This patch introduces a new private method which polls Ironic until it
signals that the power state change is complete. With this, the
power_on, power_off, and reboot methods wait for the action to complete
before returning to ComputeManager.

Closes-bug: #1310135

Change-Id: I0bbdd8bc8807a0df43a420825f497842b387c4d5
Fix creating bdm for failed volume attachment

This commit modifies the reserve_block_device_name method to return the
bdm object, when the corresponding keyword argument is True. This
ensures the correct bdm is destroyed if the attach fails. Currently the
code assumes only one bdm per volume and so retrieving it can cause the
incorrect db entry to be returned.

Change-Id: I22a6db76d2044331d1a846eb4b6d7338c50270e2
Closes-Bug: #1349888
console: make websocketproxy handles token from path

As part of the blueprint serial-ports when connecting to
the proxy with a plain websocket, make Nova able to retrieve
the token from the request path.

Closes-Bug: #1373950
Change-Id: I0b0b23c954dbb812acfa7616696445c0e167d2c8
cmd: update the default behavior of serial console

When using serial console we are expecting using a plain websocket
so we should to return the 'ws://' scheme as the default one, also
it makes no sense to handle webserving content since currently
nothing has been implemented in favor of this case.

DocImpact: The 'base_url' option serial_console has been updated
Closes-Bug: #1373950
Change-Id: I0d0e4f7060febec5e0a357cd3e8c05486f2afaa5
VMWare: Fix VM leak when deletion of VM during resizing

During the VM resizing, before VM arrive RESIZED state, driver
migrate_disk_and_power_off will initially rename orginal vm
'uuid' to be 'uuid-orig' and clone a new vm with 'uuid' name.
When deletion VM is triggered at this time window, it wouldn't
be able to delete the VM uuid-orig in VCenter and so cause VM leak.
As VM task state will be set to 'deleting' and it can not be used to
determine the resize migrating/migrated state, this fix will
attempt to delete orig VM within destroy phase.

Change-Id: I7598afbf0dc3c527471af34224003d28e64daaff
Closes-Bug: #1359138
Imported Translations from Transifex

Change-Id: Ib2e988b23dc5f264c07342343c848308de8eb2c9
Correct missing vcpupin elements for numa case

We should pin each vcpu into specified numa's cpuset. But the current
code only pin the last vcpu in one cell to specified numa's cpuset.

Change-Id: Ia1cda5e117d7e569e8891bd7c3d03bd6148a0c27
Closes-Bug: #1374902
Merge "console: make websocketproxy handles token from path"
Merge "Fix creating bdm for failed volume attachment"
Merge "VMware: prevent race condition with VNC port allocation"
Merge "VMWare: Fix VM leak when deletion of VM during resizing"
libvirt: Make sure NUMA cell memory is in Kb in XML

This patch makes libvirt report memory in Mb (as
hardware.VirtNUMATopologyUsage class expects Mb) and that when
generating XML we use Kb as this is what libvirt expects by default.

Change-Id: Ic4518acf6bcee463009437829646de8c83aff6bf
Closes-bug: #1373159
Merge "Ironic driver must wait for power state changes"
Merge "cmd: update the default behavior of serial console"
Merge "Imported Translations from Transifex"
Merge "Correct missing vcpupin elements for numa case"
Merge "libvirt: Make sure NUMA cell memory is in Kb in XML"