libvirt: Make sure volumes are well detected during block migration

Current implementation of live migration in libvirt incorrectly includes
block devices on shared storage (e.g., NFS) when computing destination
storage requirements. Since these volumes are already on shared storage
they do not need to be migrated. As a result, migration fails if the
amount of free space on the shared drive is less than the size of the
volume to be migrated. The problem is addressed by adding a
block_device_info parameter to check_can_live_migrate_source() to allow
volumes to be filtered correctly when computing migration space
requirements.

This only fixes the issue on libvirt: it is unclear whether other
implementations suffer from the same issue.

Thanks to Florent Flament for spotting and fixing an issue while trying out
this patch.

Co-Authored-By: Florent Flament <florent.flament@cloudwatt.com>
Change-Id: Iac7d2cd2a70800fd89864463ca45c030c47411b0
Closes-Bug: #1356552
Fix image metadata returned for volumes

When creating a volume from a glance image, cinder stores the original
image metadata in volume_glance_metadata. This is a key/value store,
and all the values are strings.

When Nova boots an instance from a volume, it passes the image
metadata returned by cinder, which is all strings. If a driver
expects these values to be ints, as they are when booting from an
image, it will get a type error.

This change also pulls size from the volume directly rather than
taking the value from the stored image metadata. This is because the
volume will have been created in 1Gb increments, and is unlikely to be
the same size as the original image. It may also have been
subsequently extended.

Change-Id: I7928f6be1ca99f1502941b9df2b443f2ca63a37b
Closes-Bug: #1367540
VMware: get_all_cluster_refs_by_name default to {}

Currently get_all_cluster_refs_by_name returns None when no cluster
is found.
driver.py is using the keys() method without checking whether the
object returned is None. This can potentially end up throwing an
AttributeError.

This patch fixes the issue by returning an empty dictionary when no
cluster is found.

Change-Id: I3293c916d79aaa4de8913e8ab9c609c9c0bb023e
Closes-Bug: #1372672
Remove unused code in pci_manager.get_instance_pci_devs()

Change-Id: Iec4aa59099a04b684358b44a06290584cc564507
Closes-Bug: 1361797
Remove unused modules copied from oslo-incubator

No longer needed since we moved to oslo.utils and
oslo.serialization and updated to latest oslo-incubator.
As part of the cleanup removed the hack for gettextutils
since the oslo-incubator code no longer uses it

Change-Id: Ib020cd4c3464f1c994a6d77f4b894f41b99e6d02
Fix unit test failure due to tests sharing mocks

A recent refactor made test_get_port_vnic_info 2 and 3 share code
in a private method _test_get_port_vnic_info(). A mock on this method
is shared between the tests and can cause the following failure:

AssertionError: Expected to be called once. Called 2 times.

This is changed so that the two test methods create separate mocks and
pass to the shared method.

Change-Id: I3902b7b7cf4b4b3fdc2885bf2611a712d008c617
Closes-Bug: #1381414
Merge "Remove unused code in pci_manager.get_instance_pci_devs()"
Merge "VMware: get_all_cluster_refs_by_name default to {}"
Merge "Fix image metadata returned for volumes"
Merge "Remove unused modules copied from oslo-incubator"
Merge "libvirt: Make sure volumes are well detected during block migration"
Merge "Fix unit test failure due to tests sharing mocks"
Merge commit 'refs/changes/41/127941/3' of git://gold.eng.hq.xensource.com/git/github/openstack/nova into tmpbranch