Adds support for username to match the v2 spec

The v2.0 API spec uses username for the user's name, whereas the v3 API
just uses name. The v2.0 implementaion incorrectly used name instead of
username, but did allow a username to be specified and stored in the
extras.

This patch makes the implementation more closely conform to the API
without breaking backward compatibility. Anyone using name in the v2.0
API can continue to do so. They can even specify a username that will
still get stored in the extras. Users can now use the documented
username instead of name and the API will work for them as well.

Both name and username will always be returned for the v2 API calls.

DocImpact
Change-Id: Ia95aa5d442a8311925399fa59e5022d31f68d374
Closes-Bug: #1214686
Remove unused token.valid index

Because valid is only ever used in conjunction with expires, we do not
need it to have its own index now that there is a covering compound
index for expires and valid.

Note that he expires index is still useful alone for purging old tokens
as we do not filter for valid in that case.

Change-Id: Ib8ac2ab740b480f8ab29c07e66247f4fce15150b
Fixes the v2 GET /extensions curl example in the documentation.

Change-Id: I2bca0acd4fbc19547be6f5b872ad873938779894
Sync several modules from oslo-incubator

This change syncronizes excutils,lockutils,log, and
db.sqlalchemy.session modules from oslo-incubator
commit 19e0a51204df247dc38de880d08e6d66e89e6572 .

 $ python update.py --nodeps --base keystone --dest-dir ../keystone \
     --modules  excutils,lockutils,log,db.sqlalchemy.session

This includes fixes for 2 problems:

"keystone=INFO" was in the default_log_levels. This made it
more difficult than necessary to debug the Keystone server,
since you can set debug=True but then the keystone logging
level is overridden and you get no debug output for keystone.

"keystone=INFO" may have been in the default_log_levels because
of the auth_token middleware, but this has been moved to
python-keystoneclient now and the logging config for the
python APIs is done differently.

Closes-Bug: 1245629

Also, fixes some warnings and errors when docs are generated.

Change-Id: I53868bef975f73b4aee35695b6387b718c4179f9
Reduced parameters not used in _populate_user()

The method "_populate_user" in /keystone/token/providers/common.py have
two parameters (domain_id and project_id)not used. the two parameters
should be reduced

Change-Id: I30e750f756259bb14ca8626c416f1511a0dc2537
Closes-bug: #1262589
Updated Keystone development install instructions for Ubuntu

Closes-bug:#1205943

Change-Id: I5d18d543126ac4cf8e4fa4d3b2d1f37f9c87e6f8
Fix variable passed to driver module

If a create project request is sent to keystone with no enabled field set,
the default behavior should be to set enabled to True for the new project,
but because we are passing the wrong variable to the driver creation
method, this new project end up with the enabled field set to "nothing".

Closes-Bug: #1261976
Change-Id: I9ebfdde03c0f25cadd1323de9863a230d8058f4e
Synchronized with oslo db and db.sqlalchemy

In most cases Oslo-incubator contains the most relevant code.
Furthermore in certain cases exists bugs which can be fixed by
synchronization with Oslo. Thus regular sync is required.

                        Changes from oslo-incubator
==============================================================================
8b2b0b7 Use hacking import_exceptions for gettextutils._
9bc593e Add docstring for exception handlers of session
855644a Removal of _REPOSITORY global variable.
ea6caf9 Remove string.lowercase usage
a33989e Remove eventlet tpool from common db.api
e40903b Database hook enabling traditional mode at MySQL
f2115a0 Replace xrange in for loop with range
c802fa6 SQLAlchemy error patterns improved
1c1f199 Remove unused import
6d0a6c3 Correct invalid docstrings
fb0e86a Use six.moves.configparser instead of ConfigParser
6603e8f Remove sqlalchemy-migrate 0.7.3 patching
97d8cf4 Remove lazy loading of database backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Synced from Oslo-Incubator commit: 517c4cc65969f93b4b758a568725a1625abfd24d

Change-Id: Ida6b38b8e41c73c67170e4ec43943e661f014629
Imported Translations from Transifex

Change-Id: Ia607ced952e87c6ab060928026374e2e8f684b4c
Fix use the fact that empty sequences are false.

For sequences(strings, lists, tuples), in order to consistent with
pep8 recommendations, 'if len(seq)' should be replaced with 'if seq',
and 'if not len(seq)' should be replaced with 'if not seq'.

Change-Id: Ieb2c90b7f87b54361a2c291a838550227fde9fbe
Closes-Bug: #1156472
Merge "Fix variable passed to driver module"
Merge "Fix use the fact that empty sequences are false."
Remove unused code in contrib/ec2/controllers.py

"token_id = uuid.uuid4().hex" is unused code, remove it

Change-Id: I4362f99e6119699328ba112d5106148669d405a2
Closes-Bug: #1264946
Fix IPv6 check

IPv6 test should be skipped if both IPv6 address family
is not recognize and if we can't bind to ::1

Closes-Bug: #1263663
Change-Id: I7f70719ffb7cf51ba3100a82da68d1af9a41623f
Merge "Reduced parameters not used in _populate_user()"
Fix typo in test

A single-char typo in test_auth caused a value that should have
been a simple string into a tuple of strings. This made the test
generate what's actually invalid input data since the username
is supposed to be a simple string.

Change-Id: I7a477bb8e5504c1c7982cf56ffe69e1c5294cadf
Related-bug: #1265108
Remove unused imports

Remove unused imports in doc/ext/apidoc.py

Change-Id: I379ab62564631e7c5a9b616b6eabcc6b4d9e966c
Closes-Bug: #1265332
Merge "Fix IPv6 check"
Remove noop code

All these lines of code did was get a logger. Getting a logger is
a noop.

The comment says that this code was supposed to change the logging
configuration but it doesn't do that. Also, this isn't the correct
way to change the logging configuration, see
https://review.openstack.org/#/c/62068/

Change-Id: Ie03a9164a5f4e9b1aa5622eb44bbe891015a26be
Enhance list_group_users in GroupApi.

If there is no member in the group.
When get the group users, the varible "member" is an empty dictionary.
It will crash at "member[self.member_attribute]".
This commit add a judgment to determine the member is empty or not.

Closes-Bug: #1259426
Change-Id: Ic20549204bcc35f71464b858f5ca900a4bbfe049