Remove `with_lockmode` use from Trust SQL backend.

Due to the lack of support of `SELECT .. FOR UPDATE` call in
MySQL + Galera, the use of `with_lockmode('update')` needs to be
removed from the Trust SQL backend when utilizing the MySQL
dialect.

Instead of the pessimistic locking method (row lock, table lock),
use optimistic locking. The consume_use method now attempts to
update the remaining_uses column for the trust in question only
if the remaining_uses equal the same number as on the initial
query. This is done in a loop with a 10-iteration failsafe to
prevent endless looping.

Conflicts:
	keystone/trust/backends/sql.py

Minor changes to the sql.py driver over the course of Juno
caused the conflict. The resulting code for consume has
not changed.

Change-Id: I1b8af6ce5709f829f345cd351ec9242d0217e743
Closes-Bug: #1325143
(cherry-picked from commit 0724fc4d27c90461de3310b3b2cb7387e6c92bba)
Catalog driver generates v3 catalog from v2 catalog

The default get_v3_catalog method in the catalog driver would just
raise NotImplemented. This method is given a default implementation
that generates the v3 catalog by translating the v2 catalog.

With this change, the templated and kvs catalog backends can
generate a v3 catalog.

(cherry picked from commit 8b9580456aa4223184f612330c31077624dbf0ff)

Closes-Bug: #1313458
Change-Id: I1646c7dcab90f2e0e9e370f48f7ee3643bd2fe3d
Set LDAP certificate trust options for LDAPS and TLS

We currently only set the LDAP library certificate trust options
when TLS is being used (via startTLS).  If regular LDAPS is being
used, the certificate trust options that are defined in Keystone's
configuration file are never actually set.

This patch sets the certificate trust options for both LDAPS and
TLS cases.

Conflicts:
        keystone/common/ldap/core.py
        keystone/tests/unit/common/test_ldap.py

Closes-bug: #1209343
Change-Id: Ieb94b732f623695920feb34995bb863175ddf27a
(cherry picked from commit ca50b6315909faf92db9eaf2981782bcd80cfab8)
Merge "Set LDAP certificate trust options for LDAPS and TLS" into stable/icehouse
Merge "Catalog driver generates v3 catalog from v2 catalog" into stable/icehouse
Merge "Remove `with_lockmode` use from Trust SQL backend." into stable/icehouse
Merge remote-tracking branch 'upstream/stable/icehouse' into stable/icehouse