Sync latest apiclient code from Oslo

We needs to update apiclient code to have ability to use it in py3 environment.

Сhanges from oslo-incubator related to apiclient
=====================================================================
Change 8575d87 - Removed copyright from empty files
Change bbaf317 - Use encode() instead of strutils.safe_encode() in fake_client
Change 41dc2b4 - Encode response from FakeHTTPClient
Change e6494c2 - Use six.iteritems to make dict work on Python2/3
Change 0d8f18b - Use urlutils functions instead of urllib/urllib2
Change 16fb43b - Replace data structures' attribute with six module
Change 9d0ec6a - Use six.iteritems for python 3.3 support in apiclient module
Change 12bcdb7 - Remove vim header
Change 4c22556 - Use py3kcompat urlutils functions instead of urlparse
Change 3970d46 - Fix typos in oslo
Change 1771a77 - Adjust import order according to PEP8 imports rule
Change da611e6 - Transform the for loop to expression
Change 4bfb7a2 - Apply six for metaclass
Change eca62f7 - Changed header from LLC to Foundation based on trademark policies

Change-Id: Ia87807828f344e463fa308413bd627dc57d1a41d
Fix typos in cinderclient

Small nit-pics in volume_transfers.

Change-Id: I846b38970b14e6385269a02bb495c63464ea0842
Closes-Bug: #1255905
Remove tox locale overrides

* tox.ini: The LANG, LANGUAGE and LC_ALL environment overrides were
introduced originally during the testr migration in an attempt to be
conservative about the possibility that locale settings in the
calling environment could cause consistency problems for test runs.
In actuality, this should be unnecessary and any place where it does
cause issues ought to be considered an actual bug. Also, having
these in the configuration actively causes older pip to have
problems with non-ASCII content in some package metadata files under
Python 3, so drop it now.

Change-Id: Ibd505447de74f13d90b9ff77dfd8c6b30c4c12cb
Closes-Bug: #1277495
Remove call to undefined install.post_process()

Oslo commit b5cca99e5281d9c0c5eda444137e418b31209c45 removed
the obsolete redhat-eventlet.patch.  Part of this commit
removed the post_process() method which we were still calling
in tools/install_venv.py .  The post_process function was just
there to do any distro-specific post processing.  By default,
that was nothing.  So, this is safe to remove.

This same change was made to python-novaclient with
commit 0194492059920fd8d9d91849c341b2de0b561089 .

Closes-bug: 1275025
Change-Id: I4c52e2c0d3d6553f5d33e94cd6e8622160febc37
Remove vim header

Making this change for python-cinderclient to be consistent
with Cinder.  The same change was made to Cinder via
commit ff3f2e5735f0d486b72b6881b05ace94d6d34d03 .

Partial-bug 1229324
Change-Id: I69fb960f499f0c9a9c9671d46d10170477cf6695
Require ctrl_location for encryption-type-create

This bug fix addresses bug #1267168, adding a default value to the
optional control_location parameter for the encryption-type-create
command. Prior to this fix, any invocation of encryption-type-create
that omitted the control_location parameter would fail. The failure
arose from the expectations of the cinder volume encryption type
API extension, which expects to always receive a value for the
control_location on encryption type creation.

control_location indicates which service will conduct the volume
encryption for the encryption-type under consideration; valid options
are 'front-end' (i.e., nova) and 'back-end' (i.e., cinder). The new
default value is 'front-end' and is used whenever control_location
is omitted from encryption-type-create invocation. For prior
discussion and information, see the abandoned patch below:

https://review.openstack.org/#/c/58303/

blueprint encrypt-cinder-volumes
https://blueprints.launchpad.net/nova/+spec/encrypt-cinder-volumes

Change-Id: I8db80929adbf5a3d818b9d3a8115067ae8e7d9e2
Closes-Bug: #1267168
DocImpact
Add auth_plugin support to cinderclient

With CINDER_RAX_AUTH being rightfully removed, cinderclient is no longer
compatible with Rackspace/any non-keystone auth. To fix this, I stole
auth_system/auth_plugin from novaclient's implementation.

See https://review.openstack.org/#/c/23820/.

Change-Id: If5f84003f868ef02bb7eb7da67cf62018602e8f0
Closes-Bug: 1280393
Wrong hint key in volume create function

Hint key has to be 'OS-SCH-HNT:scheduler_hints' not 'scheduler_hints'
and scheduler_hints key has to be located in same level with volume.

Change-Id: Ic5888545d4b7ee6bb58a22840928ef1fc86fedfa
Closes-Bug: #1276088
Updated from global requirements

Change-Id: Ibd5e12f7a33667d93e2fc99d79a11cff44c3b884
Set v2 commands available for v2 service_type

These commands originally were only available for v1, but this makes
them available for both v1 and v2 service_type.

Change-Id: I26e3f1997aebafa1eb784273c892397522dbbfe2
Closes-Bug: #1284321
Merge "Set v2 commands available for v2 service_type"
Fix typos in the volumes and snapshots docstrings

Change-Id: I0e4f3813b8e263ea59e182db153c5b4c6fd2a177
Fix type-delete to allow deletion by name and ID

This change addresses bug #1286314, fixing type deletion to allow
deletion by either volume type name or ID. The former implementation
only accepted the volume type ID. Help documentation is also updated
to reflect this change.

Change-Id: I0fc66b54a7bcfa4e00a4d136ac513fa40e628dd2
Closes-Bug: #1286314
DocImpact
Update doc string for service disable

It should be "Disable" but not "Enable" in doc string when disable
a service.

Change-Id: I658090d4e218222c76947c37f340fb2ab7d26ce3
Update service function name for service enable

When testing the function of enabling a service, the function name
should be test_service_enable.

Change-Id: I951c94315392834250183e0219b32804e5d2de66
Allow list_extensions to work in cinderclient v2

Cinder client extensions also requires explicity setting the
service_type that they are available for. This makes the only extension
for the client available to v2 as well.

Change-Id: I9a73cac31c70b248ac6070540554f9293e9a6e43
Closes-Bug: #1284321
Import access module from keystoneclient to handle V3 endpoints

* service_catalog.py will be used only by nova(cinder.py), it will be removed if nova
uses access instead of service_catalog. Then service_catalog.py and
test_service_catalog.py will be removed from cinderclient if necessary.

* Some unit tests are modified.

* Because of JSON format's modification, functions that process cinder
credentials and cinder endpoints are changed.

* Add dependency for keystoneclient in requirements.txt.

Change-Id: Icf7badfdddcf5f55536d95db7242aff58aa34b6e
Closes-Bug: #1263876
bp: service-catalog
When there is no error body return the HTTP reason

Return the response reason when there is no message body to return.

DocImpact
Change-Id: Ia60da4f04b059a13fcbe0059bb42fd77f272d8aa
Closes-Bug: 1248773
Client support for export and import backup service metadata

Add client code to a new admin API for backup-export and
backup-import allowing an admin to copy the backup metadata
details.

client code for https://review.openstack.org/#/c/69351/

blueprint cinder-backup-recover-api
DocImpact new admin API calls backup-import and backup-export

Change-Id: Id306fc9cf562a87bb6a36eae692852eefc592b74
replace assertTrue(isinstance) to assertIsInstance

some of tests use different method of assertTrue(isinstance(A, B))
or assertEqual(type(A), B). The correct way is to use
assertIsInstance(A, B) provided by testtools

Change-Id: Ic3eb7b27dc96b0ec7d786c092fc3a6a513af64f7
Closes-bug: #1268480