Rename Huawei drivers

Rename Huawei18000ISCSIDriver and Huawei18000FCDriver
to HuaweiISCSIDriver and HuaweiFCDriver.

DocImpact
Implements: blueprint huawei-driver-rename
Change-Id: I21f5a2d5bbf9a0af9e9b01878c271e9329f44cff
This commit is contained in:
Wilson Liu 2015-10-21 20:51:59 +08:00
parent 0589eaaf72
commit 30d68cebc6
5 changed files with 43 additions and 34 deletions

View File

@ -12,7 +12,7 @@
# 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
@ -121,7 +121,7 @@ test_host = {'host': 'ubuntu001@backend001#OpenStack_Pool',
'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,
@ -1395,7 +1395,7 @@ def Fake_sleep(time):
pass
class Fake18000Client(rest_client.RestClient):
class FakeClient(rest_client.RestClient):
def __init__(self, configuration):
rest_client.RestClient.__init__(self, configuration)
@ -1476,7 +1476,7 @@ class Fake18000Client(rest_client.RestClient):
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):
@ -1484,10 +1484,10 @@ class Fake18000ISCSIStorage(huawei_driver.Huawei18000ISCSIDriver):
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):
@ -1496,13 +1496,13 @@ class Fake18000FCStorage(huawei_driver.Huawei18000FCDriver):
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)
@ -1513,7 +1513,7 @@ class Huawei18000ISCSIDriverTestCase(test.TestCase):
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'
@ -1610,7 +1610,7 @@ class Huawei18000ISCSIDriverTestCase(test.TestCase):
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()
@ -2082,10 +2082,10 @@ class FCSanLookupService(object):
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)
@ -2096,7 +2096,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
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()
@ -2153,7 +2153,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
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()
@ -2310,7 +2310,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
'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)
@ -2321,7 +2321,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
{'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)
@ -2340,7 +2340,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
{'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)
@ -2351,7 +2351,7 @@ class Huawei18000FCDriverTestCase(test.TestCase):
{'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)

View File

@ -22,9 +22,9 @@ from cinder import test
CONF = cfg.CONF
HUAWEI_ISCSI_MODULE = ("cinder.volume.drivers.huawei.huawei_driver."
"Huawei18000ISCSIDriver")
"HuaweiISCSIDriver")
HUAWEI_FC_MODULE = ("cinder.volume.drivers.huawei.huawei_driver."
"Huawei18000FCDriver")
"HuaweiFCDriver")
class VolumeDriverCompatibility(test.TestCase):
@ -47,7 +47,8 @@ class VolumeDriverCompatibility(test.TestCase):
def test_huawei_driver_iscsi_old(self):
self._load_driver(
'cinder.volume.drivers.huawei.huawei_18000.Huawei18000ISCSIDriver')
'cinder.volume.drivers.huawei.huawei_driver.'
'Huawei18000ISCSIDriver')
self.assertEqual(self._driver_module_name(), HUAWEI_ISCSI_MODULE)
def test_huawei_driver_iscsi_new(self):
@ -56,7 +57,7 @@ class VolumeDriverCompatibility(test.TestCase):
def test_huawei_driver_fc_old(self):
self._load_driver(
'cinder.volume.drivers.huawei.huawei_18000.Huawei18000FCDriver')
'cinder.volume.drivers.huawei.huawei_driver.Huawei18000FCDriver')
self.assertEqual(self._driver_module_name(), HUAWEI_FC_MODULE)
def test_huawei_driver_fc_new(self):

View File

@ -227,7 +227,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
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:
@ -840,8 +840,8 @@ class HuaweiBaseDriver(driver.VolumeDriver):
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
@ -853,12 +853,13 @@ class Huawei18000ISCSIDriver(HuaweiBaseDriver, driver.ISCSIDriver):
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."""
@ -1037,8 +1038,8 @@ class Huawei18000ISCSIDriver(HuaweiBaseDriver, driver.ISCSIDriver):
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
@ -1050,12 +1051,13 @@ class Huawei18000FCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
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):

View File

@ -113,9 +113,13 @@ CONF.register_opts(volume_manager_opts)
MAPPING = {
'cinder.volume.drivers.huawei.huawei_18000.Huawei18000ISCSIDriver':
'cinder.volume.drivers.huawei.huawei_driver.Huawei18000ISCSIDriver',
'cinder.volume.drivers.huawei.huawei_driver.HuaweiISCSIDriver',
'cinder.volume.drivers.huawei.huawei_driver.Huawei18000ISCSIDriver':
'cinder.volume.drivers.huawei.huawei_driver.HuaweiISCSIDriver',
'cinder.volume.drivers.huawei.huawei_18000.Huawei18000FCDriver':
'cinder.volume.drivers.huawei.huawei_driver.Huawei18000FCDriver',
'cinder.volume.drivers.huawei.huawei_driver.HuaweiFCDriver',
'cinder.volume.drivers.huawei.huawei_driver.Huawei18000FCDriver':
'cinder.volume.drivers.huawei.huawei_driver.HuaweiFCDriver',
'cinder.volume.drivers.fujitsu_eternus_dx_fc.FJDXFCDriver':
'cinder.volume.drivers.fujitsu.eternus_dx_fc.FJDXFCDriver',
'cinder.volume.drivers.fujitsu_eternus_dx_iscsi.FJDXISCSIDriver':

View File

@ -0,0 +1,2 @@
upgrade:
- Rename Huawei18000ISCSIDriver and Huawei18000FCDriver to HuaweiISCSIDriver and HuaweiFCDriver.