fix lockutils.lock() to make it thread-safe

lockutils.lock() is currenctly safe when used with greenthreads, but it is not
safe when used with classic threads. This change uses a lock to protect
_semaphores dictionary.

Change-Id: Ia18e6e9f9a1353640729ac57d7225c660159cd55
Closes-Bug: 1065529
Add unit constants

There are lots of numeric expressions across some projects, such as
1024*1024 , 1024**3, 1000, 1000000 etc. This patch adds binary and
decimal unit constants and will sync into other projects. Replacing
nummeric experssions with these constants makes code more readable.

blueprint byte-unit-clean

Change-Id: I5093244f607d8c3a61a5f6b7ecbe657e5574b793
Merge "Add unit constants"
Refactors byte size extraction logic

The logic of _extract_bytes() in imageutils.QemuImgInfo
is not efficient. See
https://review.openstack.org/#/c/41363/11/openstack/common/imageutils.py

This patch enhances the regex pattern to extract the byte size info
more efficiently.

Change-Id: I6efb3a6020179ac93c9d7848403c0fad0ebb1d1c
Use fileutils.write_to_tempfile in LogConfigTestCase

There is method to create temporary file in fileutils.
we can utilize that.

Change-Id: I6bbcc82dea509d0a9ea9e831631f6c7cc0c50039
Merge "Use fileutils.write_to_tempfile in LogConfigTestCase"
matchmaker_redis compatibility with redis-py 2.4

From the redis documentation: "In addition to the changes above,
the Redis class, a subclass of StrictRedis, overrides several other
commands to provide backwards compatibility with older versions
of redis-py"

Change-Id: I76ca0d9660b086dfed74733f63450fecb89decb7
Closes-Bug: 1245447
Adjust import order according to PEP8 imports rule

This patch just adjust import order to follow PEP8 imports rule.
See http://www.python.org/dev/peps/pep-0008/#imports
Imports should be grouped in the following order:

    standard library imports
    related third party imports
    local application/library specific imports

Change-Id: I6d92e9eda72d83cbf940b7699268f884bd4045c1
Fix typos in oslo

Change-Id: Ic2854d6ba6c40df6c4d5e01c1f4780dd6b2cded1
Merge "Refactors byte size extraction logic"
Add TempHomeDir fixture which is already part of cookiecutter template

TempHomeDir fixture creates a temporary directory and sets it as $HOME in the
environment. Also tearDown will remove it and reverts back $HOME value to
the previous one.

1. In one of the review comments for https://review.openstack.org/#/c/55111,
   russellb suggested to add TempHomeDir fixture to test module.

2. Cookiecutter template for OpenStack based projects already has this.

Change-Id: I7bd86a9d1e1951e04a632cecb181fc1e2c30f392
Add mask password impl from other projects

A couple of different projects have an implementation for 'masking'
passwords in logs and wsgi output.

This seems like something that should go into Oslo-incubator as a common
implementation. This implementation is based off the following two
implementations in Keystone and Nova:

  https://review.openstack.org/#/c/26487/12
  https://review.openstack.org/#/c/49664/

Partial-Bug: #1247217

Change-Id: I2b1bbb4d3ddaa163573b685b3e3a5e8a3977e390
Merge "Add TempHomeDir fixture which is already part of cookiecutter template"
Merge "Add mask password impl from other projects"
Merge "Fix typos in oslo"
Add some log messages to capabilities_filter.py

There is no log message in capabilities_filter.py when host did not
pass this filter. It is better add some log messages in this file
to improve debug ability.

Change-Id: Ie57a8882a69f7914e67871a188d664cd6949538f
Use six.text_type instead of unicode function in tests

This patch replaces unicode function with six.text_type in tests.
Let test code don't break in Python3 environment.
See http://pythonhosted.org/six/#six.text_type

Change-Id: I27e0db2034da7898f713719cc81f1b6c1f1fdeea
Use six.string_type instead of basestring

This patch replaces basestring with six.string_type.
Let our code don't break in Python3 environment.
See http://pythonhosted.org/six/#six.string_types

Change-Id: Ib0c74b1f2a90dbee9ce56be01ebac51bbe8dc468
Merge "Adjust import order according to PEP8 imports rule"
Merge "fix lockutils.lock() to make it thread-safe"