The Python 2 urllib and urllib2 modules changed a lot in Python 3. On
Python 3, the urllib functions are now grouped into submodules of
urllib: urllib.parse, urllib.error, etc. The urllib2 has been removed.
Replace urllib and urllib2 with six.moves.urllib to make the Cinder code
compatible with Python 2 and Python 3.
The new code now looks like Python 3 code (ex: "urllib.parse.urlsplit"),
but it also works on Python 2.
Replace also "import six.moves.urllib.parse as urlparse" with "from
six.moves import urllib" to uniformize the code:
"urlparse.urlsplit(href)" becomes "urllib.parse.urlsplit(href)".
This patch was generated by the urllib operation of the sixer tool version 0.4:
https://pypi.python.org/pypi/sixer
Manual changes:
* Add a try/except ImportError to get the parse_http_list function
in cinder/api/urlmap.py
* Import the socket module instead of using urllib2.socket
in cinder/volume/drivers/huawei/rest_common.py
* test_nimble.py: replace NIMBLE_URLLIB2 value with
'six.moves.urllib.request'
* Remove "from six.moves.urllib import parse as urlparse", it was
replaced with urllib.parse from six.moves.
* Reformat to respect the 80 columns constraint