Remove six from ibm_storage drivers

Change-Id: Ib6fe714248d3ff1cd50303ab04cb1f6d0ef8ce6c
This commit is contained in:
Eric Harney
2023-03-30 12:54:55 -04:00
parent 592e31d232
commit ab81fb4c8a
14 changed files with 174 additions and 195 deletions

View File

@@ -21,7 +21,6 @@ from unittest import mock
import ddt
import eventlet
import six
from cinder import context
from cinder import exception
@@ -1459,7 +1458,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
self._create_volume(group_id=group.id,
provider_location=location)
volume = self._create_volume(group_id=group.id)
@@ -1490,7 +1489,7 @@ class DS8KProxyTest(test.TestCase):
)
group2 = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type2.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
self._create_volume(group_id=group2.id,
provider_location=location)
lun = ds8kproxy.Lun(volume)
@@ -1521,7 +1520,7 @@ class DS8KProxyTest(test.TestCase):
group2 = self._create_group(status='error',
host=TEST_GROUP_HOST,
group_type_id=group_type2.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
self._create_volume(group_id=group2.id,
provider_location=location)
lun = ds8kproxy.Lun(volume)
@@ -1958,7 +1957,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
self.driver.delete_volume(volume)
@@ -1985,7 +1984,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
mock_lun_exists.return_value = False
@@ -2004,7 +2003,7 @@ class DS8KProxyTest(test.TestCase):
extra_spec = {'replication_enabled': '<is> True'}
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', extra_spec)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2020,10 +2019,10 @@ class DS8KProxyTest(test.TestCase):
self.driver = FakeDS8KProxy(self.storage_info, self.logger,
self.exception, self)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': None})
location = str({'vol_hex_id': None})
metadata = [{'key': 'async_clone', 'value': True}]
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2041,10 +2040,10 @@ class DS8KProxyTest(test.TestCase):
def test_check_async_cloned_volumes_when_initialize_driver(self):
"""initialize driver should check volumes cloned asynchronously."""
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID_2})
location = str({'vol_hex_id': TEST_VOLUME_ID_2})
metadata = [{'key': 'flashcopy', 'value': 'started'}]
self._create_volume(volume_type_id=vol_type.id,
source_volid=src_vol.id,
@@ -2063,10 +2062,10 @@ class DS8KProxyTest(test.TestCase):
self.driver = FakeDS8KProxy(self.storage_info, self.logger,
self.exception, self)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID_2})
location = str({'vol_hex_id': TEST_VOLUME_ID_2})
metadata = [{'key': 'async_clone', 'value': True}]
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2090,10 +2089,10 @@ class DS8KProxyTest(test.TestCase):
self.driver = FakeDS8KProxy(self.storage_info, self.logger,
self.exception, self)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID_2})
location = str({'vol_hex_id': TEST_VOLUME_ID_2})
metadata = [{'key': 'async_clone', 'value': True}]
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2114,10 +2113,10 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': None})
location = str({'vol_hex_id': None})
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2138,10 +2137,10 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': None})
location = str({'vol_hex_id': None})
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
size=2)
@@ -2157,11 +2156,11 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
size=2)
location = six.text_type({'vol_hex_id': None})
location = str({'vol_hex_id': None})
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
self.assertRaises(exception.VolumeDriverException,
@@ -2175,10 +2174,10 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': None})
location = str({'vol_hex_id': None})
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2200,10 +2199,10 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
src_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
location = six.text_type({'vol_hex_id': '0003'})
location = str({'vol_hex_id': '0003'})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
tgt_vol = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2224,7 +2223,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
volume = self._create_volume(volume_type_id=vol_type.id)
location = six.text_type({'vol_hex_id': '0002'})
location = str({'vol_hex_id': '0002'})
snap = self._create_snapshot(volume_id=volume.id,
volume_type_id=vol_type.id,
provider_location=location)
@@ -2243,7 +2242,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
self.driver.extend_volume(volume, 2)
@@ -2258,7 +2257,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2275,7 +2274,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2293,7 +2292,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': '0002'})
location = str({'vol_hex_id': '0002'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)
@@ -2320,7 +2319,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'drivers:thin_provision': 'False'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2346,7 +2345,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'drivers:thin_provision': 'True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2374,7 +2373,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> False'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -2406,7 +2405,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -2440,7 +2439,7 @@ class DS8KProxyTest(test.TestCase):
}
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2471,7 +2470,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2505,7 +2504,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2540,7 +2539,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'drivers:thin_provision': 'False'})
location = six.text_type({'vol_hex_id': '0400'})
location = str({'vol_hex_id': '0400'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2576,7 +2575,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': '0400'})
location = str({'vol_hex_id': '0400'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2607,7 +2606,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {
'drivers:storage_pool_ids': TEST_POOL_ID_1,
'drivers:storage_lss_ids': TEST_LSS_ID_1})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2632,7 +2631,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'multiattach': '<is> False'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2659,7 +2658,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'multiattach': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location,
@@ -2689,7 +2688,7 @@ class DS8KProxyTest(test.TestCase):
}
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2720,7 +2719,7 @@ class DS8KProxyTest(test.TestCase):
host = None
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'multiattach': '<is> False'})
location = six.text_type({'vol_hex_id': '0400'})
location = str({'vol_hex_id': '0400'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2741,7 +2740,7 @@ class DS8KProxyTest(test.TestCase):
self.driver._update_stats()
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -2767,7 +2766,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
self.driver._update_stats()
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2794,7 +2793,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
self.driver._update_stats()
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2822,7 +2821,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2843,7 +2842,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_ECKD_VOLUME_ID})
location = str({'vol_hex_id': TEST_ECKD_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2860,7 +2859,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2885,7 +2884,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2916,7 +2915,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2933,7 +2932,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_ECKD_VOLUME_ID})
location = str({'vol_hex_id': TEST_ECKD_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
unmap_data = self.driver.terminate_connection(volume, {})
@@ -2947,7 +2946,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -2980,7 +2979,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -3005,7 +3004,7 @@ class DS8KProxyTest(test.TestCase):
self.exception, self)
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
@@ -3050,7 +3049,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3125,7 +3124,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='failed-over')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3286,7 +3285,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(provider_location=location,
group_id=group.id)
model_update, volumes_model_update = (
@@ -3308,7 +3307,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(provider_location=location,
group_id=group.id)
mock_delete_lun.side_effect = (
@@ -3335,7 +3334,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3357,7 +3356,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(provider_location=location,
status='in-use')
self.assertRaises(exception.VolumeDriverException,
@@ -3375,7 +3374,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(provider_location=location,
status='in-use',
group_id=group.id)
@@ -3399,7 +3398,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3419,7 +3418,7 @@ class DS8KProxyTest(test.TestCase):
group_type = group_types.create(self.ctxt, 'group', {})
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(provider_location=location)
self.assertRaises(NotImplementedError,
self.driver.update_group,
@@ -3446,7 +3445,7 @@ class DS8KProxyTest(test.TestCase):
)
group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
volume = self._create_volume(provider_location=location,
volume_metadata=metadata)
@@ -3484,7 +3483,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(
self.ctxt, 'VOL_TYPE', {'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3508,7 +3507,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
group_type = group_types.create(self.ctxt, 'group', {})
group = self._create_group(group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
volume = self._create_volume(group_type_id=group_type.id,
provider_location=location,
group_id=group.id)
@@ -3532,7 +3531,7 @@ class DS8KProxyTest(test.TestCase):
{'consistent_group_snapshot_enabled': '<is> True'}
)
group = self._create_group(group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
volume = self._create_volume(provider_location=location,
group_id=group.id)
group_snapshot = (
@@ -3567,7 +3566,7 @@ class DS8KProxyTest(test.TestCase):
{'consistent_group_snapshot_enabled': '<is> True'}
)
group = self._create_group(group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
volume = self._create_volume(provider_location=location,
group_id=group.id)
group_snapshot = (
@@ -3597,7 +3596,7 @@ class DS8KProxyTest(test.TestCase):
{'consistent_group_snapshot_enabled': '<is> True'}
)
group = self._create_group(group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
volume = self._create_volume(provider_location=location,
group_id=group.id)
group_snapshot = (
@@ -3627,7 +3626,7 @@ class DS8KProxyTest(test.TestCase):
{'consistent_group_snapshot_enabled': '<is> True'}
)
group = self._create_group(group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
volume = self._create_volume(provider_location=location,
group_id=group.id)
group_snapshot = (
@@ -3663,7 +3662,7 @@ class DS8KProxyTest(test.TestCase):
)
src_group = self._create_group(host=TEST_GROUP_HOST,
group_type_id=group_type.id)
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
src_vol = self._create_volume(provider_location=location,
group_id=src_group.id)
group = self._create_group(host=TEST_GROUP_HOST,
@@ -3700,7 +3699,7 @@ class DS8KProxyTest(test.TestCase):
group_snapshot = (
self._create_group_snapshot(group_id=src_group.id,
group_type_id=group_type.id))
location = six.text_type({'vol_hex_id': '2000'})
location = str({'vol_hex_id': '2000'})
snapshot = self._create_snapshot(volume_id=src_vol.id,
provider_location=location,
group_snapshot_id=group_snapshot.id)
@@ -3737,7 +3736,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
src_volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3766,7 +3765,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3800,7 +3799,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='enabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3845,7 +3844,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='failed-over')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3874,7 +3873,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3898,7 +3897,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3917,7 +3916,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3937,7 +3936,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -3959,7 +3958,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -3987,7 +3986,7 @@ class DS8KProxyTest(test.TestCase):
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -4017,7 +4016,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='disabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4057,7 +4056,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='disabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4094,7 +4093,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='disabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4131,7 +4130,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='enabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4171,7 +4170,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='enabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4208,7 +4207,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='enabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4246,7 +4245,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4285,7 +4284,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4317,7 +4316,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -4345,7 +4344,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='failed-over')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -4375,7 +4374,7 @@ class DS8KProxyTest(test.TestCase):
replication_status='enabled')
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
volume = self._create_volume(volume_type_id=vol_type.id,
@@ -4409,7 +4408,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
data = json.dumps(
{TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
@@ -4444,7 +4443,7 @@ class DS8KProxyTest(test.TestCase):
group_type_id=group_type.id)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE',
{'replication_enabled': '<is> True'})
location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
location = str({'vol_hex_id': TEST_VOLUME_ID})
metadata = [{'key': 'data_type', 'value': 'FB 512'}]
data = json.dumps(
{'default': {'vol_hex_id': TEST_VOLUME_ID_2}})
@@ -4487,7 +4486,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
location = six.text_type({'vol_hex_id': '0002'})
location = str({'vol_hex_id': '0002'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)
@@ -4523,7 +4522,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = testutils.create_volume_type(self.ctxt, name='VOL_TYPE')
location = six.text_type({'vol_hex_id': '0002'})
location = str({'vol_hex_id': '0002'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)
@@ -4545,7 +4544,7 @@ class DS8KProxyTest(test.TestCase):
extra_specs = {'replication_enabled': '<is> True'}
vol_type = testutils.create_volume_type(self.ctxt, name='VOL_TYPE',
extra_specs=extra_specs)
location = six.text_type({'vol_hex_id': '0002'})
location = str({'vol_hex_id': '0002'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)
@@ -4565,7 +4564,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = testutils.create_volume_type(self.ctxt, name='VOL_TYPE')
location = six.text_type({'vol_hex_id': 'fake_volume_id_2'})
location = str({'vol_hex_id': 'fake_volume_id_2'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)
@@ -4585,7 +4584,7 @@ class DS8KProxyTest(test.TestCase):
self.driver.setup(self.ctxt)
vol_type = testutils.create_volume_type(self.ctxt, name='VOL_TYPE')
location = six.text_type({'vol_hex_id': 'fake_volume_id_2'})
location = str({'vol_hex_id': 'fake_volume_id_2'})
volume = self._create_volume(volume_type_id=vol_type.id,
provider_location=location)
snapshot = self._create_snapshot(volume_id=volume.id)

View File

@@ -23,7 +23,6 @@ from unittest import mock
from oslo_concurrency import processutils
from oslo_utils import units
import six
from cinder import context
from cinder import exception
@@ -69,8 +68,8 @@ class FlashSystemManagementSimulator(object):
ids.sort()
for index, n in enumerate(ids):
if n > index:
return six.text_type(index)
return six.text_type(len(ids))
return str(index)
return str(len(ids))
@staticmethod
def _is_invalid_name(name):
@@ -99,7 +98,7 @@ class FlashSystemManagementSimulator(object):
# All commands should begin with svcinfo or svctask
if arg_list[0] not in ('svcinfo', 'svctask') or len(arg_list) < 2:
raise exception.InvalidInput(reason=six.text_type(arg_list))
raise exception.InvalidInput(reason=str(arg_list))
ret = {'cmd': arg_list[1]}
skip = False
@@ -139,7 +138,7 @@ class FlashSystemManagementSimulator(object):
num = num * 1024
unit_index += 1
return six.text_type(num)
return str(num)
def _cmd_lshost(self, **kwargs):
"""lshost command.
@@ -451,7 +450,7 @@ class FlashSystemManagementSimulator(object):
curr_size = int(self._volumes_list[vol_name]['capacity'])
addition = size * units.Gi
self._volumes_list[vol_name]['capacity'] = six.text_type(
self._volumes_list[vol_name]['capacity'] = str(
curr_size + addition)
return ('', '')
@@ -710,7 +709,7 @@ class FlashSystemDriverTestCase(test.TestCase):
vol_name,
vol_size=10,
vol_status='available'):
rand_id = six.text_type(random.randint(10000, 99999))
rand_id = str(random.randint(10000, 99999))
if not vol_name:
vol_name = 'test_volume%s' % rand_id
@@ -727,7 +726,7 @@ class FlashSystemDriverTestCase(test.TestCase):
vol_size,
vol_status,
snap_status='available'):
rand_id = six.text_type(random.randint(10000, 99999))
rand_id = str(random.randint(10000, 99999))
return {'name': 'test_snap_%s' % rand_id,
'id': rand_id,
'volume': {'name': vol_name,

View File

@@ -19,8 +19,6 @@
import random
from unittest import mock
import six
from cinder import context
from cinder import exception
from cinder.tests.unit import test
@@ -80,7 +78,7 @@ class FlashSystemISCSIDriverTestCase(test.TestCase):
vol_name,
vol_size=10,
vol_status='available'):
rand_id = six.text_type(random.randint(10000, 99999))
rand_id = str(random.randint(10000, 99999))
if not vol_name:
vol_name = 'test_volume%s' % rand_id
@@ -97,7 +95,7 @@ class FlashSystemISCSIDriverTestCase(test.TestCase):
vol_size,
vol_status,
snap_status='available'):
rand_id = six.text_type(random.randint(10000, 99999))
rand_id = str(random.randint(10000, 99999))
return {'name': 'test_snap_%s' % rand_id,
'id': rand_id,
'volume': {'name': vol_name,

View File

@@ -16,8 +16,6 @@
from unittest import mock
from xml.etree import ElementTree
import six
from cinder import context
from cinder import exception
from cinder import objects
@@ -1494,7 +1492,7 @@ class XIVProxyTest(test.TestCase):
p.ibm_storage_cli = mock.MagicMock()
p.ibm_storage_cli.cmd.fc_port_list.return_value = FC_PORT_LIST_OUTPUT
fc_targets = p._get_fc_targets(None)
six.assertCountEqual(self, FC_TARGETS_OPTIMIZED, fc_targets)
self.assertCountEqual(FC_TARGETS_OPTIMIZED, fc_targets)
def test_get_fc_targets_returns_host_optimized_wwpns_list(self):
driver = mock.MagicMock()
@@ -1513,9 +1511,8 @@ class XIVProxyTest(test.TestCase):
p.ibm_storage_cli.cmd.host_connectivity_list.return_value = (
HOST_CONNECTIVITY_LIST)
fc_targets = p._get_fc_targets(host)
six.assertCountEqual(self,
FC_TARGETS_OPTIMIZED_WITH_HOST, fc_targets,
"FC targets are different from the expected")
self.assertCountEqual(FC_TARGETS_OPTIMIZED_WITH_HOST, fc_targets,
"FC targets are different from the expected")
def test_get_fc_targets_returns_host_all_wwpns_list(self):
driver = mock.MagicMock()
@@ -1534,9 +1531,8 @@ class XIVProxyTest(test.TestCase):
p.ibm_storage_cli.cmd.host_connectivity_list.return_value = (
HOST_CONNECTIVITY_LIST_UNKNOWN_HOST)
fc_targets = p._get_fc_targets(host)
six.assertCountEqual(self,
FC_TARGETS_OPTIMIZED, fc_targets,
"FC targets are different from the expected")
self.assertCountEqual(FC_TARGETS_OPTIMIZED, fc_targets,
"FC targets are different from the expected")
def test_define_fc_returns_all_wwpns_list(self):
driver = mock.MagicMock()
@@ -1552,9 +1548,8 @@ class XIVProxyTest(test.TestCase):
p.ibm_storage_cli.cmd.fc_port_list.return_value = FC_PORT_LIST_OUTPUT
p.ibm_storage_cli.fc_connectivity_list.return_value = ()
fc_targets = p._define_fc(p._define_host(TEST_CONNECTOR))
six.assertCountEqual(self,
FC_TARGETS_OPTIMIZED, fc_targets,
"FC targets are different from the expected")
self.assertCountEqual(FC_TARGETS_OPTIMIZED, fc_targets,
"FC targets are different from the expected")
def test_define_ports_returns_sorted_wwpns_list(self):
driver = mock.MagicMock()

View File

@@ -31,7 +31,6 @@ from oslo_service import loopingcall
from oslo_utils import excutils
from oslo_utils import strutils
from oslo_utils import units
import six
from cinder import context
from cinder import exception
@@ -146,8 +145,8 @@ class FlashSystemDriver(san.SanDriver,
'Command: %(cmd)s\n stdout: %(out)s\n '
'stderr: %(err)s')
% {'fun': fun, 'cmd': ssh_cmd,
'out': six.text_type(out),
'err': six.text_type(err)}))
'out': str(out),
'err': str(err)}))
def _build_default_params(self):
return {'protocol': self.configuration.flashsystem_connection_protocol}
@@ -155,7 +154,7 @@ class FlashSystemDriver(san.SanDriver,
def _build_initiator_target_map(self, initiator_wwpns, target_wwpns):
map = {}
for i_wwpn in initiator_wwpns:
idx = six.text_type(i_wwpn)
idx = str(i_wwpn)
map[idx] = []
for t_wwpn in target_wwpns:
map[idx].append(t_wwpn)
@@ -178,13 +177,13 @@ class FlashSystemDriver(san.SanDriver,
# Build cleanup translation tables for host names
invalid_ch_in_host = ''
for num in range(0, 128):
ch = six.text_type(chr(num))
ch = str(chr(num))
if not ch.isalnum() and ch not in [' ', '.', '-', '_']:
invalid_ch_in_host = invalid_ch_in_host + ch
host_name = connector['host']
if isinstance(host_name, six.text_type):
unicode_host_name_filter = {ord(six.text_type(char)): u'-'
if isinstance(host_name, str):
unicode_host_name_filter = {ord(str(char)): u'-'
for char in invalid_ch_in_host}
host_name = host_name.translate(unicode_host_name_filter)
elif isinstance(host_name, str):
@@ -197,7 +196,7 @@ class FlashSystemDriver(san.SanDriver,
LOG.error(msg)
raise exception.NoValidBackend(reason=msg)
host_name = six.text_type(host_name)
host_name = str(host_name)
# FlashSystem family doesn't like hostname that starts with number.
if not re.match('^[A-Za-z]', host_name):
@@ -309,8 +308,8 @@ class FlashSystemDriver(san.SanDriver,
ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',
FLASHSYSTEM_VOLPOOL_NAME, '-iogrp',
six.text_type(FLASHSYSTEM_VOL_IOGRP),
'-size', six.text_type(size), '-unit', unit]
str(FLASHSYSTEM_VOL_IOGRP),
'-size', str(size), '-unit', unit]
out, err = self._ssh(ssh_cmd)
self._assert_ssh_return(out.strip(), '_create_vdisk',
ssh_cmd, out, err)
@@ -324,8 +323,8 @@ class FlashSystemDriver(san.SanDriver,
(_('_create_vdisk %(name)s - did not find '
'success message in CLI output.\n '
'stdout: %(out)s\n stderr: %(err)s')
% {'name': name, 'out': six.text_type(out),
'err': six.text_type(err)}))
% {'name': name, 'out': str(out),
'err': str(err)}))
LOG.debug('leave: _create_vdisk: vdisk %s.', name)
@@ -383,7 +382,7 @@ class FlashSystemDriver(san.SanDriver,
LOG.debug(
'enter: _execute_command_and_parse_attributes: '
'command: %s.', six.text_type(ssh_cmd))
'command: %s.', str(ssh_cmd))
try:
out, err = self._ssh(ssh_cmd)
@@ -407,8 +406,8 @@ class FlashSystemDriver(san.SanDriver,
LOG.debug(
'leave: _execute_command_and_parse_attributes: '
'command: %(cmd)s attributes: %(attr)s.',
{'cmd': six.text_type(ssh_cmd),
'attr': six.text_type(attributes)})
{'cmd': str(ssh_cmd),
'attr': str(attributes)})
return attributes
@@ -427,7 +426,7 @@ class FlashSystemDriver(san.SanDriver,
len(values) == len(attributes),
(_('_get_hdr_dic: attribute headers and values do not match.\n '
'Headers: %(header)s\n Values: %(row)s.')
% {'header': six.text_type(header), 'row': six.text_type(row)}))
% {'header': str(header), 'row': str(row)}))
dic = {a: v for a, v in zip(attributes, values)}
return dic
@@ -657,7 +656,7 @@ class FlashSystemDriver(san.SanDriver,
'_is_vdisk_copy_in_progress: %(vdisk)s: %(vdisk_in_progress)s.',
{'vdisk': vdisk_name,
'vdisk_in_progress':
six.text_type(self._vdisk_copy_in_progress)})
str(self._vdisk_copy_in_progress)})
if vdisk_name not in self._vdisk_copy_in_progress:
LOG.debug(
'_is_vdisk_copy_in_progress: '
@@ -702,7 +701,7 @@ class FlashSystemDriver(san.SanDriver,
'leave: _is_vdisk_map: %(src)s '
'mapped %(map_flag)s %(result_lun)s.',
{'src': vdisk_name,
'map_flag': six.text_type(map_flag),
'map_flag': str(map_flag),
'result_lun': result_lun})
return (map_flag, int(result_lun))
@@ -712,8 +711,8 @@ class FlashSystemDriver(san.SanDriver,
'Command: %(cmd)s\nstdout: %(out)s\nstderr: %(err)s\n',
{'fun': function,
'cmd': cmd,
'out': six.text_type(out),
'err': six.text_type(err)})
'out': str(out),
'err': str(err)})
def _manage_input_check(self, existing_ref):
"""Verify the input of manage function."""
@@ -781,7 +780,7 @@ class FlashSystemDriver(san.SanDriver,
# Volume is not mapped to host, create a new LUN
if not map_flag:
ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', host_name,
'-scsi', six.text_type(result_lun), vdisk_name]
'-scsi', str(result_lun), vdisk_name]
out, err = self._ssh(ssh_cmd, check_exit_code=False)
map_error = self._cli_except('_map_vdisk_to_host',
ssh_cmd,
@@ -999,9 +998,9 @@ class FlashSystemDriver(san.SanDriver,
def _set_vdisk_copy_in_progress(self, vdisk_list):
LOG.debug(
'_set_vdisk_copy_in_progress: %(vdisk)s: %(vdisk_in_progress)s.',
{'vdisk': six.text_type(vdisk_list),
{'vdisk': str(vdisk_list),
'vdisk_in_progress':
six.text_type(self._vdisk_copy_in_progress)})
str(self._vdisk_copy_in_progress)})
get_lock = True
self._vdisk_copy_lock.acquire()
for vdisk in vdisk_list:
@@ -1014,15 +1013,15 @@ class FlashSystemDriver(san.SanDriver,
if get_lock:
LOG.debug(
'_set_vdisk_copy_in_progress: %s.',
six.text_type(self._vdisk_copy_in_progress))
str(self._vdisk_copy_in_progress))
raise loopingcall.LoopingCallDone(retvalue=True)
def _unset_vdisk_copy_in_progress(self, vdisk_list):
LOG.debug(
'_unset_vdisk_copy_in_progress: %(vdisk)s: %(vdisk_in_progress)s.',
{'vdisk': six.text_type(vdisk_list),
{'vdisk': str(vdisk_list),
'vdisk_in_progress':
six.text_type(self._vdisk_copy_in_progress)})
str(self._vdisk_copy_in_progress)})
self._vdisk_copy_lock.acquire()
for vdisk in vdisk_list:
if vdisk in self._vdisk_copy_in_progress:
@@ -1070,7 +1069,7 @@ class FlashSystemDriver(san.SanDriver,
"""Create volume."""
vdisk_name = volume['name']
vdisk_params = self._get_vdisk_params(volume['volume_type_id'])
vdisk_size = six.text_type(volume['size'])
vdisk_size = str(volume['size'])
return self._create_vdisk(vdisk_name, vdisk_size, 'gb', vdisk_params)
def delete_volume(self, volume):
@@ -1088,7 +1087,7 @@ class FlashSystemDriver(san.SanDriver,
extend_amt = int(new_size) - volume['size']
ssh_cmd = (['svctask', 'expandvdisksize', '-size',
six.text_type(extend_amt), '-unit', 'gb', vdisk_name])
str(extend_amt), '-unit', 'gb', vdisk_name])
out, err = self._ssh(ssh_cmd)
# No output should be returned from expandvdisksize
self._assert_ssh_return(

View File

@@ -28,7 +28,6 @@ import threading
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder import exception
from cinder.i18n import _
@@ -101,7 +100,7 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
LOG.debug('enter: _create_host: host %s.', connector['host'])
rand_id = six.text_type(random.randint(0, 99999999)).zfill(8)
rand_id = str(random.randint(0, 99999999)).zfill(8)
host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),
rand_id)

View File

@@ -29,7 +29,6 @@ import threading
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder import exception
from cinder.i18n import _
@@ -119,7 +118,7 @@ class FlashSystemISCSIDriver(fscommon.FlashSystemDriver):
LOG.debug('enter: _create_host: host %s.', connector['host'])
rand_id = six.text_type(random.randint(0, 99999999)).zfill(8)
rand_id = str(random.randint(0, 99999999)).zfill(8)
host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),
rand_id)
@@ -344,8 +343,7 @@ class FlashSystemISCSIDriver(fscommon.FlashSystemDriver):
self._handle_keyerror('lsportip', header)
if port_ipv4 == self.configuration.target_ip_address and (
port_data['id'] == (
six.text_type(
self.configuration.flashsystem_iscsi_portid))):
str(self.configuration.flashsystem_iscsi_portid))):
if state not in ('configured', 'online'):
msg = (_('State of node is wrong. Current state is %s.')
% state)

View File

@@ -22,7 +22,6 @@ import string
import eventlet
from oslo_log import log as logging
import packaging.version as dist_version # pylint: disable=E0611
import six
from cinder import coordination
from cinder import exception
@@ -187,7 +186,7 @@ class DS8KCommonHelper(object):
err=_('Param [lss_range_for_cg] is invalid, it '
'only supports space and \'-\' as '
'separator. '
'Exception = %s.') % six.text_type(e))
'Exception = %s.') % str(e))
else:
lss_ids.append(lss)
lss_ids_for_cg |= set(lss_ids)
@@ -203,7 +202,7 @@ class DS8KCommonHelper(object):
raise exception.InvalidParameterValue(
err=_('Param [lss_range_for_cg] is invalid, it '
'only supports space and \'-\' as separator. '
'Exception = %s.') % six.text_type(e))
'Exception = %s.') % str(e))
return lss_ids_for_cg
def _check_host_type(self):
@@ -287,7 +286,7 @@ class DS8KCommonHelper(object):
except restclient.APIException as e:
LOG.warning("Failed to get pool %(id)s information, "
"Exception: %(ex)s.", {'id': pid,
'ex': six.text_type(e)})
'ex': str(e)})
if len(pools):
unsorted_pools = self._format_pools(pools)
storage_pools = collections.OrderedDict(sorted(
@@ -1177,7 +1176,7 @@ class DS8KECKDHelper(DS8KCommonHelper):
raise exception.VolumeDriverException(
message=(_('Can not create lcu %(lcu)s, '
'Exception = %(e)s.')
% {'lcu': lcu, 'e': six.text_type(e)}))
% {'lcu': lcu, 'e': str(e)}))
return lcu_ids
def _format_pools(self, pools):
@@ -1210,7 +1209,7 @@ class DS8KECKDHelper(DS8KCommonHelper):
existing_lcu = [lcu for lcu in all_lss if
lcu['type'] == 'ckd' and
lcu['id'] in self.backend['device_mapping'].keys() and
lcu['group'] == six.text_type(node)]
lcu['group'] == str(node)]
LOG.info("All appropriate LCUs are %s.",
','.join([lcu['id'] for lcu in existing_lcu]))

View File

@@ -65,7 +65,6 @@ import json
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
import six
from cinder import context
from cinder import coordination
@@ -124,7 +123,7 @@ ds8k_opts = [
help='Set to zLinux if your OpenStack version is prior to '
'Liberty and you\'re connecting to zLinux systems. '
'Otherwise set to auto. Valid values for this parameter '
'are: %s.' % six.text_type(helper.VALID_HOST_TYPES)[1:-1])
'are: %s.' % str(helper.VALID_HOST_TYPES)[1:-1])
]
CONF = cfg.CONF
@@ -177,12 +176,12 @@ class Lun(object):
def update_volume(self, lun):
lun.data_type = self.data_type
volume_update = lun.get_volume_update()
volume_update['provider_location'] = six.text_type({
volume_update['provider_location'] = str({
'vol_hex_id': self.ds_id})
if self.type_replication:
volume_update['replication_driver_data'] = json.dumps(
self.replication_driver_data)
volume_update['metadata']['replication'] = six.text_type(
volume_update['metadata']['replication'] = str(
self.replication_driver_data)
else:
volume_update.pop('replication_driver_data', None)
@@ -322,12 +321,12 @@ class Lun(object):
# Note: updating metadata in vol related funcs deletes all prior metadata
def get_volume_update(self):
volume_update = {}
volume_update['provider_location'] = six.text_type(
volume_update['provider_location'] = str(
{'vol_hex_id': self.ds_id})
# update metadata
if not self.is_snapshot:
if self.type_replication:
self.metadata['replication'] = six.text_type(
self.metadata['replication'] = str(
self.replication_driver_data)
else:
self.metadata.pop('replication', None)
@@ -1529,7 +1528,7 @@ class DS8KProxy(proxy.IBMStorageProxy):
raise exception.UnableToFailOver(
reason=(_("Unable to failover host to %(id)s. "
"Exception= %(ex)s")
% {'id': secondary_id, 'ex': six.text_type(e)}))
% {'id': secondary_id, 'ex': str(e)}))
for lun in failover_luns:
volume_update = lun.get_volume_update()
@@ -1594,7 +1593,7 @@ class DS8KProxy(proxy.IBMStorageProxy):
except restclient.APIException as e:
msg = (_('Failed to enable replication for group %(id)s, '
'Exception: %(ex)s.')
% {'id': group.id, 'ex': six.text_type(e)})
% {'id': group.id, 'ex': str(e)})
LOG.exception(msg)
raise exception.VolumeDriverException(message=msg)
for lun in luns:
@@ -1619,7 +1618,7 @@ class DS8KProxy(proxy.IBMStorageProxy):
except restclient.APIException as e:
msg = (_('Failed to disable replication for group %(id)s, '
'Exception: %(ex)s.')
% {'id': group.id, 'ex': six.text_type(e)})
% {'id': group.id, 'ex': str(e)})
LOG.exception(msg)
raise exception.VolumeDriverException(message=msg)
for lun in luns:
@@ -1681,7 +1680,7 @@ class DS8KProxy(proxy.IBMStorageProxy):
"backend %(bck_id)s. Exception= %(ex)s")
% {'grp_id': group.id,
'bck_id': secondary_backend_id,
'ex': six.text_type(e)}))
'ex': str(e)}))
for lun in luns:
volume_model_update = lun.get_volume_update()

View File

@@ -16,7 +16,6 @@
import eventlet
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder import coordination
from cinder import exception
@@ -555,7 +554,7 @@ class Replication(object):
raise exception.VolumeDriverException(
message=(_('Failed to delete the target volume for '
'volume %(volume)s, Exception: %(ex)s.')
% {'volume': lun.ds_id, 'ex': six.text_type(e)}))
% {'volume': lun.ds_id, 'ex': str(e)}))
lun.replication_status = 'disabled'
lun.replication_driver_data = {}
return lun

View File

@@ -16,12 +16,11 @@
import abc
import importlib
import json
import urllib
import eventlet
import requests
from requests import exceptions as req_exception
import six
from six.moves import urllib
from cinder import exception
from cinder.i18n import _
@@ -87,8 +86,7 @@ class TimeoutException(APIException):
pass
@six.add_metaclass(abc.ABCMeta)
class AbstractRESTConnector(object):
class AbstractRESTConnector(object, metaclass=abc.ABCMeta):
"""Inherit this class when you define your own connector."""
@abc.abstractmethod
@@ -142,7 +140,7 @@ class DefaultRESTConnector(AbstractRESTConnector):
def __init__(self, verify):
# overwrite certificate validation method only when using
# default connector, and not globally import the new scheme.
if isinstance(verify, six.string_types):
if isinstance(verify, str):
importlib.import_module("cinder.volume.drivers.ibm.ibm_storage."
"ds8k_connection")
self.session = None
@@ -151,7 +149,7 @@ class DefaultRESTConnector(AbstractRESTConnector):
def connect(self):
if self.session is None:
self.session = requests.Session()
if isinstance(self.verify, six.string_types):
if isinstance(self.verify, str):
self.session.mount('httpsds8k://',
requests.adapters.HTTPAdapter())
else:
@@ -166,7 +164,7 @@ class DefaultRESTConnector(AbstractRESTConnector):
def send(self, method='', url='', headers=None, payload='', timeout=900):
self.connect()
try:
if isinstance(self.verify, six.string_types):
if isinstance(self.verify, str):
url = url.replace('https://', 'httpsds8k://')
resp = self.session.request(method,
url,
@@ -176,13 +174,13 @@ class DefaultRESTConnector(AbstractRESTConnector):
return resp.status_code, resp.text
except req_exception.ConnectTimeout as e:
self.close()
return 408, "Connection time out: %s" % six.text_type(e)
return 408, "Connection time out: %s" % str(e)
except req_exception.SSLError as e:
self.close()
return False, "SSL error: %s" % six.text_type(e)
return False, "SSL error: %s" % str(e)
except Exception as e:
self.close()
return False, "Unexcepted exception: %s" % six.text_type(e)
return False, "Unexcepted exception: %s" % str(e)
class RESTScheduler(object):

View File

@@ -19,7 +19,6 @@ import inspect
from oslo_log import log as logging
from oslo_utils import timeutils
import six
from cinder.i18n import _
from cinder import version
@@ -261,7 +260,7 @@ class IBMStorageProxy(object):
return "Status: '%s', Code: %s" % (
exception.status, exception.code)
return six.text_type(exception)
return str(exception)
def _get_driver_super(self):
"""Gets the IBM Storage Drivers super class

View File

@@ -26,7 +26,6 @@ if pyxcli:
from pyxcli.events import events
from pyxcli.mirroring import mirrored_entities
from pyxcli import transports
import six
from cinder import context
from cinder.i18n import _
@@ -1002,7 +1001,7 @@ class XIVProxy(proxy.IBMStorageProxy):
meta['data']['initiator_target_map'] = (
self._build_initiator_target_map(fc_targets, connector))
LOG.debug(six.text_type(meta))
LOG.debug(str(meta))
return meta
@proxy._trace_time
@@ -2610,7 +2609,7 @@ class XIVProxy(proxy.IBMStorageProxy):
self._call_xiv_xcli(
"mapping_list",
host=host['name']).as_list]
luns = six.moves.xrange(MIN_LUNID, MAX_LUNID) # pylint: disable=E1101
luns = range(MIN_LUNID, MAX_LUNID)
for lun_id in luns:
if lun_id not in used_luns:
self._call_xiv_xcli(

View File

@@ -22,7 +22,6 @@ if pyxcli:
from pyxcli.mirroring import cg_recovery_manager
from pyxcli.mirroring import errors as m_errors
from pyxcli.mirroring import volume_recovery_manager
import six
from cinder.i18n import _
from cinder.volume.drivers.ibm.ibm_storage import strings
@@ -130,7 +129,7 @@ class Replication(object):
target, params = self.proxy._get_replication_target_params()
LOG.info('Target %(target)s: %(params)s',
{'target': target, 'params': six.text_type(params)})
{'target': target, 'params': str(params)})
try:
pool = params['san_clustername']