With this change, all unit tests on volume drivers pass on Python 3.
Changes:
* Replace a/b with a//b to get an integer on Python 3.
* Replace map(...) and filter(...) with a list-comprehension to get a
list on Python 3.
* Replace dict.keys() with list(dict.keys()) to get a list
on Python 3.
* Replace (str, int, float, long) with
six.integer_types + (str, float): long type was removed
from Python 3.
* decode_base32_to_hex(): on Python 3, decode encode_hex_to_base32()
to return a Unicode string.
* convert_es_fmt_to_uuid(): encode/decode on Python 3 to pass the
right types to base64.b32decode() (bytes) and uuid.UUID()
(Unicode).
* fakes.py: Change type of XML document from Unicode to bytes: add
b prefix to literal strings (b'...').
* Replace range(a, b) with list(range(a, b)) to get a list
on Python 3.
* tests-py3.txt: add cinder.tests.unit.volume.drivers, all volume
drivers tests now pass on Python 3.
Partial-Implements: blueprint cinder-python3
Change-Id: Iee609f72bbbef3789fa5e970d209047a113d005c
* XMLDictSerializer: sort dictionary items to get a reliable XML
output. On Python 3, dictionary items are iterated in a random
order, because the hash function is randomized by default.
* Use byte strings for HTTP body
* On Python 3, decode serialized data to get Unicode
* Add a base TestCase class to factorize the _prepare_xml() method
* tests-py3.txt: add cinder.tests.unit.api.middleware.test_faults
Partial-Implements: blueprint cinder-python3
Change-Id: I81cd509230265f47f8c00ade14c71f66c717ca81
* InfortrendCommon: sort dictionary items to get a reliable
behaviour. On Python 3, the hash function is randomized by default.
- _get_minimun_mapping_channel_id(): sort LUN mapping by keys
- _do_fc_connection(): sort initiator_target_map keys
* InfortrendCommon._create_partition_with_pool(): cast gi_to_mi()
result to int. On Python 3, gi_to_mi() returns a float (a/b always
return a float, even for int/int).
* test_retype_with_migrate(): build create_params using a dictionary
to create parameter in the same order than the driver.
* tests-py3.txt: cinder.tests.unit.test_infortrend_common
Change-Id: Idd849a9cd5dc0ad17c5d8d54da489346c018e778
* Replace jsonutils.dumps() with jsonutils.dump_as_bytes() since
output is used for the HTTP body, and HTTP body type is bytes, not
Unicode. On Python 3, jsonutils.dumps() returns Unicode.
* FakeHttplibSocket: replace io.StringIO with io.BytesIO, HTTP body
type is bytes. Encode Unicode to UTF-8.
* Fix FakeHttplibSocket.makefile() API: only the first parameter is
mandatory. On Python 3, it's only called with the first 'mode'
parameter.
* Use bytes strings to test HTTP bodies (JSON or XML).
* Replace dict.values() with list(dict.values()) to get a list on
Python 3.
* Replace error.message with encodeutils.exception_to_unicode(error),
exceptions loose their message attribute in Python 3.
* Update JSON serializer test in test_wsgi.py to use bytes.
* tests-py3.txt: add cinder.tests.unit.api.v1 and
cinder.tests.unit.api.v2
Partial-Implements: blueprint cinder-python3
Change-Id: I0f0048f4a1344feaa3434cbf7ebd31e3f12d6ae4
* Replace dict.iteritems() with dict.items(), dict.iteritems() was
removed in Python 3.
* Replace dict.values() with list(dict.values()) to get a list on
Python 3.
* HTTP body type must be bytes:
- Fix unit tests to use bytes strings for HTTP body
- Encode XML to UTF-8 on Python 3.
* Use "%r" instead of "%s" to format request and response in test to
avoid BytesWarning on Python 3.
* tests-py3.txt: add cinder.tests.unit.api.contrib
Partial-Implements: blueprint cinder-python3
Change-Id: I65e412b2897635db5c8dfe13d61e71c52e0603e7
* Configuration.__getattr__(): replace self.local_conf with
object.__getattribute__(self, 'local_conf') to avoid reentrant call
to __getattr__() in copy.copy(conf) on Python 3.
* test_emc_vnx: Don't compare directly provider_location strings but
set of provider_location items to support hash randomization. On
Python 3, hash randomization is enabled by default and so
dictionary items are rendered in an random order.
* test_emc_vnx: use assertIn() to check if the provider_location
contains 'type^smp' substring. Before, the test failed if the
substring was a the beginning of the string (position 0).
* tests-py3.txt: add cinder.tests.unit.test_emc_vnx
Partial-Implements: blueprint cinder-python3
Related-Bug: 1348818
Change-Id: If3be17ca6a1d14d6f1a16ee9934221f77e161686
* PosixBackupDriver: open file in binary mode (to read/write).
Update test_backup_posix.py for that.
* test_backup_nfs: buffer() doesn't exist and is no more needed on
Python 3, only use buffer() on Python 2.
* tests-py3.txt: add cinder.tests.unit.backup
Partial-Implements: blueprint cinder-python3
Change-Id: I250d7378547df474f3c78024a737a3e2fa9bbaf4
* BaseObjectsTestCase._compare(): replace hasattr() with getattr()
and a white list of expected exceptions. On Python 2, hasattr()
ignores *all* exceptions and so may hide real bugs.
* Mocks: except a call to obj.__bool__() rather than
obj.__nonzero__() on Python 3. bool(obj) now calls obj.__bool__()
on Python 3.
* Replace dict.keys() with list(dict.keys()) to get a list on Python
3. On Python 3, dict.keys() now returns a view.
* JSON/base64:
* Replace jsonutils.dumps() with jsonutils.dump_as_bytes() to get
JSON as bytes
* Replace base64.encodestring() with oslo_serialization.base64.encode_as_text() to get
base64 as bytes
* Replace base64.decodestring() with
oslo_serialization.base64.decode_as_text() to accept Unicode and
return Unicode
* tests-py3.txt: add cinder.tests.unit.objects.test_* (11 files)
Partial-Implements: blueprint cinder-python3
Change-Id: I9ce7753eb947bf9a5c91e643f5c65156c8e3f7cc
1. Builtin function 'reduce' in Python 2 has been moved to standard
library module in Python 3 [1]. To make code compatible, replaced
reduce(expr) with six.moves.reduce(expr).
2. xrange is renamed to range in Python 3, replaced it with
six.moves.range
3. Added __bool__() method in FeatureState class to make it python 3
compatible because Python 3 calls the __bool__() method instead of
__nonzero__ when evaluating an instance in a boolean context.
4. Added this test case to tests-py3.txt.
[1] http://python3porting.com/stdlib.html#moved-builtins
Closes-Bug: 1530249
Change-Id: I376cd643b9f58358a3e147532dafe77a7325a114
Drivers were removed due to lack of CI.
Refactored iSCSI to use single target/tg with multiple zvols.
Migrated unit tests to use mock.
Added releasenotes.
DocImpact
Implements: blueprint nexentastor-4-cinder-drivers
Change-Id: I2ff4c79573322a9c0cd473a9d413e1fcdbe55ee0
This driver supports FUJITSU Storage ETERNUS DX.
The volume driver for ETERNUS DX dropped at Kilo,
because we could not prepare 3rd party CI until deadline (Kilo-3).
I upload it again for Mitaka release.
[Supported Protocol]
- iSCSI
[Supported Feature]
- Volume Create/Delete
- Volume Attach/Detach
- Snapshot Create/Delete
- Create Volume from Snapshot
- Get Volume Stats
- Copy Image to Volume,
- Copy Volume to Image
- Clone Volume
- Extend Volume
DocImpact
Change-Id: Iea6ed679616ccf4bd7aa0c5f6ad6067aa1bed7f6
Implements: blueprint fujitsu-eternus-dx-driver
The Tegile driver will support the iSCSI and FC protocols and it will
include the minimum set of features.
[Supported Protocol]
- iSCSI, FC
[Supported Feature]
- Volume Create/Delete
- Volume Attach/Detach
- Snapshot Create/Delete
- Create Volume from Snapshot
- Get Volume Stats
- Copy Image to Volume,
- Copy Volume to Image
- Clone Volume
- Extend Volume
Tegile has setup a CI. It will report as "Tegile Storage CI".
DocImpact
Implements: blueprint tegile-volume-driver
Change-Id: Ia0e6c320964f3955d6c7d4dcff4a0241a3960495
This patch refactors the HP XP driver to be HPE XP.
This is being done because the company responsible for
this driver is now Hewlett Packard Enterprise (HPE).
The driver is now located in the cinder/volume/drivers/hpe folder.
DocImpact
Implements: blueprint rebrand-hp-xp-driver
Change-Id: Ia16d39b9fec299662c97c236215a4e1aec44171a
As of this commit, the following tests should now be working with Python 3:
- cinder.tests.unit.api.contrib.test_cgsnapshots
- cinder.tests.unit.api.contrib.test_scheduler_hints
- cinder.tests.unit.api.contrib.test_snapshot_actions
- cinder.tests.unit.api.contrib.test_snapshot_manage
- cinder.tests.unit.api.contrib.test_snapshot_unmanage
- cinder.tests.unit.api.contrib.test_volume_encryption_metadata
- cinder.tests.unit.api.contrib.test_volume_host_attribute
- cinder.tests.unit.api.contrib.test_volume_manage
- cinder.tests.unit.api.contrib.test_volume_migration_status_attribute
- cinder.tests.unit.api.contrib.test_volume_tenant_attribute
- cinder.tests.unit.api.contrib.test_volume_unmanage
- cinder.tests.unit.api.v2.test_volumes
Most changes in this patch:
- make sure that Request.body is set to bytes;
- replace jsonutils.dumps with jsonutils.dump_as_bytes;
- replace json.loads with oslo_serialization.jsonutils.loads;
- replace dict.iteritems with dict.items.
Partial-Implements: blueprint cinder-python3
Change-Id: Icbb96ff84b7012b58f7296eea4fbcd620e081614
This patch introduces Coho Data volume driver along with unit tests.
Implements: blueprint coho-cinder-driver
DocImpact
Documentation for setting up the Coho driver and enabling it
in Cinder will be provided in a separate patch.
Change-Id: I06a66d10add9132d0f3afca054d68094ddfb4da0
Signed-off-by: Bardia Keyoumarsi <bardia.keyoumarsi@cohodata.com>
The Scality SRB kernel-driver is being re-designed to optimize for
specific workloads, which are (initially) not compatible with VM-style
block device access. Not to confuse users, we believe it's advisable to
remove the Cinder SRB driver in the meantime.
This reverts commit a23f17f8cebe5e1e57f675aedf6272257257d1b7.
Some references to the SRB driver and test modules added in later
commits are removed as well.
Conflicts:
cinder/tests/unit/test_srb.py
cinder/volume/drivers/srb.py
etc/cinder/rootwrap.d/volume.filters
See: 2f9e4163f42ae5246fd997b9f35e16d3d97be54f
See: 3fda737f53824170bd59eb6e8ce2e991c89c3c1d
Change-Id: Ic9d79b09363ef904932128f63371ba01a15c5d31
* Replace xrange() with six.moves.range()
* Replace filter() with list-comprehension to get a list on Python 3.
* get_formatted_wwn(): join byte strings with b':' instead of ':'
* ZoneManager: don't pass arguments to object.__new__()
* tests-py3.txt: add zonemanager tests
Partial-Implements: blueprint cinder-python3
Change-Id: Ia3fcd816c5afd7a08b8769fbc9d2839b70c8c3fb
Change default preferred node in
StorwizeSVCDriver.initialize_connection(). For fiber channel without
multipath, pick the first node from the list of sorted nodes, to have
a determinist preferred node. The list of nodes is created indirectly
using list(set(nodes)) which doesn't have a determinist order. On
Python 3, the hash function is randomized, and so list(set()) has an
unknown order.
A similar change was done for volume throttling in the change
Icf7141f772397c7ac08f0f1e21ad74cb86a06351 to port the code
to Python 3.
Other changes:
* Use assertSetEqual() in test_storwize_svc to compare
initiator_target_map, because conn_wwpns has a random order on
Python 3.
* StorwizeSVCDriver._check_volume_copy_ops(): replace dict.items()
with list(dict.items()) to iterate on items. On Python 3,
dict.items() now returns a view instead of a copy. The loop
modifies the dictionary and a dict must not be modified while
iterating on it, we really need a copy of items.
* StorwizeHelpers: replace a/b with a//b to use integer division on
Python 3.
* tests-py3.txt: add cinder.tests.unit.test_storwize_svc
Partial-Implements: blueprint cinder-python3
Change-Id: I534a85928816d6cce921545e1820311aedd1b884
This patch refactors the HP LeftHand driver to be
HPE LeftHand.
This is being done because the company responsible for
this driver is now Hewlett Packard Enterprise (HPE).
The driver is now located in the cinder/volume/drivers/hpe
folder.
DocImpact
Implements: blueprint rebrand-hp-lefthand-driver
Change-Id: I42eb5b3a51d547e45338a4964f31e0aca2ce43d8
* Use oslo_serialization.base64.encode_as_text() to get Unicode on
Python 3.
* Replace sys.maxint with sys.maxsize, sys.maxint was removed in
Python 3.
* test_hpe3par: use list(set()) to get FCWWNs is the right order. On
Python 3, the hash function is randomized by default.
* test_hpe3par: fix client getWsApiVersion() to return a valid
version. Before, the comparison between mock.Mock and int raised a
TypeError.
* hpe_3par_common: set version to 3.0.2
* hpe_3par_iscsi: set version to 3.0.1
* tox.ini: add test_hpe3par to Python 3.4
Partial-Implements: blueprint cinder-python3
Change-Id: I2bed171c0db93b8ea83127a69a63c3bb2317b10b
* Replace base64.encodestring() with
oslo_serialization.base64.encode_as_text() to get Unicode
on Python 3.
* Replace string.upper(text) with text.upper()
* Replace string.replace(text, a, b) with text.replace(a, b)
* tox.ini: add test_xio to Python 3.4
Partial-Implements: blueprint cinder-python3
Change-Id: I75a5dee2fd1f8cf45dbf416b0353736a43efd8e8
CreateConsistencyGroupTask, WaitMigrationsCompleteTask: sort the lun
identifier keys to have a determinist order. On Python 3, the hash
function is randomized, so set() order is undefined and changes at
each run.
Other changes:
* Replace map() with list-comprehension to get a list on Python 3.
* Replace assertTrue(str.find(pattern) > 0) with
assertIn(pattern, str) to not fail if pattern is at the beginning
on the string. On Python 3, the hash function is randomized and so
parts of the provider_location are in a random order, it can be at
the beginning.
* tests-py3.txt: add cinder.tests.unit.test_emc_vnxdirect
Partial-Implements: blueprint cinder-python3
Change-Id: I114029c1c9862583e64781379001870a682ea42d
* Port prophetstor driver to Python 3
* Replace "except exception as e:" with "except Exception as e:"
to handle "Fexvisor failed to join the volume ..." and "Fexvisor
failed to remove the volume ..." errors. Here, lower case
"exception" is the cinder.exception module, not an exception class.
On Python 3, "except" requires exception classes.
* tests-py3.txt: add cinder.tests.unit.test_prophetstor_dpl
Partial-Implements: blueprint cinder-python3
Change-Id: I0447b62cc0afe5a10ecbc888dfb6608b69f977d2