# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-"""Tests for huawei 18000 storage."""
+"""Tests for huawei drivers."""
import json
import mock
import os
'timestamp': '2015-07-13T11:41:00.513549',
'smartpartition': True,
'allocated_capacity_gb': 0,
- 'volume_backend_name': 'Huawei18000FCDriver',
+ 'volume_backend_name': 'HuaweiFCDriver',
'free_capacity_gb': 20.0,
'driver_version': '1.1.0',
'total_capacity_gb': 20.0,
pass
-class Fake18000Client(rest_client.RestClient):
+class FakeClient(rest_client.RestClient):
def __init__(self, configuration):
rest_client.RestClient.__init__(self, configuration)
return json.loads(data)
-class Fake18000ISCSIStorage(huawei_driver.Huawei18000ISCSIDriver):
+class FakeISCSIStorage(huawei_driver.HuaweiISCSIDriver):
"""Fake Huawei Storage, Rewrite some methods of HuaweiISCSIDriver."""
def __init__(self, configuration):
self.xml_file_path = self.configuration.cinder_huawei_conf_file
def do_setup(self):
- self.restclient = Fake18000Client(configuration=self.configuration)
+ self.restclient = FakeClient(configuration=self.configuration)
-class Fake18000FCStorage(huawei_driver.Huawei18000FCDriver):
+class FakeFCStorage(huawei_driver.HuaweiFCDriver):
"""Fake Huawei Storage, Rewrite some methods of HuaweiISCSIDriver."""
def __init__(self, configuration):
self.fcsan_lookup_service = None
def do_setup(self):
- self.restclient = Fake18000Client(configuration=self.configuration)
+ self.restclient = FakeClient(configuration=self.configuration)
-class Huawei18000ISCSIDriverTestCase(test.TestCase):
+class HuaweiISCSIDriverTestCase(test.TestCase):
def setUp(self):
- super(Huawei18000ISCSIDriverTestCase, self).setUp()
+ super(HuaweiISCSIDriverTestCase, self).setUp()
self.tmp_dir = tempfile.mkdtemp()
self.fake_conf_file = self.tmp_dir + '/cinder_huawei_conf.xml'
self.addCleanup(shutil.rmtree, self.tmp_dir)
self.xml_file_path = self.configuration.cinder_huawei_conf_file
self.configuration.hypermetro_devices = hypermetro_devices
self.stubs.Set(time, 'sleep', Fake_sleep)
- driver = Fake18000ISCSIStorage(configuration=self.configuration)
+ driver = FakeISCSIStorage(configuration=self.configuration)
self.driver = driver
self.driver.do_setup()
self.portgroup = 'portgroup-test'
def test_get_volume_status(self):
self.driver.restclient.login()
data = self.driver.get_volume_stats()
- self.assertEqual('1.1.1', data['driver_version'])
+ self.assertEqual('2.0.0', data['driver_version'])
def test_extend_volume(self):
self.driver.restclient.login()
return fake_fabric_mapping
-class Huawei18000FCDriverTestCase(test.TestCase):
+class HuaweiFCDriverTestCase(test.TestCase):
def setUp(self):
- super(Huawei18000FCDriverTestCase, self).setUp()
+ super(HuaweiFCDriverTestCase, self).setUp()
self.tmp_dir = tempfile.mkdtemp()
self.fake_conf_file = self.tmp_dir + '/cinder_huawei_conf.xml'
self.addCleanup(shutil.rmtree, self.tmp_dir)
self.xml_file_path = self.configuration.cinder_huawei_conf_file
self.configuration.hypermetro_devices = hypermetro_devices
self.stubs.Set(time, 'sleep', Fake_sleep)
- driver = Fake18000FCStorage(configuration=self.configuration)
+ driver = FakeFCStorage(configuration=self.configuration)
self.driver = driver
self.driver.do_setup()
def test_get_volume_status(self):
self.driver.restclient.login()
data = self.driver.get_volume_stats()
- self.assertEqual('1.1.1', data['driver_version'])
+ self.assertEqual('2.0.0', data['driver_version'])
def test_extend_volume(self):
self.driver.restclient.login()
'capabilities':
{'location_info': '210235G7J20000000000',
'allocated_capacity_gb': 0,
- 'volume_backend_name': 'Huawei18000FCDriver',
+ 'volume_backend_name': 'HuaweiFCDriver',
'storage_protocol': 'FC'}}
is_valid = self.driver._check_migration_valid(invalid_host1,
test_volume)
{'location_info': '210235G7J20000000001',
'allocated_capacity_gb': 0,
'pool_name': 'OpenStack_Pool',
- 'volume_backend_name': 'Huawei18000FCDriver',
+ 'volume_backend_name': 'HuaweiFCDriver',
'storage_protocol': 'FC'}}
is_valid = self.driver._check_migration_valid(invalid_host2,
test_volume)
{'location_info': '210235G7J20000000001',
'allocated_capacity_gb': 0,
'pool_name': 'OpenStack_Pool',
- 'volume_backend_name': 'Huawei18000FCDriver',
+ 'volume_backend_name': 'HuaweiFCDriver',
'storage_protocol': 'iSCSI'}}
is_valid = self.driver._check_migration_valid(invalid_host2,
volume_in_use)
{'location_info': '210235G7J20000000001',
'allocated_capacity_gb': 0,
'pool_name': '',
- 'volume_backend_name': 'Huawei18000FCDriver',
+ 'volume_backend_name': 'HuaweiFCDriver',
'storage_protocol': 'iSCSI'}}
is_valid = self.driver._check_migration_valid(invalid_host3,
test_volume)
if constants.MIGRATION_COMPLETE == item['RUNNINGSTATUS']:
return True
if constants.MIGRATION_FAULT == item['RUNNINGSTATUS']:
- err_msg = _('Lun migration error.')
+ err_msg = _("Lun migration error.")
LOG.error(err_msg)
raise exception.VolumeBackendAPIException(data=err_msg)
if not found_migration_task:
self.restclient.delete_luncopy(luncopy_id)
-class Huawei18000ISCSIDriver(HuaweiBaseDriver, driver.ISCSIDriver):
- """ISCSI driver for Huawei OceanStor 18000 storage arrays.
+class HuaweiISCSIDriver(HuaweiBaseDriver, driver.ISCSIDriver):
+ """ISCSI driver for Huawei storage arrays.
Version history:
1.0.0 - Initial driver
SmartX support
Volume migration support
Volume retype support
+ 2.0.0 - Rename to HuaweiISCSIDriver
"""
- VERSION = "1.1.1"
+ VERSION = "2.0.0"
def __init__(self, *args, **kwargs):
- super(Huawei18000ISCSIDriver, self).__init__(*args, **kwargs)
+ super(HuaweiISCSIDriver, self).__init__(*args, **kwargs)
def get_volume_stats(self, refresh=False):
"""Get volume status."""
self.restclient.delete_mapping_view(view_id)
-class Huawei18000FCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
- """FC driver for Huawei OceanStor 18000 storage arrays.
+class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
+ """FC driver for Huawei storage arrays.
Version history:
1.0.0 - Initial driver
Volume retype support
FC zone enhancement
Volume hypermetro support
+ 2.0.0 - Rename to HuaweiFCDriver
"""
- VERSION = "1.1.1"
+ VERSION = "2.0.0"
def __init__(self, *args, **kwargs):
- super(Huawei18000FCDriver, self).__init__(*args, **kwargs)
+ super(HuaweiFCDriver, self).__init__(*args, **kwargs)
self.fcsan_lookup_service = None
def get_volume_stats(self, refresh=False):