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
Add good path test cases of osapi_compute_workers

While fixing issues in Cinder for bug 1367454 I discovered
that Nova doesn't have any good path test cases to make
sure that settings to osapi_compute_workers is being handled
as expected.

This commit adds those test cases.

Change-Id: I161adf9e93bd7ff1389fdbc8f712ae67ed98b613
Clarify virt driver test comments & log statement

The current implementation of nova.tests.virt.test_virt_drivers
indicates NotImplementedError should be caught and logged to
dynamically build the hypervisor support matrix. This is not a
realistic / optimal approach for building the support matrix and
thus this patch updates the code comments accordingly for
clarity. This patch also modifies the logging statement outputted
in such scenarios to better clarify which test case method is
executing.

 Partial-Bug: 1209421

Change-Id: I5d80cdc06207071548fdb5f6852ca96fa8d79776
libvirt: support live migration with shared instances dir

If instance path is shared between compute nodes (e.g. over NFS) and image
backend uses files placed in the instance directory (e.g. Raw, Qcow2), live
migration should consider block storage of the instances shared.

Change-Id: I913c57152974562765502ab57be63ccb6dfe5208
Closes-Bug: #1351002
libvirt: log exception info when interface detach failed

The detach_interface method is catching a libvirtError and logging an
error message but it doesn't include the contents of the root
libvirtError, so log that information as well for debugging.

Closes-Bug: #1374140

Change-Id: I042c2956c7393a2ee1ccd026421c8df537aa1a87
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
VMware: Remove tests for None in fake._db_content['files']

This looks like a legacy. _db_content['files'] is always initialised,
and checking it for None distracts from what is actually being tested.

This was also the only use of NoFilesFound, so we remove it entirely.

Change-Id: Ided6c71b68a654476512016ddf886e895d75e571
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
Remove duplicate entry from .gitignore file

This commit removes the duplicate entry in the gitignore file for the
sample config file.

Closes-Bug: #1375432

Change-Id: Ied0fb5b38a616bbde871dfc690ccccfd46c94bde
Merge "libvirt: support live migration with shared instances dir"
Merge "Remove duplicate entry from .gitignore file"
Merge "VMware: Remove tests for None in fake._db_content['files']"
Merge "Clarify virt driver test comments & log statement"
Merge "libvirt: log exception info when interface detach failed"
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
Merge "Add good path test cases of osapi_compute_workers"
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