os._exit in _start_child may cause unexpected exception

In _start_child, we may os._exit(status).
status is set by the return value of _child_wait_for_exit_or_signal.
, where status may be None.
And defensive coding to prevent the unexpected exceptions

Change-Id: I4b89147225cc9e848a97816f171f77236bd23b2c
Add helper method total_seconds in timeutils.py

Almost every OpenStack project is using hardcode to calculate duration
like 'delta.days * 24 * 3600', even 2592000. Method delta_seconds takes
a timedelta instance as input to compute total seconds.

Method delta_seconds also is refactored to call new method.

Change-Id: I397bae402e012c28aaa6aa2bb10170b83eeeaa8c
Drop dependency on lockutils from oslo db code

While lockutils is a useful module, it registers a few oslo.config
options, which can possibly lead to unpleasant issues
(DuplicateOptError) when we split oslo.db from oslo-incubator into a
separate library and reuse both lockutils and oslo.db in target
projects. Unfortunately, we can't just remove usage of oslo.config
options from locktutils as it can break backward compatibility for
existing deployments.
The general approach of solving DuplicateOptError issues for oslo
libraries is not to depend on oslo.config as much as possible. So it's
actually worth to have a small code duplication here for the sake of
oslo.db as a standalone library in the future.

Change-Id: I7e3c5e1e9f7df0fec01e0d484e709cb2375025f1
Fix error when no custom config file matches *.conf.sample

In generate_sample.sh, an error will be raised when no custom config
files match '$BASEDIR/tools/config/*.conf.sample', because CONCAT_FILE
will be set with value '$BASEDIR/tools/config/*.conf.sample'.

for CONCAT_FILE in $BASEDIR/tools/config/*.conf.sample; do

    cat $CONCAT_FILE >> $OUTPUTFILE

done

This path will check match result first to avoid the error.

Closes-Bug: #1251297
Change-Id: I4bb2036b1d385e8f7621cbd8b14134f12618230d
Run generate_sample.sh as part of tox tests

Right now there is no guarantee that any changes to the sample
config generation code actually work.  Even though Oslo doesn't
need a sample config, run the script anyway to at least catch
major errors.

Change-Id: If63f84184c459bc3e2245b7fde19362140243894
Change capabilities filters to use resource type

A recent change in scheduler/filters/capabilities_filters.py added log
message, however since this filter is supposed to accommodate both Nova
and Cinder capabilities, the 'instance_type' should be 'resource_type'.

Change-Id: I21ccd7b628009aaf5db4af896b64b73fb6c40fe0
Merge "Fix error when no custom config file matches *.conf.sample"
Merge "Run generate_sample.sh as part of tox tests"
Merge "Change capabilities filters to use resource type"
SQLite behavior independent DB test cases

Currently, cleanups in DB test cases rely on the fact, that SQLite
in-memory DB is always used. To be able to run those test cases on RDBMS
like MySQL and PostgreSQL we must make sure that all created tables are
dropped and that test cases use a newly created SQLAlchemy engine
instance. Currently used a kind of Singleton. An instance of sqlalchemy
engine declared globally and reusing until it will be cleaned. Thus
session.cleanup() call is required to destroy engine where it was
created.

Blueprint: tests-given-db-backend
Change-Id: I81d1ac2804dc7434f7ed1f36206f39f777480398
Have tox install via setup.py develop

tox 1.6 was released, which means that we can now take advantage of the
feature we added to it - which is using setup.py develop to install the
code into the virtualenv. The logic was taken from run_tests.sh - so the
performance issues around using tox vs. using install_venv should now be
gone.

Ported from Nova: 32d63a9fbe6f353ca1af8922d6bcbb012a2cc32c
Change-Id: If83a5b5473344d3a0e3a3a9fbb4ba16fa75f5be3
Merge "Add helper method total_seconds in timeutils.py"
Don't use deprecated module commands

The commands module was deprecated since version 2.6 and it has been
removed in Python 3. This patch uses processutils.trycmd method to
replace of deprecated module commands.
See http://docs.python.org/2/library/commands#module-commands

Closes-Bug: #1248216

Change-Id: Iee0b3cf59c738bfda9c5b2049a1853abbb6d16e0
Clean up extra modules code

The config generator extra modules code was attempting to look up
an empty module name if extra modules were not specified.  This
resulted in a spurious exception.

This change also strips the module names so extra spaces in the
env var won't cause problems.

Change-Id: I4cfbeb62fc25220ab43d6f80006245be3376dc93
Improve error reporting on import failures

The existing config generator code does not report general errors
importing modules well.  In my case, that meant I had no idea that
an old version of six on my system was causing a module import to
fail.

This change logs all errors importing a module to stderr.

Change-Id: I4663f5bbd4f553c0d6ce5f84b1c1275a7304e3b5
Merge "Have tox install via setup.py develop"
Merge "os._exit in _start_child may cause unexpected exception"
Merge "SQLite behavior independent DB test cases"
Merge "Drop dependency on lockutils from oslo db code"
Merge "Clean up extra modules code"