xenapi: reduce impact of errors during SR.scan

There are some race conditions in SR.scan leading to errors similar to:
* The SR scan failed [opterr=['MAP_DUPLICATE_KEY', 'VDI', 'sm_config',
  '$UUID', 'vhd-blocks']]
* The SR scan failed [opterr=['UUID_INVALID', 'VDI', '$UUID']]

This seems to be happening because an SR.scan is happening when a xenapi
plugin is modifying the SR at the same time.

To reduce the likely-hood of this error, I have added a mutex around
calls to SR.scan to ensure nova-compute never makes more than one call
at once, because XenServer will join any extra SR.scan requests to
listen to the result of any current SR.scan that may be running.

In addition, when and error occurs during an SR scan, I have added a
retry loop, to attempt to stop these races from impacting users.

Fixes bug 1221293
Change-Id: Ib83e6e0f4f7fab2058fe137e32934606c4fe8f7e
VMWare: Disabling linked clone doesn't cache images

This fixes an issue when use_linked_clone is false and the image is
already in the cache.  The problem was that the image would be
copied from glance into the instance directory even if it was already
in the cache.  This change checks if the file is in the cache, only
copies from glance if it is not, and copies the image from the cache
into the instance directory if use_linked_clone is false.

Fixes: bug #1207064
Change-Id: Idfa59eb0eb26cce52ff59f97e433deeab6510215
Merge "xenapi: reduce impact of errors during SR.scan"
Merge "VMWare: Disabling linked clone doesn't cache images"