75 Commits

Author SHA1 Message Date
Jenkins
e217b6e6a8 Merge "Port netapp dataontap driver to Python 3" 2016-02-24 16:50:17 +00:00
Jenkins
72c4aae81c Merge "Port infortrend driver to Python 3" 2016-02-24 15:47:46 +00:00
Victor Stinner
228daeb878 Port netapp dataontap driver to Python 3
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
2016-02-24 14:16:00 +01:00
Jenkins
4d66ea1eec Merge "Port test_emc_vnx to Python 3" 2016-02-23 06:28:33 +00:00
Jenkins
58ad8d3e7e Merge "Port hgst driver to Python 3" 2016-02-22 01:52:47 +00:00
Jenkins
61985202dd Merge "Test middleware test_faults to Python 3" 2016-02-19 16:53:25 +00:00
Jenkins
1fb4d17f2f Merge "Fix last Python 3 issues in zonemanager" 2016-02-19 16:49:08 +00:00
Victor Stinner
39260d3894 Test middleware test_faults to Python 3
* 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
2016-02-18 13:09:18 +01:00
Jenkins
ab7ea8aae9 Merge "Port API v1 and v2 to Python 3" 2016-02-16 19:24:21 +00:00
Jenkins
56e9b48431 Merge "Port API contribs to Python 3" 2016-02-16 19:22:33 +00:00
Victor Stinner
071ee18240 Port infortrend driver to Python 3
* 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
2016-02-15 21:35:44 +01:00
Victor Stinner
5ab575367d Fix last Python 3 issues in zonemanager
* Replace auth_string.encode("base64", strict") with
  oslo_serialization.base64.encode_as_text(auth_string).
* tests-py3.txt: add cinder.tests.unit.zonemanager, add zonemanager
  unit tests now pass on Python 3

Partial-Implements: blueprint cinder-python3
Change-Id: I527637e182fc3b463bcf5657afbbd129149e7ecc
2016-02-15 18:30:26 +01:00
Victor Stinner
bfdcb23fa7 Port hgst driver to Python 3
* hgst: replace a/b with a//b to get integer on Python 3
* tests-py3.txt: add cinder.tests.unit.volume.drivers.test_hgst

Partial-Implements: blueprint cinder-python3
Change-Id: I5a5fcbc92101b8d928ac80c74698f6cc8f8723d2
2016-02-15 16:34:14 +01:00
Victor Stinner
30c0f79781 Port API v1 and v2 to Python 3
* 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
2016-02-15 15:22:05 +01:00
Victor Stinner
ebf00a5de5 Port API contribs to Python 3
* 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
2016-02-15 15:13:58 +01:00
Victor Stinner
f0ef5e50e4 Port test_emc_vnx to Python 3
* 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
2016-02-15 14:51:19 +01:00
Victor Stinner
fca244f117 Port backup drivers to Python 3
* 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
2016-02-09 11:52:42 +01:00
Victor Stinner
f3dc1a0c54 Port objects unit tests to Python 3
* 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
2016-02-08 10:47:53 +01:00
Ankit Agrawal
9cc2b79301 Python 3: Replace reduce and xrange with six.moves
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
2016-01-15 02:34:56 -08:00
Mikhail Khodos
999acbffce Re-add Nexenta drivers
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
2016-01-12 01:28:02 -08:00
Yusuke Hayashi
eae4cb9551 Add Fujitsu ETERNUS DX Volume Driver (again)
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
2015-12-30 08:59:16 +09:00
Jenkins
2f5fcf8f38 Merge "Add volume driver for Tegile IntelliFlash array" 2015-12-29 23:40:02 +00:00
Abhilash Divakaran
951a757ec0 Add volume driver for Tegile IntelliFlash array
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
2015-12-28 11:36:37 -08:00
Takeshi Nishikawa
b2a1b91071 Rebrand HP XP driver to now be HPE
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
2015-12-24 21:52:26 +09:00
Jenkins
e1ae777bdc Merge "Port zonemanager to Python 3" 2015-12-21 20:17:20 +00:00
Jenkins
6275557076 Merge "Python 3: fix a lot of tests" 2015-12-09 18:06:39 +00:00
Jenkins
ddad6a1a49 Merge "Volume driver for Coho Data storage solutions" 2015-12-09 02:40:50 +00:00
Cyril Roelandt
75c04831bc Python 3: fix a lot of tests
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
2015-12-07 15:34:20 +01:00
Bardia Keyoumarsi
f7e9c240dc Volume driver for Coho Data storage solutions
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>
2015-12-06 21:31:33 -08:00
Jenkins
65a6c40b6e Merge "Nexenta Edge iSCSI backend driver" 2015-11-26 17:01:35 +00:00
mikhail
ee352dcf03 Nexenta Edge iSCSI backend driver
Nexenta Edge project supports iSCSI block level storage.
This patch implements a driver for Nexenta Edge iSCSI backend.

DocImpact
Implements: blueprint nexentaedge-iscsi-volume-driver
Change-Id: I82c215ba85e9d49723e792d88d86553b3a75d3ac
2015-11-25 17:37:37 -06:00
Nicolas Trangez
49b05a999c Revert "Add Scality SRB driver"
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
2015-11-25 16:24:07 +01:00
Jenkins
40939aea76 Merge "Port xio driver to Python 3" 2015-11-25 13:41:27 +00:00
Victor Stinner
b2050e4a08 Port zonemanager to Python 3
* 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
2015-11-24 21:00:09 +01:00
Victor Stinner
52f62c31f7 Port key manager to Python 3
* Replace text.decode('hex') with binascii.unhexlify(text)
* test_barbican: base64 string is a bytes string
* tests-py3.txt: add keymgr tests

Partial-Implements: blueprint cinder-python3
Change-Id: Icc19fa354603857b259458b858e27c5bdd600360
2015-11-24 20:58:32 +01:00
Victor Stinner
ad821f2864 Port IBM storewize_svc driver to Python 3
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
2015-11-24 12:15:24 +01:00
Jenkins
00800f2f86 Merge "Port EMC VMAX to Python 3" 2015-11-23 14:07:04 +00:00
Jenkins
0747a64b6b Merge "Port EMC VNX CLI to Python 3" 2015-11-23 14:02:45 +00:00
Jenkins
6e872f2758 Merge "Refactor HP LeftHand driver to now be HPE" 2015-11-18 22:54:21 +00:00
Anthony Lee
091d4cc3fa Refactor HP LeftHand driver to now be HPE
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
2015-11-17 13:38:07 -08:00
Victor Stinner
3e002b57c3 Port HP 3PAR driver to Python 3
* 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
2015-11-16 09:58:21 +01:00
Victor Stinner
8e527c806b Port xio driver to Python 3
* 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
2015-11-13 16:38:20 +01:00
Jenkins
037dc38ef9 Merge "Port zfssa driver to Python 3" 2015-11-13 12:36:10 +00:00
Victor Stinner
3a5cf11156 Port EMC VMAX to Python 3
* Fix EMCVMAXMasking._get_storage_group_from_masking_view_instance():
  replace "if groups[0] > 0:" with "if len(groups):"
* tests-py3.txt: add cinder.tests.unit.test_emc_vmax

Partial-Implements: blueprint cinder-python3
Change-Id: I0f6be3cc0873efe683d39c4c70e19d0d0b79beb8
2015-11-13 10:23:15 +01:00
Victor Stinner
b12fb487b4 Port EMC VNX CLI to Python 3
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
2015-11-13 10:22:14 +01:00
Jenkins
3debb44d6b Merge "py3: Fix error handling in prophetstor driver" 2015-11-13 03:06:03 +00:00
Jenkins
536bc42564 Merge "Port vzstorage to Python 3" 2015-11-13 00:51:13 +00:00
Victor Stinner
2ff3f0be12 py3: Fix error handling in prophetstor driver
* 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
2015-11-12 23:54:28 +00:00
Jenkins
54db043ae9 Merge "Port cinder.utils.monkey_patch() to Python 3" 2015-11-09 04:19:42 +00:00
Jenkins
b04e6e9abc Merge "Port cinder.hacking to Python 3" 2015-11-09 00:22:40 +00:00