Browse Source

Merge "Rename nvme to nvmeof"

tags/2.10.0^0
Zuul 1 month ago
parent
commit
cc22ac0ed5

+ 5
- 3
os_brick/initiator/connector.py View File

@@ -64,7 +64,7 @@ connector_list = [
64 64
     'os_brick.initiator.windows.smbfs.WindowsSMBFSConnector',
65 65
     'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
66 66
     'os_brick.initiator.connectors.storpool.StorPoolConnector',
67
-    'os_brick.initiator.connectors.nvme.NVMeConnector',
67
+    'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
68 68
 ]
69 69
 
70 70
 # Mappings used to determine who to construct in the factory
@@ -114,10 +114,12 @@ _connector_mapping_linux = {
114 114
         'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
115 115
     initiator.STORPOOL:
116 116
         'os_brick.initiator.connectors.storpool.StorPoolConnector',
117
+    # Leave this in for backwards compatibility
118
+    # This isn't an NVME connector, but NVME Over Fabrics
117 119
     initiator.NVME:
118
-        'os_brick.initiator.connectors.nvme.NVMeConnector',
120
+        'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
119 121
     initiator.NVMEOF:
120
-        'os_brick.initiator.connectors.nvme.NVMeConnector',
122
+        'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
121 123
 }
122 124
 
123 125
 # Mapping for the S390X platform

os_brick/initiator/connectors/nvme.py → os_brick/initiator/connectors/nvmeof.py View File

@@ -30,14 +30,14 @@ LOG = logging.getLogger(__name__)
30 30
 synchronized = lockutils.synchronized_with_prefix('os-brick-')
31 31
 
32 32
 
33
-class NVMeConnector(base.BaseLinuxConnector):
33
+class NVMeOFConnector(base.BaseLinuxConnector):
34 34
 
35 35
     """Connector class to attach/detach NVMe over fabric volumes."""
36 36
 
37 37
     def __init__(self, root_helper, driver=None, use_multipath=False,
38 38
                  device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
39 39
                  *args, **kwargs):
40
-        super(NVMeConnector, self).__init__(
40
+        super(NVMeOFConnector, self).__init__(
41 41
             root_helper,
42 42
             driver=driver,
43 43
             device_scan_attempts=device_scan_attempts,
@@ -66,9 +66,9 @@ class NVMeConnector(base.BaseLinuxConnector):
66 66
 
67 67
     @staticmethod
68 68
     def get_connector_properties(root_helper, *args, **kwargs):
69
-        """The NVMe connector properties."""
70
-        nvme = NVMeConnector(root_helper=root_helper,
71
-                             execute=kwargs.get('execute'))
69
+        """The NVMeOF connector properties."""
70
+        nvme = NVMeOFConnector(root_helper=root_helper,
71
+                               execute=kwargs.get('execute'))
72 72
         uuid = nvme._get_system_uuid()
73 73
         if uuid:
74 74
             return {"system uuid": uuid}

os_brick/tests/initiator/connectors/test_nvme.py → os_brick/tests/initiator/connectors/test_nvmeof.py View File

@@ -15,7 +15,7 @@ import mock
15 15
 from oslo_concurrency import processutils as putils
16 16
 
17 17
 from os_brick import exception
18
-from os_brick.initiator.connectors import nvme
18
+from os_brick.initiator.connectors import nvmeof
19 19
 from os_brick.initiator import linuxscsi
20 20
 from os_brick.tests.initiator import test_connector
21 21
 
@@ -31,17 +31,17 @@ Node             SN                   Model                                  \
31 31
 """
32 32
 
33 33
 
34
-class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
34
+class NVMeOFConnectorTestCase(test_connector.ConnectorTestCase):
35 35
 
36 36
     """Test cases for NVMe initiator class."""
37 37
 
38 38
     def setUp(self):
39
-        super(NVMeConnectorTestCase, self).setUp()
40
-        self.connector = nvme.NVMeConnector(None,
41
-                                            execute=self.fake_execute,
42
-                                            use_multipath=False)
39
+        super(NVMeOFConnectorTestCase, self).setUp()
40
+        self.connector = nvmeof.NVMeOFConnector(None,
41
+                                                execute=self.fake_execute,
42
+                                                use_multipath=False)
43 43
 
44
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
44
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
45 45
     def test_get_sysuuid_without_newline(self, mock_execute):
46 46
         mock_execute.return_value = (
47 47
             "9126E942-396D-11E7-B0B7-A81E84C186D1\n", "")
@@ -49,7 +49,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
49 49
         expected_uuid = "9126E942-396D-11E7-B0B7-A81E84C186D1"
50 50
         self.assertEqual(expected_uuid, uuid)
51 51
 
52
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
52
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
53 53
     def test_get_connector_properties_without_sysuuid(
54 54
             self, mock_execute):
55 55
         mock_execute.side_effect = putils.ProcessExecutionError
@@ -57,7 +57,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
57 57
         expected_props = {}
58 58
         self.assertEqual(expected_props, props)
59 59
 
60
-    @mock.patch.object(nvme.NVMeConnector, '_get_system_uuid')
60
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_system_uuid')
61 61
     def test_get_connector_properties_with_sysuuid(
62 62
             self, mock_sysuuid):
63 63
         mock_sysuuid.return_value = "9126E942-396D-11E7-B0B7-A81E84C186D1"
@@ -66,24 +66,24 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
66 66
             "system uuid": "9126E942-396D-11E7-B0B7-A81E84C186D1"}
67 67
         self.assertEqual(expected_props, props)
68 68
 
69
-    def _nvme_list_cmd(self, *args, **kwargs):
69
+    def _nvmeof_list_cmd(self, *args, **kwargs):
70 70
         return FAKE_NVME_LIST_OUTPUT, None
71 71
 
72 72
     def test__get_nvme_devices(self):
73 73
         expected = ['/dev/nvme0n1', '/dev/nvme11n12']
74
-        self.connector._execute = self._nvme_list_cmd
74
+        self.connector._execute = self._nvmeof_list_cmd
75 75
         actual = self.connector._get_nvme_devices()
76 76
         self.assertEqual(expected, actual)
77 77
 
78
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
78
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
79 79
     @mock.patch('time.sleep')
80 80
     def test_get_nvme_devices_raise(self, mock_sleep, mock_execute):
81 81
         mock_execute.side_effect = putils.ProcessExecutionError
82 82
         self.assertRaises(exception.CommandExecutionFailed,
83 83
                           self.connector._get_nvme_devices)
84 84
 
85
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
86
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
85
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
86
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
87 87
     @mock.patch('time.sleep')
88 88
     def test_connect_volume(self, mock_sleep, mock_execute, mock_devices):
89 89
         connection_properties = {'target_portal': 'portal',
@@ -111,8 +111,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
111 111
             root_helper=None,
112 112
             run_as_root=True)
113 113
 
114
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
115
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
114
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
115
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
116 116
     @mock.patch('time.sleep')
117 117
     def test_connect_volume_hostnqn(
118 118
             self, mock_sleep, mock_execute, mock_devices):
@@ -143,7 +143,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
143 143
             root_helper=None,
144 144
             run_as_root=True)
145 145
 
146
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
146
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
147 147
     @mock.patch('time.sleep')
148 148
     def test_connect_volume_raise(self, mock_sleep, mock_execute):
149 149
         connection_properties = {'target_portal': 'portal',
@@ -156,8 +156,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
156 156
                           self.connector.connect_volume,
157 157
                           connection_properties)
158 158
 
159
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
160
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
159
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
160
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
161 161
     @mock.patch('time.sleep')
162 162
     def test_connect_volume_max_retry(
163 163
             self, mock_sleep, mock_execute, mock_devices):
@@ -173,8 +173,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
173 173
                           self.connector.connect_volume,
174 174
                           connection_properties)
175 175
 
176
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
177
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
176
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
177
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
178 178
     @mock.patch('time.sleep')
179 179
     def test_connect_volume_nvmelist_retry_success(
180 180
             self, mock_sleep, mock_execute, mock_devices):
@@ -192,10 +192,10 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
192 192
         self.assertEqual('/dev/nvme0n2', device_info['path'])
193 193
         self.assertEqual('block', device_info['type'])
194 194
 
195
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
196
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
195
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
196
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
197 197
     @mock.patch('time.sleep')
198
-    def test_connect_nvme_retry_success(
198
+    def test_connect_nvmeof_retry_success(
199 199
             self, mock_sleep, mock_execute, mock_devices):
200 200
         connection_properties = {'target_portal': 'portal',
201 201
                                  'target_port': 1,
@@ -214,8 +214,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
214 214
         self.assertEqual('/dev/nvme0n2', device_info['path'])
215 215
         self.assertEqual('block', device_info['type'])
216 216
 
217
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
218
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
217
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
218
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
219 219
     @mock.patch('time.sleep')
220 220
     def test_disconnect_volume_nova(
221 221
             self, mock_sleep, mock_execute, mock_devices):
@@ -233,8 +233,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
233 233
             root_helper=None,
234 234
             run_as_root=True)
235 235
 
236
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
237
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
236
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
237
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
238 238
     @mock.patch('time.sleep')
239 239
     def test_disconnect_volume_cinder(
240 240
             self, mock_sleep, mock_execute, mock_devices):
@@ -254,8 +254,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
254 254
             root_helper=None,
255 255
             run_as_root=True)
256 256
 
257
-    @mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
258
-    @mock.patch.object(nvme.NVMeConnector, '_execute')
257
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
258
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
259 259
     @mock.patch('time.sleep')
260 260
     def test_disconnect_volume_raise(
261 261
             self, mock_sleep, mock_execute, mock_devices):
@@ -272,7 +272,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
272 272
                           connection_properties,
273 273
                           None)
274 274
 
275
-    @mock.patch.object(nvme.NVMeConnector, 'get_volume_paths')
275
+    @mock.patch.object(nvmeof.NVMeOFConnector, 'get_volume_paths')
276 276
     def test_extend_volume_no_path(self, mock_volume_paths):
277 277
         mock_volume_paths.return_value = []
278 278
         connection_properties = {'target_portal': 'portal',
@@ -287,7 +287,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
287 287
 
288 288
     @mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device_path')
289 289
     @mock.patch.object(linuxscsi.LinuxSCSI, 'extend_volume')
290
-    @mock.patch.object(nvme.NVMeConnector, 'get_volume_paths')
290
+    @mock.patch.object(nvmeof.NVMeOFConnector, 'get_volume_paths')
291 291
     def test_extend_volume(self, mock_volume_paths, mock_scsi_extend,
292 292
                            mock_scsi_find_mpath):
293 293
         fake_new_size = 1024

+ 2
- 2
os_brick/tests/initiator/test_connector.py View File

@@ -24,7 +24,7 @@ from os_brick.initiator import connector
24 24
 from os_brick.initiator.connectors import base
25 25
 from os_brick.initiator.connectors import fake
26 26
 from os_brick.initiator.connectors import iscsi
27
-from os_brick.initiator.connectors import nvme
27
+from os_brick.initiator.connectors import nvmeof
28 28
 from os_brick.initiator import linuxfc
29 29
 from os_brick.privileged import rootwrap as priv_rootwrap
30 30
 from os_brick.tests import base as test_base
@@ -41,7 +41,7 @@ class ZeroIntervalLoopingCall(loopingcall.FixedIntervalLoopingCall):
41 41
 
42 42
 class ConnectorUtilsTestCase(test_base.TestCase):
43 43
 
44
-    @mock.patch.object(nvme.NVMeConnector, '_get_system_uuid',
44
+    @mock.patch.object(nvmeof.NVMeOFConnector, '_get_system_uuid',
45 45
                        return_value=None)
46 46
     @mock.patch.object(iscsi.ISCSIConnector, 'get_initiator',
47 47
                        return_value='fakeinitiator')

Loading…
Cancel
Save