Merge "Fixes get_all_available_volumes return value"
This commit is contained in:
commit
e4c19a5493
@ -464,15 +464,16 @@ class InitiatorConnector(executor.Executor):
|
||||
of the target volume attributes.
|
||||
:type connection_properties: dict
|
||||
"""
|
||||
volumes = []
|
||||
path = self.get_search_path()
|
||||
if path:
|
||||
# now find all entries in the search path
|
||||
if os.path.isdir(path):
|
||||
path_items = [path, '/*']
|
||||
file_filter = ''.join(path_items)
|
||||
return glob.glob(file_filter)
|
||||
else:
|
||||
return []
|
||||
volumes = glob.glob(file_filter)
|
||||
|
||||
return volumes
|
||||
|
||||
def check_IO_handle_valid(self, handle, data_type, protocol):
|
||||
"""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'])
|
||||
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):
|
||||
def setUp(self):
|
||||
@ -1453,6 +1460,13 @@ class FibreChannelConnectorTestCase(ConnectorTestCase):
|
||||
new_size = self.connector.extend_volume(connection_info['data'])
|
||||
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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user