Use block_device_info at post_live_migration_at_destination

post_live_migration_at_destination make libvirt.xml to destination
host. when execute (live) block migration for vm made by bootable
volume, method post_live_migration_at_destination write a
libvirt.xml in destination host.
but it missed block disk information so moved libvirt.xml always
has a wrong disk information.
I add block_device_info in blockinfo.get_disk_info at
post_live_migration_at_destination.
This change will make libvirt.xml with valid block disk information.

Closes-Bug: 1271780
(cherry picked from commit 0486647e1c85947bc48cbdd279b3f49824a6e692)

Conflicts:
	nova/tests/virt/libvirt/test_libvirt.py
	nova/virt/libvirt/driver.py

Change-Id: I31b3f2ef5f03f9ef61524bdb7ae089b18e4cd254
Make rbd.libvirt_info parent class compatible

Rbd.libvirt_info function definition misses hypervisor_version argument added in change:
https://review.openstack.org/32379

Closes-Bug: #1233188
Change-Id: Ib68d743e783af0f6d82d2ba180869ee642e86050
(cherry picked from commit 7a34be0ec0cd0cb9555fe64ff6c486faae1ae91d)
Retry reservation commit and rollback on deadlock

Reservations can deadlock when concurrent commits are run from
multiple hosts on the same project. This fixes the issue by using
our convienient retry on deadlock feature.

Change-Id: I31d74f4267eaa33e798de926069d1a0f63006a59
Closes-bug: #1274341
(cherry picked from commit 9c556d1557a7056d6056b25d3b91ff4abcb97971)
Add db2 communication error code when check the db connection

Closes-Bug: #1244092
Change-Id: I17882e407afa00167e550a565081219f9e432a31
Don't raise MySQL 2013 'Lost connection' errors

Although this code error is part of the `ping_listener` tests, it
missing from the list of known - and ignored - connection errors.

The code error 2013 refers to a connection lost during a query, see:
https://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_lost

Without this error code, the session won't try to reconnect to mysql,
which makes `max_retries` useless.

Closes-bug: #1276510
Change-Id: If2667cf83ac656666ffe00aa90e3454516b080db
Remove reduntant call to update_instance_info_cache

get_instance_nw_info calls _get_instance_nw_info,
which is decorated with @refresh_cache. This in
turn calls update_instance_info_cache, again. This
is both expensive and more importantly dangerous because
the method update_instance_info_cache may call
_get_instance_nw_info itself, thus causing an infinite
loop.

Change-Id: Id8f0241d1c6609cf4e064ee6855228ae7de250e2
Partial-bug: 1235435
(cherry picked from commit 651fac3d5d250d42e640c3ac113084bf0d2fa3b4)
Remove unneeded call to conductor in network interface

The following patch removes an unneeded call to conductor to retrieve
data already available in instance.

Note: six.text_type() was added and wrapped around info_cache in some of
the tests. This was done because values from the db are in unicode
(text_type). The reason the test changed is because previously we
did not check the type of string from what the conductor was returning.

Closes-bug: #1258360

Conflicts:

	nova/tests/network/test_neutronv2.py

Change-Id: I45a24af11534911be68fd0964b79fdf726d88de6
(cherry picked from commit 10004672ad1476c55deaad53684a50358da6f656)
Enable compute_node_update to tolerate deadlocks

When running the CI there were cases when the aformentioned method would
throw a DBDeadlock exception.

Change-Id: I98d1a804c51e1bf3bb96193d82ffe7e5d064e134
Closes-bug: #1253455
Take a vm out of SNAPSHOTTING after Glance error

If a snapshot is attempted to be taken when Glance can't find the
underlying image (usually because it's been deleted), then ImageNotFound
is raised to nova.compute.manager.ComputeManager._snapshot_instance. The
error path for this leaves the instance in a snapshotting state; after
which "operator intervention" is required.

This simply reverts the instance state under that specific circumstance.

DocImpact: previously a snapshot that failed for this reason would leave
the instance in a spurious snapshotting task state indefinitely. Now,
the task state is reverted. At the moment that revert is 'silent'
(although the failure to snapshot will be evident to the user).

Fixes-bug: #1267097
(cherry picked from commit 96dba50737819c24b4ddd9cb1078da305638abc9)

Conflicts:

	nova/compute/manager.py

Change-Id: I9623cfaed31e8337ab65bc1eab85ad3b51b1a5ca
Further harden boto version checking in EC2 tests

Use pkg_resources to determine correct boto interface
to use in API tests.  stable/havana version.

Fixes Bug #1239220

Rebased-By: Dirk Mueller <dirk@dmllr.de>

Change-Id: I455ce5f2aabfad7178be361844c6b9b7b0d9c946
Merge "Add db2 communication error code when check the db connection" into stable/havana
VMware: fix disk extend bug when no space on datastore

In the event that thete is no space on the datastore then ensure
that the disk extension is cleaned up accordingly.

A number of files would be left behind on the datastore.

Change-Id: Ica9daf9151e4fb1874fa8b1d7247080860ef4ae2
Related-Bug: #1255355
(cherry picked from commit 787d36b40b41c1ee1e56ae3f8d17984e70c59a8e)
Merge "Don't raise MySQL 2013 'Lost connection' errors" into stable/havana
Explicity teardown on error in libguestfs setup()

Previously, in the setup method of the libguestfs driver
for Nova's VFS, on an error the handle object was simply
dereferenced (set to None), and then an new error was thrown.
This relied on an implicit close() on the handle being called
by GC.  However, in some cases the setup progresses far enough
that the implicit close is not enough, and leaves an "orphaned"
libguestfs VM.

Now, the teardown() method is called explicitly, which ensures that
no "orphaned" VMs are left around in case of an error.

Change-Id: I7fbe470046ce6c76bc13d77d8df360351a3ef715
Fixes: bug #1270304
(cherry picked from commit fa62cfe15fd6dddecf657966d166a2d3a2bdd317)
Merge "Retry reservation commit and rollback on deadlock" into stable/havana
Merge "Remove reduntant call to update_instance_info_cache" into stable/havana
Merge "Remove unneeded call to conductor in network interface" into stable/havana
VMware: fix image snapshot with attached volume

A snapshot of a instance with an attached volume will result in
the wrong volume being uploaded to glance. The reason for this
are as follows:
1. the last image in the list of images would be exported
2. the base image would not be exported but the first found

The same happens with a VM rescue if there is a cinder volume
attached.

The solution is to search for an image that contains the instance
UUID.

Change-Id: Ic85b0ffd4f1c34f10d07b1a198eaad2030803d6f
Closes-bug: #1243193
(cherry picked from commit 9ceee09594cd35c264cab3e3b3d1d80aaa3fdbc4)

Conflicts:

	nova/virt/vmwareapi/vm_util.py
	nova/virt/vmwareapi/vmops.py

Change-Id: I6b9febbfe4e4e6ecf5d31a2b09a4319b07696f9c
VMware: fix bug for exceptions thrown in _wait_for_task

If the _call_method fails, for example a resource is not found,
then the same call will be invoked again due to the fact that the
polling task was not stopped.

Closes-Bug: #1246848

Change-Id: If4818e41aed5be03395ab22afc0edf9abb3c34e1
(cherry picked from commit 1c1570ff7ac8470d7dba28c893300835b22e0966)
Fixed a problem in iSCSI multipath

Multipathing for attach volume and detach volume operations
doesn't work properly if there are different targets
associated with different portals for a mulitpath device.

Closes-Bug: #1266051
(cherry picked from commit 429ac4dedd617f8c1f7c88dd8ece6b7d2f2accd0)

Conflicts:
	nova/tests/virt/libvirt/test_libvirt_volume.py
	nova/virt/libvirt/volume.py

Change-Id: Iab316526cf64de60325d90043f73fa3e83fafb4e