Fixes Invalid tag name error when using k:v tagname

This patch fixes the invalid tag name error when k:v type
tagname appears in response of api during xml serialization,
the tagname which contains colon couldn't be supported by
default since it is reserved by xml namespace, this patch
solve it by adding the k of k:v tagname into namespace.

Fixes bug: #1213927

Change-Id: Ib20efb378425cbe5deef45fbac561955cbe0f7bc
(cherry picked from commit 80b11279ba9853a9ab743ec6987c3229fff0b5e4)
hyperv: Initialize target_iqn in attach_volume

The target_iqn is referenced before it is declared in the
case that an exception is encountered in _login_storage_target
or _get_mounted_disk_from_lun.  This causes the exception path
to cause an additional, misleading, traceback to be printed
after an exception is encountered.

This commit initializes target_iqn at the beginning of
attach_volume to avoid the traceback.

Closes-Bug: 1233837
Change-Id: I1cdfb9dfa054ee4f4f6918d7bc49081ccaebab9d
(cherry picked from commit 9baa186ebb578205c513c94fc621e254f4c13a08)
Remove unnecessary "LOG.error()" statement

Removes apparent debug statement left in from
Ifd41886b9bc7dff01cdf741a833946bed1bdddc

Closes-Bug: #1239603
Change-Id: I9c5b9a6b2349a6c62bef2974ab3b0bb986533741
(cherry picked from commit 7ef98b44374945cd157b125a9b46ee5727d285fe)
Add notification on deleting instance without host

If an instance which does not have a host associated is deleted, the
corresponding notifications were not being sent. Fixed the issue.

Closes-Bug: #1211742

Change-Id: I56482ab38725e6f1ddfb14350637d329f35095b3
(cherry picked from commit bbab55c4da531e4695a6e3e577aaa4975f0fce79)
Cells: Fix instance deletes

A regression was introduced with object conversion that caused all
instances to be locally deleted in the API cell when cells is enabled.
This would happen before the child cell was told to delete the instance.

Additionally, if an instance record was created in a child cell but
failed to schedule to a host in such a way that the API cell has
no knowledge of the 'host', the instance would be deleted in the API
cell only.

Also, it appears that we would cast deletes to child cells twice due to
logic duplicated in cells_api.py that exists in api.py.

Closes-Bug: #1240247

Change-Id: I94cfddd9cef2d63b2cb31c0f2dae8e211a4418d9
(cherry picked from commit 0493c803ae9612f87ed028e1a39e880aead5bdcb)
Fail quickly if file injection for boot volume

Previously if the user attempted file injection on a booted volume it
would fail and retry several times, which slowed down the instance
spawning.  Instead of attempting file injection, fail quickly, and
log a warning

Fix bug 1188543

Change-Id: I264540de736c2bcb92567826fe5ba672e1244ba2
(cherry picked from commit f59c2d64ac8f0523c587e23b2d1c59fdfe7ea131)
Pass volume_api to get_encryption_metadata

The module encryptors was creating a volume API instance in the module
scope which caused all the modules importing it to depend on
cinderclient.

This was affecting scheduler and cert services which at some point import
the compute manager module only to access their config options. It makes
no sense to force scheduler and cert services to require cinderclient.

This patch makes the callers of get_encryption_metadata to pass the
volume api object to this method to prevent this dependency.

Closes-Bug: #1246103
Change-Id: I9eb4ae3754fa2a5ac646560a62477d6ed672e272
(cherry picked from commit a3aeace9afd5c533f040452f33482fdb55d93927)
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
(cherry picked from commit c28c87db4c2b20e0f6c1375d2d4433e06c4e1743)
Make unshelve use new style BDM

Unshelving an instance requires recreating it, and since change
I5b9c3e2d959c602fa22f49db681da918ae0adcea, it is necessary to call
compute manager's _prep_block_device with new style BDMs.

This patch makes the conductor return new-style BDMs when unshelving the
instance.

Closes-bug: 1246412
blueprint: clean-up-legacy-block-device-mapping

Change-Id: I0ba9f53c31c4d5238319cfd09600ad64f298629e
(cherry picked from commit 7fb9fcc970324236267d893185b421e26b1cb1d9)
Fix setting backdoor port in service start

Previously if self.manager wasn't defined for a Service object but a
backdoor_port was specified then that particular service would not
start because it would try to set the backdoor port in an object that
didn't exist. This commit fixes setting the backdoor port only if
manager is defined when calling start().

Closes-Bug: #1243260

Change-Id: Ib0e709cfd0e299a3e010450b7eba6e92bc108e4e
(cherry picked from commit e5c96505c0b4eac51c0925dcb691f0a1699216ce)
VMware: fix bug for reporting instance UUID's

Ensure that the correct UUID's are reported to the compute
manager. The fix will return only valid UUID's and not all
of the names of the instances running.

Closes-Bug: #1237795

Change-Id: I32bb6f4783dcc80697abebd5a7f45ef9950a0896
(cherry picked from commit 74289aacb5363bd72b449580325a651117e5342d)
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
(cherry picked from commit c6d82083295e9b1b42f22d3a2d25a1ab7d341a13)
Merge "Remove unnecessary "LOG.error()" statement" into stable/havana
Merge "Make unshelve use new style BDM" into stable/havana
Merge "Sanitize passwords when logging payload in wsgi" into stable/havana
Merge "Add notification on deleting instance without host" into stable/havana
Merge "VMware: fix bug for reporting instance UUID's" into stable/havana
Fixes Hyper-V snapshot spawning issue

In Hyper-V, snapshoting an instance and then spawning a new
one using the resulted snapshot image with the same flavor,
will result an Hyper-V Exception.

Hyper-V will get the request to resize the base image to it's
actual size, leading to an error.

The reason is that the logic of the resize_vhd method has been
changed, as it is meant to resize images to the flavor size minus
the image metadata size, thus it's maximum internal size. For this
reason, the way to decide whether the root image should be resized
or not must also be changed.

So, instead of comparing the root image and base image sizes,
we should compare their maximum internal sizes.

Closes-Bug: #1234759

Change-Id: I83d2df76b726d705cedc52a8309a2be7037d6a79
(cherry picked from commit efdca8eeaffe6e63d57243147658f4691da3d89e)
Merge "Fix setting backdoor port in service start" into stable/havana
Merge "Fail quickly if file injection for boot volume" into stable/havana