VMware: remove deprecated configuration variable

Removes support for vnc_password configuration variable.

Closes-bug: #1235118

Change-Id: I70fd7d3ee06040d6ce49d93a4becd9cbfdd71f78
Fix root disk not be detached after deleting lxc container

Add teardown_container action when cleanup lxc instance to make
sure root disk be detached and no resource leak.

Fixes: bug #1208387
       bug #1203927

Change-Id: I063fd3a9856bba089bcde5cdefd2576e2eb2b0e9
Use print function rather than print statement

This is for Python 3 compatibility, since Python 3 does not support
the print statement, only the print function.  (Python 2.6 and 2.7
support both, depending on whether a __future__ import is used.)

Paths containing "xen" were left alone, because of comments in a
couple of the files indicating that the XenServer code needed to be
compatible with Python 2.4.

Fixes bug 1226943

Change-Id: I23b804a4d99500b4acf81dd19645ab06dfcc9f1c
Fix typos in nova/api code

blueprint fix-nova-typos

Change-Id: Idd9c5458c5fc0facd9f3c55f907acb7acc4c1b0f
Fix incorrect root partition size and compatible volume name

When using rbd backend, it needs to resize volume size if size presents. Else
we will get wrong image size.

Rbd volume always uses uuid as the main pattern of volume name, now change to
it is necessary.

Fix bug 1219658

Change-Id: I3dc8d639b066eac35d190b8d4687c41c9f4d5824
Fixes Hyper-V issue with VHD file format

The VHD format cookie signature needs to be checked in the footer
instead of the header as fixed format VHDs don't have a copy of the
footer at the beginning of the file.

Fixes bug: #1233853

Change-Id: Ibe44f0d895cde2edbc03dcd6ecebac24b0936660
Remove compute_api_class config option

This option was deprecated in Havana and can now be removed.  Its only
use was for changing out the API class if cells was in use.
Technically, it used to be possible to configure an arbitrary compute
API class.  However, that would have been an unsupported setup, and has
been completely broken since 9f902c7e17249cf5af1504f31d80c0247a02fe20
anyway.

As a part of this change, the cell_type configuration option needed a
default value.  I set it to 'compute'.  My reasoning was that you would
have more compute cells than API cells, so might as well set it to the
more common case.

Change-Id: I5ec44f84267a700da16b350e686eee886e0d1183
Add a get_root_bdm utility function

Getting the root block device out of a list of block devices is a common
idiom and we use it in several places in our code base. This patch
factors it out in a handy utilty method and adds tests for it.

Change-Id: I4a2cb3c689fed9fbc0bc51ddba095e1269cacb2d
blueprint: clean-up-legacy-block-device-mapping
Move is_volume_backed_instance to new style BDM

Compute API is_volume_backed_instance used to rely on matching the
device name to the root_device_name field of the instance which had
several problems and edge cases.

Now that we have moved to the new BDM format that has the boot_index
and destination_type field for each block device - it is pretty
staightforward to implement.

Change-Id: Ia2c235f8bce577ed4ac6a480a4a051d159a5fad7
blueprint: clean-up-legacy-block-device-mapping
fix missing host when unshelving

An instance has the hostname of the host on which it is running.
The hostname is deleted when shelving. However, the hostname is not
recreated when unshelving.

This patch sets the hostname when unshelving.

Change-Id: I2e431718198321c46b9335e6fb7ab7be3943fab6
Closes-Bug: #1237868
cleanup after boto 2.14 fix

we had a fix that worked fine in the gate, but this was a good
suggestion of a cleaner version. Fixing now while everyone is still
fresh on this.

Change-Id: Id88f3532fe8096c4f7322c683faeaf20bfb431bc
Move exception definitions out of db api

The two exceptions, NoMoreNetworks and NoMoreTargets, are defined
in nova/db/api. While NoMoreTargets is unused and can be removed,
NoMoreNetworks are still used and should be moved to exception.py
where all other exceptions live.

This came up during review of https://review.openstack.org/#/c/42980/
where compute manager would need to import nova.db to make use of
NoMoreNetworks.

Change-Id: I57f0a081d2fea35394421932ae7d2a3e67540a31
Check for None when cleaning PCI dev usage

The PCI manager needs to check for instance UUIDs mapped to
None when cleaning up it's internal claims/allocations maps.

Also adds a check so the claims dict doesn't map to None in
the first place.  There was already a check like this when
setting a value in the allocations dict.

Closes-Bug: #1238374

Change-Id: I7ac010f7d50ad85c145e536cfd48e07c8f4602d3
Remove unused method _get_res_pool_ref from VMware

This method has been moved to vm_util.py in commit
9408d79e7413aadcba52a61b7a33164090785e4f, so we can
remove it safely.

Change-Id: I6c192414c58c30ceec206937694ae92a3eea4d2d
libvirt tests: replace assertEquals with assertEqual

In Python 2.6, both assertEqual and assertEquals are
convenience aliases to failUnlessEqual.

In Python 3, failUnlessEqual is explicitly deprecated.

This is part of blueprint assertequal

Change-Id: I1857ab4720c20df9bc9b6a06227ded4061678b16
Remove unnecessary "LOG.error()" statement

Removes apparent debug statement left in from
Ifd41886b9bc7dff01cdf741a833946bed1bdddc

Fixes-Bug: #1239603
Change-Id: I9c5b9a6b2349a6c62bef2974ab3b0bb986533741
Sanitize passwords when logging payload in wsgi

adminPass (or admin_pass) can be either part of a json object or
an xml element or xml attribute. The patch includes
regexps to support all these cases and adds tests
as well

Change-Id: Ic119f986a03863c1d13b566b4c005f3bc77d83d0
Closes-Bug: 1231263
Handle MarkerNotFound better in Flavor API

When the specified marker is not found, we should catch the
MarkerNotFound exception and respond with a HTTP 400 Bad
Request with sufficient information back to the user. This
will avoid spilling unwanted tracebacks in the logs as well.

Change-Id: I90a658384f8814096271a193a0f3abd028062b5d
Partial-Bug: 1238519
populate local-ipv4 address in config drive

Currently the ec2 metadata in config drive does not include the
local-ipv4 address, because the address is not passed in when using
config drive.

This change uses the fixed_ips in network_info to populate the address
if the address was not passed in.

Fixes bug 1221664
Change-Id: I1b289bbbd7ebe103342909079d2488cf1dfbf472
xenapi: stop using get_all_vdis_in_sr in spawn

Currently when trying to find a cached image, the very expensive call to
get_all_vdis_in_sr is used, where we could instead fetch the VDI
directly using a more targeted query.

Now we are fetching the VDI by name_label we must ensure to clear the
name_label on newly created VDIs to ensure they do not get picked up by
later calls to _find_cached_image().

Fixes bug 1221292

The above code that checks for _find_cached_images has race conditions
where its possible to end up with two VDIs returned. To stop this
happening the code to create the cached images is now synchronized on
the image being fetched.

Fixes bug 1226073

Change-Id: I534fb8f42b00b5d39dc17dd5fee297144b5f379a