Add missing unit tests for VMwareAPISession

This change adds unit tests for the following methods:
* pbm property
* _get_session_cookie
* invoke_api with stale session

It also updates one test for _create_session.

Change-Id: I4ab519a498f844e9c8b2889f84721935dfed1a5b
Add unittest method "test_download_flat_image"

Currently, there is not a test method of download_flat_image.

Change-Id: I8ed68222b3ef195464901d8c6442cc397ffdb272
Merge "Add missing unit tests for VMwareAPISession"
VMware: treat cases when SOAP reply does not have a body

There are cases when the SOAP reply does not return a body (for
example UnregisterVM may return this when running the CI).

This patch ensures that an exception is not thrown.

Change-Id: I394320641c648effd1209345cfd729e975f12aab
Closes-bug: #1300788
Fix vim25:InvalidRequest when no profiles exist

Currently, we don't check if there are any existing profiles in
pbm.get_all_profiles. As a result, we send a malformed request to
PBMRetrieveContent resulting in vim25:InvalidRequest.

Change-Id: I882c97a8050f8c2d49a4ce1de0f166e457ce68f2
Closes-Bug: #1302271
import run_cross_tests.sh from incubator

Change-Id: I1ba7f5e0879e71f456772d7b762c69bb0967fe18
Merge "Fix vim25:InvalidRequest when no profiles exist"
Add a test to oslo.vmware test_image_transfer

This change adds unit tests of the following methods:
    * _start_transfer
    * download_stream_optimized_data
    * download_stream_optimized_image
    * upload_image

Change-Id: I2c99231f873b9bbe0d2d806966d7e69b10c80675
Remove __del__ usage in oslo.vmware driver

The driver uses __del__ in which may cause spurious errors.
python docs detail the caveats of using __del__.

In order to enable the calling application to be able to close
existing sessions, a new method has been added: logout.
This will be used to terminate and logout of the existing session.

Change-Id: I94482b79cc451d027cb853a6d0775e4da189cb7e
Updated from global requirements

Change-Id: Ica7572524227411f0d496d9b74d39396634e9200
Sync changes from Nova error_util.py

Picking up bits and pieces from the following changes to error_util.py

563f719 VMware: add missing translations
62cb0dc VMware: Log additional details of suds faults
91ddf85 VMware: Fixes the instance resize problem
38fc557 VMware: add missing translations
1c6898e VMware: VimException __str__ attempts to concatenate string to list
dd4032e Enable flake8 H404 checking

Change-Id: I7a5d9400392d473b0e35a814f29dca47c5e56568
Updated from global requirements

Change-Id: I24bc7344e6828533de74a2a3f7c808888485c32d
Don't translate debug level logs in oslo-vmware

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I54e8ade29015e11b3383920cd6b1f45ad6c81324
Merge "Add a test to oslo.vmware test_image_transfer"
Merge "Don't translate debug level logs in oslo-vmware"
Support 'InvalidPowerState' exception

The aforementioned exception is used to determine if a VM is
already powered on. This was introduced in the spwan refactor:
https://review.openstack.org/#/c/83207/.

Change-Id: I35fa88cdae5d488d0dbf65346aa5903e5eec17fb
Support for IPv6 and Non-standard ports

IPv6 urls are formatted with '[' and ']' around the host and
the port actually shows up after the trailing ']' as well. So
we need to allow for better support for both ipv6 and non
standard urls when dealing with both SOAP and WSDL urls.

Examples:
   https://[fd2e:1201:1d9f:0:8886:78e0:38cd:cb03]/sdk
   https://[::1]:9443/sdk/

Closes-Bug: #1287292

Change-Id: I84ab38087ea77a30f6082d8c3fae0341e3371a78
replace string format arguments with function parameters

There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: I456f411ad6ca46a8c8de442c74c18276faca920e
Partial-Bug: #1321274
Merge "Support for IPv6 and Non-standard ports"
Ensure port support does not break backward compatibility

Commit a76bd253fb4fa54c72d3440f2345642b209b5f41 added the ability
to pass a port to the session creation. This broke the existing
support as the port was not passed to the session creation.

The solution is to move the port to an optional parameter with default 443.

Change-Id: I4bbcc0dba3ab930cfb0abca0b9894ca534747327