]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Move 3 Fujitsu ETERNUS DX related file
authorYusuke Hayashi <hayashi-yusuke@jp.fujitsu.com>
Fri, 26 Dec 2014 12:21:04 +0000 (21:21 +0900)
committerYusuke Hayashi <hayashi-yusuke@jp.fujitsu.com>
Sat, 24 Jan 2015 23:31:35 +0000 (08:31 +0900)
Since there are three volume driver files relating to
Fujitsu ETERNUS DX in cinder.volume.drivers,
I make 'fujitsu' directory at cinder.volume.drivers
and I move these files to the directory.

Closes-Bug: #1402349

Change-Id: I449346fa86940113f5b9e7a7108338b45e981053

cinder/tests/test_fujitsu.py
cinder/tests/test_fujitsu_compatibility.py [new file with mode: 0644]
cinder/volume/drivers/fujitsu/__init__.py [new file with mode: 0644]
cinder/volume/drivers/fujitsu/eternus_dx_common.py [moved from cinder/volume/drivers/fujitsu_eternus_dx_common.py with 100% similarity]
cinder/volume/drivers/fujitsu/eternus_dx_fc.py [moved from cinder/volume/drivers/fujitsu_eternus_dx_fc.py with 98% similarity]
cinder/volume/drivers/fujitsu/eternus_dx_iscsi.py [moved from cinder/volume/drivers/fujitsu_eternus_dx_iscsi.py with 98% similarity]
cinder/volume/manager.py

index 9b22fb96686e30b1b86e750c53ecb322257e1cd6..08fa8e2e877590ac4d07054de5939c2d9eb19441 100644 (file)
@@ -23,9 +23,9 @@ from cinder import exception
 from cinder.i18n import _LW
 from cinder.openstack.common import log as logging
 from cinder import test
-from cinder.volume.drivers.fujitsu_eternus_dx_common import FJDXCommon
-from cinder.volume.drivers.fujitsu_eternus_dx_fc import FJDXFCDriver
-from cinder.volume.drivers.fujitsu_eternus_dx_iscsi import FJDXISCSIDriver
+import cinder.volume.drivers.fujitsu.eternus_dx_common as eternus_dx_common
+import cinder.volume.drivers.fujitsu.eternus_dx_fc as eternus_dx_fc
+import cinder.volume.drivers.fujitsu.eternus_dx_iscsi as eternus_dx_iscsi
 
 CONFIG_FILE_NAME = 'cinder_fujitsu_eternus_dx.xml'
 STORAGE_SYSTEM = '172.16.0.2'
@@ -653,15 +653,15 @@ class FJFCDriverTestCase(test.TestCase):
         #  replace some configuration function with fake
         # self.stubs.Set(self.driver.configuration, 'safe_get',
         #                self.fake_configuration_safe_get)
-        self.stubs.Set(FJDXCommon, '_get_ecom_connection',
+        self.stubs.Set(eternus_dx_common.FJDXCommon, '_get_ecom_connection',
                        self.fake_ecom_connection)
 
         instancename = FakeCIMInstanceName()
-        self.stubs.Set(FJDXCommon, '_getinstancename',
+        self.stubs.Set(eternus_dx_common.FJDXCommon, '_getinstancename',
                        instancename.fake_getinstancename)
 
         # set fc driver to self.driver
-        driver = FJDXFCDriver(configuration=self.configuration)
+        driver = eternus_dx_fc.FJDXFCDriver(configuration=self.configuration)
         driver.db = FakeDB()
         self.driver = driver
 
@@ -735,18 +735,19 @@ class FJISCSIDriverTestCase(test.TestCase):
         # self.stubs.Set(self.driver.configuration, 'safe_get',
         #                self.fake_configuration_safe_get)
 
-        self.stubs.Set(FJDXISCSIDriver, '_do_iscsi_discovery',
+        self.stubs.Set(eternus_dx_iscsi.FJDXISCSIDriver, '_do_iscsi_discovery',
                        self.fake_do_iscsi_discovery)
 
-        self.stubs.Set(FJDXCommon, '_get_ecom_connection',
+        self.stubs.Set(eternus_dx_common.FJDXCommon, '_get_ecom_connection',
                        self.fake_ecom_connection)
 
         instancename = FakeCIMInstanceName()
-        self.stubs.Set(FJDXCommon, '_getinstancename',
+        self.stubs.Set(eternus_dx_common.FJDXCommon, '_getinstancename',
                        instancename.fake_getinstancename)
 
         # set iscsi driver to self.driver
-        driver = FJDXISCSIDriver(configuration=self.configuration)
+        driver = (
+            eternus_dx_iscsi.FJDXISCSIDriver(configuration=self.configuration))
         driver.db = FakeDB()
         self.driver = driver
 
diff --git a/cinder/tests/test_fujitsu_compatibility.py b/cinder/tests/test_fujitsu_compatibility.py
new file mode 100644 (file)
index 0000000..c599288
--- /dev/null
@@ -0,0 +1,69 @@
+# Copyright (c) 2015 FUJITSU LIMITED
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+
+from oslo_config import cfg
+from oslo_utils import importutils
+
+from cinder import test
+import cinder.volume.drivers.fujitsu.eternus_dx_common as eternus_dx_common
+
+
+CONF = cfg.CONF
+
+FUJITSU_FC_MODULE = ('cinder.volume.drivers.fujitsu.'
+                     'eternus_dx_fc.FJDXFCDriver')
+
+FUJITSU_ISCSI_MODULE = ('cinder.volume.drivers.fujitsu.'
+                        'eternus_dx_iscsi.FJDXISCSIDriver')
+
+
+class FJDriverCompatibility(test.TestCase):
+
+    def setUp(self):
+        super(FJDriverCompatibility, self).setUp()
+        self.manager = importutils.import_object(CONF.volume_manager)
+
+        # Stub definition
+        self.stubs.Set(
+            eternus_dx_common.FJDXCommon, '__init__', self.fake_init)
+
+    def _load_driver(self, driver):
+        self.manager.__init__(volume_driver=driver)
+
+    def _driver_module_name(self):
+        return "%s.%s" % (self.manager.driver.__class__.__module__,
+                          self.manager.driver.__class__.__name__)
+
+    def fake_init(self, prtcl, configuration=None):
+        msg = "selected protocol is %s" % prtcl
+        self.assertTrue((prtcl == 'FC') or (prtcl == 'iSCSI'), msg=msg)
+
+    def test_fujitsu_driver_fc_old(self):
+        self._load_driver(
+            'cinder.volume.drivers.fujitsu_eternus_dx_fc.FJDXFCDriver')
+        self.assertEqual(FUJITSU_FC_MODULE, self._driver_module_name())
+
+    def test_fujitsu_driver_fc_new(self):
+        self._load_driver(FUJITSU_FC_MODULE)
+        self.assertEqual(FUJITSU_FC_MODULE, self._driver_module_name())
+
+    def test_fujitsu_driver_iscsi_old(self):
+        self._load_driver(
+            'cinder.volume.drivers.fujitsu_eternus_dx_iscsi.FJDXISCSIDriver')
+        self.assertEqual(FUJITSU_ISCSI_MODULE, self._driver_module_name())
+
+    def test_fujitsu_driver_iscsi_new(self):
+        self._load_driver(FUJITSU_ISCSI_MODULE)
+        self.assertEqual(FUJITSU_ISCSI_MODULE, self._driver_module_name())
diff --git a/cinder/volume/drivers/fujitsu/__init__.py b/cinder/volume/drivers/fujitsu/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 98%
rename from cinder/volume/drivers/fujitsu_eternus_dx_fc.py
rename to cinder/volume/drivers/fujitsu/eternus_dx_fc.py
index 0d71d4fdc58251d57584ecf146fcb695f2ff9e3b..695538a0a8681ad702001c8965d509f19e4e3f5c 100644 (file)
@@ -23,7 +23,7 @@ import six
 from cinder import context
 from cinder.openstack.common import log as logging
 from cinder.volume import driver
-from cinder.volume.drivers import fujitsu_eternus_dx_common
+from cinder.volume.drivers.fujitsu import eternus_dx_common
 from cinder.zonemanager import utils as fczm_utils
 
 LOG = logging.getLogger(__name__)
@@ -37,7 +37,7 @@ class FJDXFCDriver(driver.FibreChannelDriver):
     def __init__(self, *args, **kwargs):
 
         super(FJDXFCDriver, self).__init__(*args, **kwargs)
-        self.common = fujitsu_eternus_dx_common.FJDXCommon(
+        self.common = eternus_dx_common.FJDXCommon(
             'FC',
             configuration=self.configuration)
 
similarity index 98%
rename from cinder/volume/drivers/fujitsu_eternus_dx_iscsi.py
rename to cinder/volume/drivers/fujitsu/eternus_dx_iscsi.py
index 8ca64152c0c864160530b17863fac894c8957694..36bb0697f03b30d06286e47b413e286446c04252 100644 (file)
@@ -25,7 +25,7 @@ from cinder import exception
 from cinder.i18n import _, _LW
 from cinder.openstack.common import log as logging
 from cinder.volume import driver
-from cinder.volume.drivers import fujitsu_eternus_dx_common
+from cinder.volume.drivers.fujitsu import eternus_dx_common
 
 LOG = logging.getLogger(__name__)
 
@@ -39,7 +39,7 @@ class FJDXISCSIDriver(driver.ISCSIDriver):
 
         super(FJDXISCSIDriver, self).__init__(*args, **kwargs)
         self.common = \
-            fujitsu_eternus_dx_common.\
+            eternus_dx_common.\
             FJDXCommon('iSCSI', configuration=self.configuration)
 
     def check_for_setup_error(self):
index 4c3c31b93fb3361b4a5d240e93d1f4ae3c08cf41..755b909711e4618d9af67e1cfb3e2c241311a62c 100644 (file)
@@ -107,7 +107,11 @@ MAPPING = {
     'cinder.volume.drivers.huawei.huawei_hvs.HuaweiHVSISCSIDriver':
     'cinder.volume.drivers.huawei.huawei_18000.Huawei18000ISCSIDriver',
     'cinder.volume.drivers.huawei.huawei_hvs.HuaweiHVSFCDriver':
-    'cinder.volume.drivers.huawei.huawei_18000.Huawei18000FCDriver', }
+    'cinder.volume.drivers.huawei.huawei_18000.Huawei18000FCDriver',
+    'cinder.volume.drivers.fujitsu_eternus_dx_fc.FJDXFCDriver':
+    'cinder.volume.drivers.fujitsu.eternus_dx_fc.FJDXFCDriver',
+    'cinder.volume.drivers.fujitsu_eternus_dx_iscsi.FJDXISCSIDriver':
+    'cinder.volume.drivers.fujitsu.eternus_dx_iscsi.FJDXISCSIDriver', }
 
 
 def locked_volume_operation(f):