Merge "Fixes get_all_available_volumes return value"
This commit is contained in:
commit
e4c19a5493
os_brick
@ -464,15 +464,16 @@ class InitiatorConnector(executor.Executor):
|
|||||||
of the target volume attributes.
|
of the target volume attributes.
|
||||||
:type connection_properties: dict
|
:type connection_properties: dict
|
||||||
"""
|
"""
|
||||||
|
volumes = []
|
||||||
path = self.get_search_path()
|
path = self.get_search_path()
|
||||||
if path:
|
if path:
|
||||||
# now find all entries in the search path
|
# now find all entries in the search path
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
path_items = [path, '/*']
|
path_items = [path, '/*']
|
||||||
file_filter = ''.join(path_items)
|
file_filter = ''.join(path_items)
|
||||||
return glob.glob(file_filter)
|
volumes = glob.glob(file_filter)
|
||||||
else:
|
|
||||||
return []
|
return volumes
|
||||||
|
|
||||||
def check_IO_handle_valid(self, handle, data_type, protocol):
|
def check_IO_handle_valid(self, handle, data_type, protocol):
|
||||||
"""Check IO handle has correct data type."""
|
"""Check IO handle has correct data type."""
|
||||||
|
@ -1102,6 +1102,13 @@ Setting up iSCSI targets: unused
|
|||||||
new_size = self.connector.extend_volume(connection_info['data'])
|
new_size = self.connector.extend_volume(connection_info['data'])
|
||||||
self.assertEqual(fake_new_size, new_size)
|
self.assertEqual(fake_new_size, new_size)
|
||||||
|
|
||||||
|
@mock.patch.object(os.path, 'isdir')
|
||||||
|
def test_get_all_available_volumes_path_not_dir(self, mock_isdir):
|
||||||
|
mock_isdir.return_value = False
|
||||||
|
expected = []
|
||||||
|
actual = self.connector.get_all_available_volumes()
|
||||||
|
self.assertItemsEqual(expected, actual)
|
||||||
|
|
||||||
|
|
||||||
class FibreChannelConnectorTestCase(ConnectorTestCase):
|
class FibreChannelConnectorTestCase(ConnectorTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -1453,6 +1460,13 @@ class FibreChannelConnectorTestCase(ConnectorTestCase):
|
|||||||
new_size = self.connector.extend_volume(connection_info['data'])
|
new_size = self.connector.extend_volume(connection_info['data'])
|
||||||
self.assertEqual(fake_new_size, new_size)
|
self.assertEqual(fake_new_size, new_size)
|
||||||
|
|
||||||
|
@mock.patch.object(os.path, 'isdir')
|
||||||
|
def test_get_all_available_volumes_path_not_dir(self, mock_isdir):
|
||||||
|
mock_isdir.return_value = False
|
||||||
|
expected = []
|
||||||
|
actual = self.connector.get_all_available_volumes()
|
||||||
|
self.assertItemsEqual(expected, actual)
|
||||||
|
|
||||||
|
|
||||||
class FibreChannelConnectorS390XTestCase(ConnectorTestCase):
|
class FibreChannelConnectorS390XTestCase(ConnectorTestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user