Ensure MTU is set when the OVS vif driver is used

Set the MTU on the relevant devices when the OVS vif driver
is used:
    - veth devices
    - ovs vif device

Closes-bug: 1260697

Conflicts:

	nova/network/linux_net.py

Change-Id: I217f43227c099f17ab9a225b1ef7377d3de28114
(cherry picked from commit e34a085f7a524747dd93e9645c6e0e69631075d4)
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
libvirt: handle exception while get vcpu info

If an exception is raised while get a libvirt domain's vcpu info,
the update_available_resource periodic task will be failed, which
will result in the resource of this compute node will never be
reported.

This patch add an exception handling to avoid this situation.
Closes-bug: #1270008

Change-Id: I69109402416989fdaa421f8dbc72953bd067c407
(cherry picked from commit 844df860c38ac38550b8d1739fd53131cd7fd864)
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)
hyperv: Retry after WMI query fails to find dev

During long stress runs the WMI query that is looking for
the iSCSI device number can incorrectly return no data.
If the query is retried the appropriate data can then be
obtained.

This commit adds a retry loop, calling
basevolumeutils.get_device_number_for_target to avoid this situation.
It also handles the case where the devices list returned in
get_device_number_for_target is empty.  The retry loop is
implemented with new mounted_disk_query_retry_count and
mounted_disk_query_retry_interval configuration options.

Unit tests have been added to check the good and bad paths for
get_mounted_disk_from_lun.

DocImpact
Closes-bug: 1247901
Change-Id: I082c4b1694efcd20cce65293cd330b7a0cf7d470
(cherry picked from commit d143540ad1b69ec93c2b7bfadd1f654c4d8c7a34)
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
Fix changes-since filter for list-servers API

On list-servers API, "changes-since" parameter filters out servers
which have been created at the same date as the specified timestamp.
For example, the following server is filtered out with "changes-since=
2013-12-05T15:03:25":

  mysql> select display_name, updated_at from instances;
  +--------------+---------------------+
  | display_name | updated_at          |
  +--------------+---------------------+
  | vm01         | 2013-12-05 15:03:25 |
  +--------------+---------------------+

This bug causes some Tempest test failures, if the timestamp of server
creations are the same as the "changes-since" timestamp in second unit.
In addition, the behavior would be wrong from the viewpoint of its name
which includes "since".

This patch chanegs the server list for including the ones created at
the specified timestamp.

Change-Id: Icc10a1363503b3553d810c6be20b86b3da7ac1a0
Closes-Bug: #1236585
(cherry picked from commit d87bd44d0211a633efd545dc7b2027a613897b85)
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)
VMware: Always upload a snapshot as a preallocated disk

Currently, a snapshot operation always produces a preallocated
disk type. When the snapshot is uploaded to glance, the source
image metadata is uploaded with the new snapshot and then some
of the metadata properties are updated. The update doesn't
include the disk_type property, this can be problematic. If
the original image has a sparse disk type and a snapshot is
taken, then the snapshot which is a preallocated disk type is
uploaded to glance with the disk_type property set to sparse,
which creates a disk type mismatch and causes errors when a vm
is spawned from that snapshot. This patch addresses the issue
by correcting the image metadata used when uploading a snapshot
to glance.

Also, the image_upload function in vmwareapi/fake.py has been
modified to address the change. Any function call to
image_upload (from the unit tests) will assert that the
metadata for the image to be uploaded must have the disk_type
value to be preallocated.

Closes-Bug: 1247296
(cherry picked from commit 11e327f888a6dbde990d75196560083fddecf394)

Conflicts:

	nova/tests/virt/vmwareapi/test_vmwareapi.py
Change-Id: I71cfa8d4d1eb7911abb489153292fb0d1e614765
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
Merge "Ensure MTU is set when the OVS vif driver is used" into stable/havana
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 "Fix changes-since filter for list-servers API" into stable/havana
Merge "VMware: Always upload a snapshot as a preallocated disk" into stable/havana
Merge "hyperv: Retry after WMI query fails to find dev" into stable/havana
Merge "libvirt: handle exception while get vcpu info" into stable/havana