s390x fc: Fix device path for Ubuntu with ds8k

The device path to a block device on Ubuntu using a ds8k LUN
differs from the device path for other storage systems.

This patch adds the new device path as third possibility.

Change-Id: I92f1e5a2c7203af6c01c4742067ced16a840eb04
(cherry picked from commit f28bd8ea85)
This commit is contained in:
Andreas Scheuring 2018-01-18 17:31:24 +01:00
parent 078839732c
commit e91f19b171
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