Sync oslo lockutils for "fix lockutils.lock() to make it thread-safe"

Pull in oslo-incubator change Ia18e6e9f "fix lockutils.lock() to make it
thread-safe" along with dependencies.

Note: I've intentionally excluded log.py from the sync since it pulls in
Change Ic2cf3e52: Adding domain to context and log which is (1) unrelated
to the lockutils change and (2) also changes context.py, which lockutils
does not depend on.

Changes by module (from oldest to newest)
=========================================

excutils:

Change Ic36fa050: Enable H302 hacking check
Change Ibf3c56e4: BaseException.message is deprecated since Python 2.6
Change I87fd89ff: excutils: use six.reraise to re-raise
Change If640e551: excutils: replace unicode by six.u
Change Ic6f0c0ef: Remove vim header

fileutils:

Change Ia51d416b: Add utils for creating tempfile
Change Ic6f0c0ef: Remove vim header

gettextutils:

Change Ic6f0c0ef: Remove vim header

importutils:

Change Ic6f0c0ef: Remove vim header

jsonutils:

Change Ic6f0c0ef: Remove vim header
Change I90be8797: Use six.iteritems to make dict work on Python2/3

local:

Change Ic6f0c0ef: Remove vim header

lockutils:

Change I64fccddc: Allow lockutils to get lock_path conf from envvar
Change I9e1260e2: Add main() to lockutils that creates temp dir
Change Ia18e6e9f: fix lockutils.lock() to make it thread-safe
Change Ic6f0c0ef: Remove vim header

timeutils:

Change I397bae40: Add helper method total_seconds in timeutils.py
Change Ic6f0c0ef: Remove vim header

Related-Bug: #1065529

Change-Id: Ia3530c0d3e78d90fd6de8ac186b252e0fbbba85e
Merge "Sync oslo lockutils for "fix lockutils.lock() to make it thread-safe""
XenAPI: Speedup host_ref cannot change - get it once

The host we run on is fixed - getting this each time from XAPI
is expensive

Change-Id: Ifee9a778f3ed855ef52b001de3fc2ebbd0b972cf
XenAPI: get_info was very expensive

Getting the whole VM record is expensive and slowed down Tempest tests
significantly.  Replaced with getting each required item.

When getting power state, only need that specific value, so reduce the
calls to get_info too.

Change-Id: I93bcef5b692a531aac41518dc29d5d4f46cded65
XenAPI: Tidy calls to get_all_ref_and_rec

get_all_records is more efficient than getting them individually in the
old get_all_ref_and_rec implementation.

Replaced some cases of get_all_records with a faster and more
specific API call.

Change-Id: I4725c3f1fdebdf1737941cb7db69b19afb22df9f
XenAPI: Speedup get_vhd_parent_uuid

In many cases the VDI record has already been retrieved.
Use it rather than expensively getting a new VDI record from XAPI.

Change-Id: I469e2a415c1f1924010f47d3927ca18c45a7b8f8
XenAPI: Use get_VALUE in preference to get_record()['VALUE']

Replaces calls to get_record where only a single item is retrieved
from the record with the specific get_VALUE call.

Change-Id: I52e20c4f4c9d6a6ad019694916ee057cc96b18a6
XenAPI: Synchronize on all VBD plug/unplug per VM

Dynamically adding or removing a device needs to be synchronized
to work around a bug in XenServer 6.1 and 6.2 where simultaneous
events can be partially ignored, leading to a failure to plug or
unplug.

Change I041365ed863a1a1c55e88025dff42d01c35494a2 attempted to
work around the issue by retrying - however that does not catch
all failures.  This change should eliminate some of the known
INTERNAL_ERROR failures, but not all, so I041 should not be
reverted.

Change Ie7a64c481a9e3874df9d5924fbb050ac7ab117db does the same
as this, but only for VBD.plug.

Change-Id: If78d4e5f1dd84f1d4a588f25b8f887a7b125bbea
Closes-bug: 1217972
XenAPI: Monitor the GC when coalescing

Add a new host plugin to monitor whether the garbage collector is running.
This is then used by the wait_for_vhd_coalesce function to know whether
waiting any more is likely to produce the expected results.

Increased the number of times we loop waiting for coalesce as the loop
now has knowledge that something is still happening.

Change-Id: Idcc0738945bd1aee8cdb52c9cfabd798f85c31db
Closes-bug: 1258169

Conflicts:

	nova/virt/xenapi/vm_utils.py
XenAPI: Use direct IO for writing config drive

If you don't use direct IO when writing to the device, the unplug
immediately following this may not succeed as the device may still
be in use.

Also add a sync to ensure the device is not being used at the point
of unplug

Change-Id: I68f09835648b36772a7839af9718123a4c60734f