Merge "Rename nvme to nvmeof"
This commit is contained in:
commit
cc22ac0ed5
@ -64,7 +64,7 @@ connector_list = [
|
|||||||
'os_brick.initiator.windows.smbfs.WindowsSMBFSConnector',
|
'os_brick.initiator.windows.smbfs.WindowsSMBFSConnector',
|
||||||
'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
|
'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
|
||||||
'os_brick.initiator.connectors.storpool.StorPoolConnector',
|
'os_brick.initiator.connectors.storpool.StorPoolConnector',
|
||||||
'os_brick.initiator.connectors.nvme.NVMeConnector',
|
'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Mappings used to determine who to construct in the factory
|
# Mappings used to determine who to construct in the factory
|
||||||
@ -114,10 +114,12 @@ _connector_mapping_linux = {
|
|||||||
'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
|
'os_brick.initiator.connectors.vrtshyperscale.HyperScaleConnector',
|
||||||
initiator.STORPOOL:
|
initiator.STORPOOL:
|
||||||
'os_brick.initiator.connectors.storpool.StorPoolConnector',
|
'os_brick.initiator.connectors.storpool.StorPoolConnector',
|
||||||
|
# Leave this in for backwards compatibility
|
||||||
|
# This isn't an NVME connector, but NVME Over Fabrics
|
||||||
initiator.NVME:
|
initiator.NVME:
|
||||||
'os_brick.initiator.connectors.nvme.NVMeConnector',
|
'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
|
||||||
initiator.NVMEOF:
|
initiator.NVMEOF:
|
||||||
'os_brick.initiator.connectors.nvme.NVMeConnector',
|
'os_brick.initiator.connectors.nvmeof.NVMeOFConnector',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mapping for the S390X platform
|
# Mapping for the S390X platform
|
||||||
|
@ -30,14 +30,14 @@ LOG = logging.getLogger(__name__)
|
|||||||
synchronized = lockutils.synchronized_with_prefix('os-brick-')
|
synchronized = lockutils.synchronized_with_prefix('os-brick-')
|
||||||
|
|
||||||
|
|
||||||
class NVMeConnector(base.BaseLinuxConnector):
|
class NVMeOFConnector(base.BaseLinuxConnector):
|
||||||
|
|
||||||
"""Connector class to attach/detach NVMe over fabric volumes."""
|
"""Connector class to attach/detach NVMe over fabric volumes."""
|
||||||
|
|
||||||
def __init__(self, root_helper, driver=None, use_multipath=False,
|
def __init__(self, root_helper, driver=None, use_multipath=False,
|
||||||
device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
|
device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
|
||||||
*args, **kwargs):
|
*args, **kwargs):
|
||||||
super(NVMeConnector, self).__init__(
|
super(NVMeOFConnector, self).__init__(
|
||||||
root_helper,
|
root_helper,
|
||||||
driver=driver,
|
driver=driver,
|
||||||
device_scan_attempts=device_scan_attempts,
|
device_scan_attempts=device_scan_attempts,
|
||||||
@ -66,9 +66,9 @@ class NVMeConnector(base.BaseLinuxConnector):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_connector_properties(root_helper, *args, **kwargs):
|
def get_connector_properties(root_helper, *args, **kwargs):
|
||||||
"""The NVMe connector properties."""
|
"""The NVMeOF connector properties."""
|
||||||
nvme = NVMeConnector(root_helper=root_helper,
|
nvme = NVMeOFConnector(root_helper=root_helper,
|
||||||
execute=kwargs.get('execute'))
|
execute=kwargs.get('execute'))
|
||||||
uuid = nvme._get_system_uuid()
|
uuid = nvme._get_system_uuid()
|
||||||
if uuid:
|
if uuid:
|
||||||
return {"system uuid": uuid}
|
return {"system uuid": uuid}
|
@ -15,7 +15,7 @@ import mock
|
|||||||
from oslo_concurrency import processutils as putils
|
from oslo_concurrency import processutils as putils
|
||||||
|
|
||||||
from os_brick import exception
|
from os_brick import exception
|
||||||
from os_brick.initiator.connectors import nvme
|
from os_brick.initiator.connectors import nvmeof
|
||||||
from os_brick.initiator import linuxscsi
|
from os_brick.initiator import linuxscsi
|
||||||
from os_brick.tests.initiator import test_connector
|
from os_brick.tests.initiator import test_connector
|
||||||
|
|
||||||
@ -31,17 +31,17 @@ Node SN Model \
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
class NVMeOFConnectorTestCase(test_connector.ConnectorTestCase):
|
||||||
|
|
||||||
"""Test cases for NVMe initiator class."""
|
"""Test cases for NVMe initiator class."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(NVMeConnectorTestCase, self).setUp()
|
super(NVMeOFConnectorTestCase, self).setUp()
|
||||||
self.connector = nvme.NVMeConnector(None,
|
self.connector = nvmeof.NVMeOFConnector(None,
|
||||||
execute=self.fake_execute,
|
execute=self.fake_execute,
|
||||||
use_multipath=False)
|
use_multipath=False)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
def test_get_sysuuid_without_newline(self, mock_execute):
|
def test_get_sysuuid_without_newline(self, mock_execute):
|
||||||
mock_execute.return_value = (
|
mock_execute.return_value = (
|
||||||
"9126E942-396D-11E7-B0B7-A81E84C186D1\n", "")
|
"9126E942-396D-11E7-B0B7-A81E84C186D1\n", "")
|
||||||
@ -49,7 +49,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
expected_uuid = "9126E942-396D-11E7-B0B7-A81E84C186D1"
|
expected_uuid = "9126E942-396D-11E7-B0B7-A81E84C186D1"
|
||||||
self.assertEqual(expected_uuid, uuid)
|
self.assertEqual(expected_uuid, uuid)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
def test_get_connector_properties_without_sysuuid(
|
def test_get_connector_properties_without_sysuuid(
|
||||||
self, mock_execute):
|
self, mock_execute):
|
||||||
mock_execute.side_effect = putils.ProcessExecutionError
|
mock_execute.side_effect = putils.ProcessExecutionError
|
||||||
@ -57,7 +57,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
expected_props = {}
|
expected_props = {}
|
||||||
self.assertEqual(expected_props, props)
|
self.assertEqual(expected_props, props)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_system_uuid')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_system_uuid')
|
||||||
def test_get_connector_properties_with_sysuuid(
|
def test_get_connector_properties_with_sysuuid(
|
||||||
self, mock_sysuuid):
|
self, mock_sysuuid):
|
||||||
mock_sysuuid.return_value = "9126E942-396D-11E7-B0B7-A81E84C186D1"
|
mock_sysuuid.return_value = "9126E942-396D-11E7-B0B7-A81E84C186D1"
|
||||||
@ -66,24 +66,24 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
"system uuid": "9126E942-396D-11E7-B0B7-A81E84C186D1"}
|
"system uuid": "9126E942-396D-11E7-B0B7-A81E84C186D1"}
|
||||||
self.assertEqual(expected_props, props)
|
self.assertEqual(expected_props, props)
|
||||||
|
|
||||||
def _nvme_list_cmd(self, *args, **kwargs):
|
def _nvmeof_list_cmd(self, *args, **kwargs):
|
||||||
return FAKE_NVME_LIST_OUTPUT, None
|
return FAKE_NVME_LIST_OUTPUT, None
|
||||||
|
|
||||||
def test__get_nvme_devices(self):
|
def test__get_nvme_devices(self):
|
||||||
expected = ['/dev/nvme0n1', '/dev/nvme11n12']
|
expected = ['/dev/nvme0n1', '/dev/nvme11n12']
|
||||||
self.connector._execute = self._nvme_list_cmd
|
self.connector._execute = self._nvmeof_list_cmd
|
||||||
actual = self.connector._get_nvme_devices()
|
actual = self.connector._get_nvme_devices()
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_get_nvme_devices_raise(self, mock_sleep, mock_execute):
|
def test_get_nvme_devices_raise(self, mock_sleep, mock_execute):
|
||||||
mock_execute.side_effect = putils.ProcessExecutionError
|
mock_execute.side_effect = putils.ProcessExecutionError
|
||||||
self.assertRaises(exception.CommandExecutionFailed,
|
self.assertRaises(exception.CommandExecutionFailed,
|
||||||
self.connector._get_nvme_devices)
|
self.connector._get_nvme_devices)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_volume(self, mock_sleep, mock_execute, mock_devices):
|
def test_connect_volume(self, mock_sleep, mock_execute, mock_devices):
|
||||||
connection_properties = {'target_portal': 'portal',
|
connection_properties = {'target_portal': 'portal',
|
||||||
@ -111,8 +111,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
root_helper=None,
|
root_helper=None,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_volume_hostnqn(
|
def test_connect_volume_hostnqn(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -143,7 +143,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
root_helper=None,
|
root_helper=None,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_volume_raise(self, mock_sleep, mock_execute):
|
def test_connect_volume_raise(self, mock_sleep, mock_execute):
|
||||||
connection_properties = {'target_portal': 'portal',
|
connection_properties = {'target_portal': 'portal',
|
||||||
@ -156,8 +156,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
self.connector.connect_volume,
|
self.connector.connect_volume,
|
||||||
connection_properties)
|
connection_properties)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_volume_max_retry(
|
def test_connect_volume_max_retry(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -173,8 +173,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
self.connector.connect_volume,
|
self.connector.connect_volume,
|
||||||
connection_properties)
|
connection_properties)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_volume_nvmelist_retry_success(
|
def test_connect_volume_nvmelist_retry_success(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -192,10 +192,10 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
self.assertEqual('/dev/nvme0n2', device_info['path'])
|
self.assertEqual('/dev/nvme0n2', device_info['path'])
|
||||||
self.assertEqual('block', device_info['type'])
|
self.assertEqual('block', device_info['type'])
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_connect_nvme_retry_success(
|
def test_connect_nvmeof_retry_success(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
connection_properties = {'target_portal': 'portal',
|
connection_properties = {'target_portal': 'portal',
|
||||||
'target_port': 1,
|
'target_port': 1,
|
||||||
@ -214,8 +214,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
self.assertEqual('/dev/nvme0n2', device_info['path'])
|
self.assertEqual('/dev/nvme0n2', device_info['path'])
|
||||||
self.assertEqual('block', device_info['type'])
|
self.assertEqual('block', device_info['type'])
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_disconnect_volume_nova(
|
def test_disconnect_volume_nova(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -233,8 +233,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
root_helper=None,
|
root_helper=None,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_disconnect_volume_cinder(
|
def test_disconnect_volume_cinder(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -254,8 +254,8 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
root_helper=None,
|
root_helper=None,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_nvme_devices')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_nvme_devices')
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_execute')
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_disconnect_volume_raise(
|
def test_disconnect_volume_raise(
|
||||||
self, mock_sleep, mock_execute, mock_devices):
|
self, mock_sleep, mock_execute, mock_devices):
|
||||||
@ -272,7 +272,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
connection_properties,
|
connection_properties,
|
||||||
None)
|
None)
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, 'get_volume_paths')
|
@mock.patch.object(nvmeof.NVMeOFConnector, 'get_volume_paths')
|
||||||
def test_extend_volume_no_path(self, mock_volume_paths):
|
def test_extend_volume_no_path(self, mock_volume_paths):
|
||||||
mock_volume_paths.return_value = []
|
mock_volume_paths.return_value = []
|
||||||
connection_properties = {'target_portal': 'portal',
|
connection_properties = {'target_portal': 'portal',
|
||||||
@ -287,7 +287,7 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
|||||||
|
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device_path')
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device_path')
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'extend_volume')
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'extend_volume')
|
||||||
@mock.patch.object(nvme.NVMeConnector, 'get_volume_paths')
|
@mock.patch.object(nvmeof.NVMeOFConnector, 'get_volume_paths')
|
||||||
def test_extend_volume(self, mock_volume_paths, mock_scsi_extend,
|
def test_extend_volume(self, mock_volume_paths, mock_scsi_extend,
|
||||||
mock_scsi_find_mpath):
|
mock_scsi_find_mpath):
|
||||||
fake_new_size = 1024
|
fake_new_size = 1024
|
@ -24,7 +24,7 @@ from os_brick.initiator import connector
|
|||||||
from os_brick.initiator.connectors import base
|
from os_brick.initiator.connectors import base
|
||||||
from os_brick.initiator.connectors import fake
|
from os_brick.initiator.connectors import fake
|
||||||
from os_brick.initiator.connectors import iscsi
|
from os_brick.initiator.connectors import iscsi
|
||||||
from os_brick.initiator.connectors import nvme
|
from os_brick.initiator.connectors import nvmeof
|
||||||
from os_brick.initiator import linuxfc
|
from os_brick.initiator import linuxfc
|
||||||
from os_brick.privileged import rootwrap as priv_rootwrap
|
from os_brick.privileged import rootwrap as priv_rootwrap
|
||||||
from os_brick.tests import base as test_base
|
from os_brick.tests import base as test_base
|
||||||
@ -41,7 +41,7 @@ class ZeroIntervalLoopingCall(loopingcall.FixedIntervalLoopingCall):
|
|||||||
|
|
||||||
class ConnectorUtilsTestCase(test_base.TestCase):
|
class ConnectorUtilsTestCase(test_base.TestCase):
|
||||||
|
|
||||||
@mock.patch.object(nvme.NVMeConnector, '_get_system_uuid',
|
@mock.patch.object(nvmeof.NVMeOFConnector, '_get_system_uuid',
|
||||||
return_value=None)
|
return_value=None)
|
||||||
@mock.patch.object(iscsi.ISCSIConnector, 'get_initiator',
|
@mock.patch.object(iscsi.ISCSIConnector, 'get_initiator',
|
||||||
return_value='fakeinitiator')
|
return_value='fakeinitiator')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user