Merge "s390x fc: Fix device path for Ubuntu with ds8k"

This commit is contained in:
Zuul 2018-02-13 10:29:51 +00:00 committed by Gerrit Code Review
commit 1b6d30e112
2 changed files with 9 additions and 2 deletions

View File

@ -71,14 +71,19 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector):
def _get_device_file_path(self, pci_num, target_wwn, lun):
# NOTE(arne_r)
# Need to add two possible ways to resolve device paths,
# Need to add multiple possible ways to resolve device paths,
# depending on OS. Since it gets passed to '_get_possible_volume_paths'
# having a mismatch is not a problem
host_device = [
# RHEL based
"/dev/disk/by-path/ccw-%s-zfcp-%s:%s" % (
pci_num, target_wwn, self._get_lun_string(lun)),
# Debian based (e.g. for storwize)
"/dev/disk/by-path/ccw-%s-fc-%s-lun-%s" % (
pci_num, target_wwn, lun),
# Debian based (e.g. for ds8k)
"/dev/disk/by-path/ccw-%s-fc-%s-lun-%s" % (
pci_num, target_wwn, self._get_lun_string(lun)),
]
return host_device

View File

@ -37,11 +37,13 @@ class FibreChannelConnectorS390XTestCase(test_connector.ConnectorTestCase):
devices = self.connector._get_host_devices(possible_devs, lun)
mock_configure_scsi_device.assert_called_with(3, 5,
"0x0002000000000000")
self.assertEqual(2, len(devices))
self.assertEqual(3, len(devices))
device_path = "/dev/disk/by-path/ccw-3-zfcp-5:0x0002000000000000"
self.assertEqual(devices[0], device_path)
device_path = "/dev/disk/by-path/ccw-3-fc-5-lun-2"
self.assertEqual(devices[1], device_path)
device_path = "/dev/disk/by-path/ccw-3-fc-5-lun-0x0002000000000000"
self.assertEqual(devices[2], device_path)
def test_get_lun_string(self):
lun = 1