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)
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)
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
Merge "Ensure MTU is set when the OVS vif driver is used" into stable/havana
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
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
Merge "Retry reservation commit and rollback on deadlock" into stable/havana
Merge "Remove reduntant call to update_instance_info_cache" into stable/havana